emacs-devel
[Top][All Lists]
Advanced

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

Re: mouse-drag-mode-line should maybe use window-tree


From: Lennart Borgman
Subject: Re: mouse-drag-mode-line should maybe use window-tree
Date: Tue, 29 Nov 2005 00:57:32 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Richard M. Stallman wrote:

Sorry, forgot to write that it is the code in `mouse-drag-window-above' that looks suspicious to me. It seems like it only compares the top of the parameter window with the bottom of other windows.

Yes, it is finding a window whose bottom is at the same height
as the top of this one.

Are you saying it might find the wrong window?  It could find a window
that ends at the same vertical position as the right window, but is
located to the side of it?

I am not sure if that bug can occur.  Can you add code to
verify that the window found overlaps in the horizontal dimension
with the given window?
I have attached a patched where I believe I have done that.
Index: lisp/mouse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.287
diff -c -r1.287 mouse.el
*** lisp/mouse.el       27 Nov 2005 19:28:58 -0000      1.287
--- lisp/mouse.el       28 Nov 2005 23:51:44 -0000
***************
*** 355,368 ****
  (defun mouse-drag-window-above (window)
    "Return the (or a) window directly above WINDOW.
  That means one whose bottom edge is at the same height as WINDOW's top edge."
!   (let ((top (nth 1 (window-edges window)))
        (start-window window)
        above-window)
      (setq window (previous-window window 0))
      (while (and (not above-window) (not (eq window start-window)))
!       (if (= (+ (window-height window) (nth 1 (window-edges window)))
!            top)
!         (setq above-window window))
        (setq window (previous-window window)))
      above-window))
  
--- 355,375 ----
  (defun mouse-drag-window-above (window)
    "Return the (or a) window directly above WINDOW.
  That means one whose bottom edge is at the same height as WINDOW's top edge."
!   (let ((start-top (nth 1 (window-edges window)))
!         (start-left (nth 0 window))
!         (start-right (nth 2 window))
        (start-window window)
        above-window)
      (setq window (previous-window window 0))
      (while (and (not above-window) (not (eq window start-window)))
!       (let ((left  (nth 0 (window-edges window)))
!             (right (nth 2 (window-edges window))))
!         (when (and (= (+ (window-height window) (nth 1 (window-edges window)))
!                       start-top)
!                    (or (and (< left start-left)  (< start-right right))
!                        (and (< start-left left)  (< left start-right))
!                        (and (< start-left right) (< right start-right))))
!           (setq above-window window)))
        (setq window (previous-window window)))
      above-window))
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]