diff options
| author | Eli Zaretskii | 2014-09-09 18:00:51 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-09-09 18:00:51 +0300 |
| commit | da604136b92764f159442496a9b18cb48204787e (patch) | |
| tree | 2e7756156e7d31c78784b8a2f0a4a05f0f11fcfb | |
| parent | feb7e20179471458b702ada2521272e913598314 (diff) | |
| download | emacs-da604136b92764f159442496a9b18cb48204787e.tar.gz emacs-da604136b92764f159442496a9b18cb48204787e.zip | |
Fix mouse-dragging mode lines on text-mode terminals.
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.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/mouse.el | 17 |
2 files changed, 23 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2bd234e12e0..9f31741a1c5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-09-09 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * mouse.el (mouse-drag-line): On text-mode frames, count the mode | ||
| 4 | line and header line as 1 pixel. This fixes the 1-"pixel" (row) | ||
| 5 | discrepancy between window-pixel-edges and mouse events, and | ||
| 6 | avoids moving mode line up when the mouse click is on the modeline | ||
| 7 | and no drag is attempted. | ||
| 8 | |||
| 1 | 2014-09-08 Glenn Morris <rgm@gnu.org> | 9 | 2014-09-08 Glenn Morris <rgm@gnu.org> |
| 2 | 10 | ||
| 3 | * calendar/calendar.el (calendar-basic-setup): | 11 | * calendar/calendar.el (calendar-basic-setup): |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 99407d9f9cf..d84c6c119ed 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -395,7 +395,16 @@ must be one of the symbols `header', `mode', or `vertical'." | |||
| 395 | ;; Check whether header-line can be dragged at all. | 395 | ;; Check whether header-line can be dragged at all. |
| 396 | (if (window-at-side-p window 'top) | 396 | (if (window-at-side-p window 'top) |
| 397 | (setq draggable nil) | 397 | (setq draggable nil) |
| 398 | (setq height (/ (window-header-line-height window) 2)) | 398 | ;; window-pixel-edges includes the header and mode lines, so |
| 399 | ;; we need to account for that when calculating window growth. | ||
| 400 | ;; On GUI frames, assume the mouse is approximately in the | ||
| 401 | ;; middle of the header/mode line, so we need only half the | ||
| 402 | ;; height in pixels. | ||
| 403 | (setq height | ||
| 404 | (cond | ||
| 405 | ((display-graphic-p frame) | ||
| 406 | (/ (window-header-line-height window) 2)) | ||
| 407 | (t (window-header-line-height window)))) | ||
| 399 | (setq window (window-in-direction 'above window t)))) | 408 | (setq window (window-in-direction 'above window t)))) |
| 400 | ((eq line 'mode) | 409 | ((eq line 'mode) |
| 401 | ;; Check whether mode-line can be dragged at all. | 410 | ;; Check whether mode-line can be dragged at all. |
| @@ -410,7 +419,11 @@ must be one of the symbols `header', `mode', or `vertical'." | |||
| 410 | (eq minibuffer-window | 419 | (eq minibuffer-window |
| 411 | (active-minibuffer-window)))))) | 420 | (active-minibuffer-window)))))) |
| 412 | (setq draggable nil) | 421 | (setq draggable nil) |
| 413 | (setq height (/ (window-mode-line-height window) 2)))) | 422 | (setq height |
| 423 | (cond | ||
| 424 | ((display-graphic-p frame) | ||
| 425 | (/ (window-mode-line-height window) 2)) | ||
| 426 | (t (window-mode-line-height window)))))) | ||
| 414 | ((eq line 'vertical) | 427 | ((eq line 'vertical) |
| 415 | ;; Get the window to adjust for the vertical case. If the scroll | 428 | ;; Get the window to adjust for the vertical case. If the scroll |
| 416 | ;; bar is on the window's right or we drag a vertical divider, | 429 | ;; bar is on the window's right or we drag a vertical divider, |