fixed grabbing if no window is focused.

This commit is contained in:
frese 2003-04-01 13:08:19 +00:00
parent cd58a58e42
commit 6eeef48f98
1 changed files with 15 additions and 16 deletions

View File

@ -89,11 +89,11 @@
(let* ((fwin (get-input-focus-window dpy)) ;; can be pointer-root and none (let* ((fwin (get-input-focus-window dpy)) ;; can be pointer-root and none
(path (reverse (if (or (equal? fwin none) (path (reverse (if (or (equal? fwin none)
(equal? fwin pointer-root)) (equal? fwin pointer-root))
'() (list (default-root-window dpy))
(window-path dpy fwin)))) (window-path dpy fwin))))
;; find all that match the first key and are registered for a
;; window on the path
(grabs (flatten (grabs (flatten
(filter
(lambda (x) x)
(map (lambda (win) (map (lambda (win)
(filter (filter
(lambda (grab) (lambda (grab)
@ -104,7 +104,8 @@
(equal? (key:keycode first) (equal? (key:keycode first)
(key-event-keycode event))))) (key-event-keycode event)))))
grabs)) grabs))
path)))) path)))
;; make an alist mapping a grab to the keys that are not entered
(grabs-rests (map (lambda (g) (grabs-rests (map (lambda (g)
(cons g (cdr (key-grab:keys g)))) (cons g (cdr (key-grab:keys g))))
grabs)) grabs))
@ -112,7 +113,6 @@
(let ((dones (map car (filter (lambda (grab-rest) (let ((dones (map car (filter (lambda (grab-rest)
(null? (cdr grab-rest))) (null? (cdr grab-rest)))
grabs-rests)))) grabs-rests))))
(mdisplay "winner? dones: " dones "\n")
(let loop ((dones dones)) (let loop ((dones dones))
(if (null? dones) (if (null? dones)
#f #f
@ -129,7 +129,6 @@
dpy (default-root-window dpy) (event-mask key-press) dpy (default-root-window dpy) (event-mask key-press)
(lambda (event-channel) (lambda (event-channel)
(let loop ((grabs-rests grabs-rests)) (let loop ((grabs-rests grabs-rests))
(mdisplay "grabs-rests: " grabs-rests "\n")
(and (not (null? grabs-rests)) (and (not (null? grabs-rests))
(or (winner? grabs-rests) (or (winner? grabs-rests)
(let ((e (receive event-channel))) (let ((e (receive event-channel)))