aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2025-02-10 10:58:05 +0100
committerMartin Rudalics2025-02-10 10:58:05 +0100
commitefa9b97b454d2bf56d50fb4ef37e8378bb2e4b2a (patch)
treef3376b9805a3eb2d8445c64b675311c29b23279c
parent4d1ceac9f9332f74ac2ab300eb2a629ea742b1dc (diff)
downloademacs-efa9b97b454d2bf56d50fb4ef37e8378bb2e4b2a.tar.gz
emacs-efa9b97b454d2bf56d50fb4ef37e8378bb2e4b2a.zip
Implement tab line dragging with mouse (Bug#76084)
* lisp/mouse.el (mouse-drag-line): Allow tab line dragging if there's a window above. Consider tab line height when calculating 'position'. Add 'tab-line' binding to transient map. (mouse-drag-tab-line): Have it drag the tab line only (and not the entire frame) when the tab line is between two windows.
-rw-r--r--lisp/mouse.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 3a8388870be..1f0ca6a51b6 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -844,7 +844,7 @@ must be one of the symbols `header', `mode', or `vertical'."
844 ;; Decide on whether we are allowed to track at all and whose 844 ;; Decide on whether we are allowed to track at all and whose
845 ;; window's edge we drag. 845 ;; window's edge we drag.
846 (cond 846 (cond
847 ((eq line 'header) 847 ((memq line '(header tab))
848 ;; Drag bottom edge of window above the header line. 848 ;; Drag bottom edge of window above the header line.
849 (setq window (window-in-direction 'above window t))) 849 (setq window (window-in-direction 'above window t)))
850 ((eq line 'mode)) 850 ((eq line 'mode))
@@ -903,10 +903,13 @@ must be one of the symbols `header', `mode', or `vertical'."
903 (when (window-live-p posn-window) 903 (when (window-live-p posn-window)
904 ;; Add top edge of `posn-window' to `position'. 904 ;; Add top edge of `posn-window' to `position'.
905 (setq position (+ (window-pixel-top posn-window) position)) 905 (setq position (+ (window-pixel-top posn-window) position))
906 ;; If necessary, add height of header line to `position' 906 ;; If necessary, add height of header and tab line to
907 ;; `position'.
907 (when (memq (posn-area start) 908 (when (memq (posn-area start)
908 '(nil left-fringe right-fringe left-margin right-margin)) 909 '(nil left-fringe right-fringe left-margin right-margin))
909 (setq position (+ (window-header-line-height posn-window) position)))) 910 (setq position (+ (window-header-line-height posn-window)
911 (window-tab-line-height posn-window)
912 position))))
910 ;; When the cursor overshoots after shrinking a window to its 913 ;; When the cursor overshoots after shrinking a window to its
911 ;; minimum size and the dragging direction changes, have the 914 ;; minimum size and the dragging direction changes, have the
912 ;; cursor first catch up with the window edge. 915 ;; cursor first catch up with the window edge.
@@ -947,6 +950,7 @@ must be one of the symbols `header', `mode', or `vertical'."
947 ;; with a mode-line, header-line or vertical-line prefix ... 950 ;; with a mode-line, header-line or vertical-line prefix ...
948 (define-key map [mode-line] map) 951 (define-key map [mode-line] map)
949 (define-key map [header-line] map) 952 (define-key map [header-line] map)
953 (define-key map [tab-line] map)
950 (define-key map [vertical-line] map) 954 (define-key map [vertical-line] map)
951 ;; ... and some maybe even with a right- or bottom-divider 955 ;; ... and some maybe even with a right- or bottom-divider
952 ;; or left- or right-margin prefix ... 956 ;; or left- or right-margin prefix ...
@@ -1035,8 +1039,9 @@ START-EVENT is the starting mouse event of the drag action."
1035 (interactive "e") 1039 (interactive "e")
1036 (let* ((start (event-start start-event)) 1040 (let* ((start (event-start start-event))
1037 (window (posn-window start))) 1041 (window (posn-window start)))
1038 (when (and (window-live-p window) 1042 (if (and (window-live-p window)
1039 (window-at-side-p window 'top)) 1043 (not (window-at-side-p window 'top)))
1044 (mouse-drag-line start-event 'tab)
1040 (let ((frame (window-frame window))) 1045 (let ((frame (window-frame window)))
1041 (when (frame-parameter frame 'drag-with-tab-line) 1046 (when (frame-parameter frame 'drag-with-tab-line)
1042 (mouse-drag-frame-move start-event)))))) 1047 (mouse-drag-frame-move start-event))))))