[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding the window under a point



   Date: Mon, 13 May 91 11:31:00 CDT
   From: lynch@aristotle.ils.nwu.edu (Richard Lynch)
   To: info-macl@cambridge.apple.com
   Subject: Re: Finding the window under a point
   
   [...]
   
   A wild suggestion with (possibly) no basis in reality is to try calling
   find-view-containing-point and pass in nil as the view.  Various view
   functions accept nil as a substitute value for the WindowManager, and this
   might be a "super view" to all windows.
   
I like that idea.  MCL 2.0 final will do it:


(defmethod find-view-containing-point ((view null) h &optional v
                                       (direct-subviews-only nil))
  (let ((point (make-point h v)))
    (flet ((check-window (w)
             (when (view-contains-point-p w point)
               (return-from find-view-containing-point
                 (if direct-subviews-only
                   w
                   (find-view-containing-point 
                    w
                    (subtract-points point (view-position w))))))))
      (declare (dynamic-extent #'check-window))
      (map-windows #'check-window :include-windoids t)
      nil)))