changed the find-manager-at algorithm

This commit is contained in:
frese 2003-04-22 21:45:29 +00:00
parent cce8c3e349
commit 9ffc039d2d
1 changed files with 16 additions and 16 deletions

View File

@ -399,22 +399,22 @@
(define (find-manager-at root-wm x y)
;; returns the upper-most manager at root-window's coords x y
(let* ((dpy (root-wm:dpy root-wm))
(candidates
(filter (lambda (wm)
(point-in-rectangle? (root-rectangle dpy (wm:window wm))
x y))
(root-wm-managers root-wm))))
(letrec ((loop (lambda (wm level rest)
(if (null? rest)
wm
(let* ((next (car rest))
(next-level (window-level dpy
(wm:window next))))
(if (> next-level level)
(loop next next-level (cdr rest))
(loop wm level (cdr rest))))))))
(loop #f -1 candidates))))
(letrec ((dpy (root-wm:dpy root-wm))
(root-window (default-root-window dpy))
(child-at (lambda (window x y)
(let ((res (translate-coordinates dpy root-window window
x y)))
(and res (not (zero? (third res))) (third res)))))
(window-at (lambda (window x y)
(let ((child (child-at window x y)))
(if child
(window-at child x y)
window))))
(manager-of-window (lambda (window)
(or (get-manager-by-window root-wm window)
(let ((w (window-parent dpy window)))
(and w (manager-of-window w)))))))
(manager-of-window (window-at root-window x y))))
(define (get-manager-by-window root-wm window)
(let ((l (filter (lambda (wm)