From 9ffc039d2da51ea99b12153d0a6ed90a2f438e76 Mon Sep 17 00:00:00 2001 From: frese Date: Tue, 22 Apr 2003 21:45:29 +0000 Subject: [PATCH] changed the find-manager-at algorithm --- src/root-manager.scm | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/root-manager.scm b/src/root-manager.scm index 579a6a0..49d28b1 100644 --- a/src/root-manager.scm +++ b/src/root-manager.scm @@ -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)