[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Finding the window under a point: nice solution
- To: info-macl@cambridge.apple.COM
- Subject: Finding the window under a point: nice solution
- From: cornell@unix1.cs.umass.edu (Matthew Cornell)
- Date: Mon, 13 May 91 13:19:00 EDT
Thanks to Amy and Kevin who both forward me code from Bill. I was
mistaken about view-contains-point-p not working for windows; I was
passing it local, not global points. The simple solution is this:
(defun topmost-window-containing-global-point
(global-point &optional (class 'window))
"Returns the topmost window of type CLASS that contains GLOBAL-POINT in
its content region."
;;
(map-windows
#'(lambda (w)
(when (view-contains-point-p w global-point)
(return-from topmost-window-containing-global-point w)))
:class class))