fixed grabbing if no window is focused.
This commit is contained in:
parent
cd58a58e42
commit
6eeef48f98
|
@ -89,22 +89,23 @@
|
||||||
(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
|
(map (lambda (win)
|
||||||
(lambda (x) x)
|
(filter
|
||||||
(map (lambda (win)
|
(lambda (grab)
|
||||||
(filter
|
(let ((first (car (key-grab:keys grab))))
|
||||||
(lambda (grab)
|
(and (equal? win (key-grab:window grab))
|
||||||
(let ((first (car (key-grab:keys grab))))
|
(enum-set=? (key:modifiers first)
|
||||||
(and (equal? win (key-grab:window grab))
|
(key-event-state event))
|
||||||
(enum-set=? (key:modifiers first)
|
(equal? (key:keycode first)
|
||||||
(key-event-state event))
|
(key-event-keycode event)))))
|
||||||
(equal? (key:keycode first)
|
grabs))
|
||||||
(key-event-keycode event)))))
|
path)))
|
||||||
grabs))
|
;; make an alist mapping a grab to the keys that are not entered
|
||||||
path))))
|
|
||||||
(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)))
|
||||||
|
|
Loading…
Reference in New Issue