diff options
author | David Bjergaard <dbjergaard@gmail.com> | 2015-01-27 11:21:05 -0500 |
---|---|---|
committer | David Bjergaard <dbjergaard@gmail.com> | 2015-01-27 11:21:05 -0500 |
commit | 92072b5968353e75ada99f3c024b223d43b86389 (patch) | |
tree | fdd790024dcf21319973f771277943b82e25f783 /core.lisp | |
parent | 767158fe1f1dd763a239f837d1fd398b50d45a4d (diff) | |
parent | 307fab23d18ac719a8aa85f385961df6bea387ff (diff) |
Fixing merge conflict for #146
Diffstat (limited to 'core.lisp')
-rw-r--r-- | core.lisp | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -25,8 +25,26 @@ (in-package :stumpwm) -;;; keyboard helper functions +(export '(grab-pointer ungrab-pointer)) + +;; Wow, is there an easier way to do this? +(defmacro def-thing-attr-macro (thing hash-slot) + (let ((attr (gensym "ATTR")) + (obj (gensym "METAOBJ")) + (val (gensym "METAVAL"))) + `(defmacro ,(intern1 (format nil "DEF-~a-ATTR" thing)) (,attr) + "Create a new attribute and corresponding get/set functions." + (let ((,obj (gensym "OBJ")) + (,val (gensym "VAL"))) + `(progn + (defun ,(intern1 (format nil ,(format nil "~a-~~a" thing) ,attr)) (,,obj) + (gethash ,,attr (,(quote ,hash-slot) ,,obj))) + (defun (setf ,(intern1 (format nil ,(format nil "~a-~~a" thing) ,attr))) (,,val ,,obj) + (setf (gethash ,,attr (,(quote ,hash-slot) ,,obj))) ,,val)))))) + + +;;; keyboard helper functions (defun key-to-keycode+state (key) (let ((code (xlib:keysym->keycodes *display* (key-keysym key)))) (cond ((eq (xlib:keycode->keysym *display* code 0) (key-keysym key)) |