[clfswm-cvs] r196 - in clfswm: . src
Philippe Brochard
pbrochard at common-lisp.net
Thu Oct 30 21:26:46 UTC 2008
Author: pbrochard
Date: Thu Oct 30 21:26:45 2008
New Revision: 196
Log:
wait-no-key-or-button-press, wait-a-key-or-button-press: Check buttons press/release correctly
Modified:
clfswm/ChangeLog
clfswm/src/xlib-util.lisp
Modified: clfswm/ChangeLog
==============================================================================
--- clfswm/ChangeLog (original)
+++ clfswm/ChangeLog Thu Oct 30 21:26:45 2008
@@ -1,3 +1,8 @@
+2008-10-30 Philippe Brochard <pbrochard at common-lisp.net>
+
+ * src/xlib-util.lisp (wait-no-key-or-button-press)
+ (wait-a-key-or-button-press): Check buttons press/release correctly"
+
2008-10-28 Philippe Brochard <pbrochard at common-lisp.net>
* src/menu-def.lisp: Add children navigation menu in the movement
Modified: clfswm/src/xlib-util.lisp
==============================================================================
--- clfswm/src/xlib-util.lisp (original)
+++ clfswm/src/xlib-util.lisp Thu Oct 30 21:26:45 2008
@@ -405,17 +405,6 @@
:sync-pointer-p t
:sync-keyboard-p nil))
-;;(dbg "todo: confirm this")
-;;(defun grab-all-buttons (window)
-;; (ungrab-all-buttons window)
-;; (dotimes (i 5)
-;; (xlib:grab-button window i '(:button-press :button-release :pointer-motion)
-;; :modifiers :any
-;; :owner-p nil
-;; :sync-pointer-p t
-;; :sync-keyboard-p nil)))
-
-
(defun ungrab-all-keys (window)
(xlib:ungrab-key window :any :modifiers :any))
@@ -688,8 +677,9 @@
(let ((key (loop for k across (xlib:query-keymap *display*)
for code from 0
when (and (plusp k) (not (modifier-p code))) return t))
- (button (member (nth-value 4 (xlib:query-pointer *root*))
- '(:button-1 :button-2 :button-3 :button-4 :button-5))))
+ (button (loop for b in (xlib:make-state-keys (nth-value 4 (xlib:query-pointer *root*)))
+ when (member b '(:button-1 :button-2 :button-3 :button-4 :button-5))
+ return t)))
(when (and (not key) (not button))
(loop while (xlib:event-case (*display* :discard-p t :peek-p nil :timeout 0)
(:motion-notify () t)
@@ -704,11 +694,13 @@
(defun wait-a-key-or-button-press ()
(with-grab-keyboard-and-pointer (24 25 66 67)
(loop
- (let ((key (loop for k across (xlib:query-keymap *display*)
- unless (zerop k) return t))
- (button (plusp (nth-value 4 (xlib:query-pointer *root*)))))
- (when (or key button)
- (return))))))
+ (let ((key (loop for k across (xlib:query-keymap *display*)
+ unless (zerop k) return t))
+ (button (loop for b in (xlib:make-state-keys (nth-value 4 (xlib:query-pointer *root*)))
+ when (member b '(:button-1 :button-2 :button-3 :button-4 :button-5))
+ return t)))
+ (when (or key button)
+ (return))))))
More information about the clfswm-cvs
mailing list