summaryrefslogtreecommitdiff
path: root/core.lisp
diff options
context:
space:
mode:
authorDavid Bjergaard <dbjergaard@gmail.com>2015-01-27 11:21:05 -0500
committerDavid Bjergaard <dbjergaard@gmail.com>2015-01-27 11:21:05 -0500
commit92072b5968353e75ada99f3c024b223d43b86389 (patch)
treefdd790024dcf21319973f771277943b82e25f783 /core.lisp
parent767158fe1f1dd763a239f837d1fd398b50d45a4d (diff)
parent307fab23d18ac719a8aa85f385961df6bea387ff (diff)
Fixing merge conflict for #146
Diffstat (limited to 'core.lisp')
-rw-r--r--core.lisp20
1 files changed, 19 insertions, 1 deletions
diff --git a/core.lisp b/core.lisp
index df653d4..3271eb7 100644
--- a/core.lisp
+++ b/core.lisp
@@ -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))