[clfswm-cvs] r302 - in clfswm: . src

Philippe Brochard pbrochard at common-lisp.net
Thu Aug 26 21:29:45 UTC 2010


Author: pbrochard
Date: Thu Aug 26 17:29:45 2010
New Revision: 302

Log:
src/clfswm-circulate-mode.lisp (circulate-loop-function):	Use is-a-key-pressed-p. src/xlib-util.lisp (is-a-key-pressed-p): New predicate.

Modified:
   clfswm/ChangeLog
   clfswm/src/clfswm-circulate-mode.lisp
   clfswm/src/xlib-util.lisp

Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog	(original)
+++ clfswm/ChangeLog	Thu Aug 26 17:29:45 2010
@@ -1,5 +1,10 @@
 2010-08-26  Philippe Brochard  <pbrochard at common-lisp.net>
 
+	* src/clfswm-circulate-mode.lisp (circulate-loop-function):
+	Use is-a-key-pressed-p.
+
+	* src/xlib-util.lisp (is-a-key-pressed-p): New predicate.
+
 	* src/clfswm-keys.lisp (define-ungrab/grab): Use all values
 	returned by xlib:keysym->keycodes.
 

Modified: clfswm/src/clfswm-circulate-mode.lisp
==============================================================================
--- clfswm/src/clfswm-circulate-mode.lisp	(original)
+++ clfswm/src/clfswm-circulate-mode.lisp	Thu Aug 26 17:29:45 2010
@@ -33,8 +33,6 @@
 (defparameter *circulate-orig* nil)
 (defparameter *circulate-parent* nil)
 
-(defparameter *circulate-leave-key* nil)
-
 (defun draw-circulate-mode-window ()
   (raise-window *circulate-window*)
   (clear-pixmap-buffer *circulate-window* *circulate-gc*)
@@ -153,23 +151,6 @@
   (define-circulate-release-key ("Alt_L" :alt) 'leave-circulate-mode))
 
 
-(defun set-circulate-leave-key ()
-  (maphash #'(lambda (key value)
-	       (when (and (listp value) (member 'leave-circulate-mode value))
-		 (setf *circulate-leave-key* (typecase (first key)
-					       (character (list (char->keycode (first key))))
-					       (number (list (first key)))
-					       (string (multiple-value-list
-							(xlib:keysym->keycodes *display* (keysym-name->keysym (first key)))))))))
-	   *circulate-keys-release*))
-
-
-
-
-
-
-
-
 (defun circulate-leave-function ()
   (when *circulate-window*
     (xlib:destroy-window *circulate-window*))
@@ -180,15 +161,8 @@
 	*circulate-font* nil))
 
 (defun circulate-loop-function ()
-  ;;; Check if the key modifier is alway pressed
-  (let ((leave t))
-    (loop for k across (xlib:query-keymap *display*)
-       for i from 0
-       do (when (and (plusp k) (member i *circulate-leave-key*))
-	    (setf leave nil)
-	    (return)))
-    (when leave
-      (leave-circulate-mode))))
+  (unless (is-a-key-pressed-p)
+    (leave-circulate-mode)))
 
 (define-handler circulate-mode :key-press (code state)
   (unless (funcall-key-from-code *circulate-keys* code state)
@@ -205,7 +179,6 @@
 
 (defun circulate-mode (&key child-direction brother-direction)
   (setf *circulate-hit* 0)
-  (set-circulate-leave-key)
   (with-placement (*circulate-mode-placement* x y *circulate-width* *circulate-height*)
     (setf *circulate-font* (xlib:open-font *display* *circulate-font-string*)
 	  *circulate-window* (xlib:create-window :parent *root*

Modified: clfswm/src/xlib-util.lisp
==============================================================================
--- clfswm/src/xlib-util.lisp	(original)
+++ clfswm/src/xlib-util.lisp	Thu Aug 26 17:29:45 2010
@@ -732,7 +732,7 @@
 		    "Alt_L" "Alt_R" "Meta_L" "Meta_R" "Hyper_L" "Hyper_R"
 		    "Mode_switch" "script_switch" "ISO_Level3_Shift"
 		    "Caps_Lock" "Scroll_Lock" "Num_Lock"))
-      (awhen (xlib:keysym->keycodes *display* (keysym-name->keysym name))
+      (awhen (xlib:keysym->keycodes *display* (keysym-name->keysym name))  ;; PHIL: todo here
 	(push it modifier-list))))
 
   (defun modifier-p (code)
@@ -801,3 +801,10 @@
   (xlib:copy-area *pixmap-buffer* gc
 		  0 0 (xlib:drawable-width window) (xlib:drawable-height window)
 		  window 0 0))
+
+
+(defun is-a-key-pressed-p ()
+  (loop for k across (xlib:query-keymap *display*)
+     when (plusp k)
+     return t))
+




More information about the clfswm-cvs mailing list