]> code.delx.au - gnu-emacs/commitdiff
Fix mouse-dragging mode lines on text-mode terminals.
authorEli Zaretskii <eliz@gnu.org>
Tue, 9 Sep 2014 15:00:51 +0000 (18:00 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 9 Sep 2014 15:00:51 +0000 (18:00 +0300)
 lisp/mouse.el (mouse-drag-line): On text-mode frames, count the mode
 line and header line as 1 pixel.  This fixes the 1-"pixel" (row)
 discrepancy between window-pixel-edges and mouse events, and
 avoids moving mode line up when the mouse click is on the modeline
 and no drag is attempted.

lisp/ChangeLog
lisp/mouse.el

index 2bd234e12e0dbee8ab503ad613817241c302889a..9f31741a1c53c8759f2b60e757689173097d4cae 100644 (file)
@@ -1,3 +1,11 @@
+2014-09-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * mouse.el (mouse-drag-line): On text-mode frames, count the mode
+       line and header line as 1 pixel.  This fixes the 1-"pixel" (row)
+       discrepancy between window-pixel-edges and mouse events, and
+       avoids moving mode line up when the mouse click is on the modeline
+       and no drag is attempted.
+
 2014-09-08  Glenn Morris  <rgm@gnu.org>
 
        * calendar/calendar.el (calendar-basic-setup):
index 99407d9f9cfe04e889a3a18dc7a4266a45f293f9..d84c6c119ede03caa34c0a258041d5ab014e3e17 100644 (file)
@@ -395,7 +395,16 @@ must be one of the symbols `header', `mode', or `vertical'."
       ;; Check whether header-line can be dragged at all.
       (if (window-at-side-p window 'top)
          (setq draggable nil)
-       (setq height (/ (window-header-line-height window) 2))
+       ;; window-pixel-edges includes the header and mode lines, so
+       ;; we need to account for that when calculating window growth.
+       ;; On GUI frames, assume the mouse is approximately in the
+       ;; middle of the header/mode line, so we need only half the
+       ;; height in pixels.
+       (setq height
+             (cond
+              ((display-graphic-p frame)
+               (/ (window-header-line-height window) 2))
+              (t  (window-header-line-height window))))
        (setq window (window-in-direction 'above window t))))
      ((eq line 'mode)
       ;; Check whether mode-line can be dragged at all.
@@ -410,7 +419,11 @@ must be one of the symbols `header', `mode', or `vertical'."
                             (eq minibuffer-window
                                 (active-minibuffer-window))))))
          (setq draggable nil)
-       (setq height (/ (window-mode-line-height window) 2))))
+       (setq height
+             (cond
+              ((display-graphic-p frame)
+               (/ (window-mode-line-height window) 2))
+              (t  (window-mode-line-height window))))))
      ((eq line 'vertical)
       ;; Get the window to adjust for the vertical case.  If the scroll
       ;; bar is on the window's right or we drag a vertical divider,