emacs-diffs
[Top][All Lists]
Advanced

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

master f4498905: New frame parameter 'drag-with-tab-line' (Bug#49247)


From: Martin Rudalics
Subject: master f4498905: New frame parameter 'drag-with-tab-line' (Bug#49247)
Date: Fri, 2 Jul 2021 04:56:25 -0400 (EDT)

branch: master
commit f449890508e8d52cc2029a34e55bfdb63c431c4b
Author: Martin Rudalics <rudalics@gmx.at>
Commit: Martin Rudalics <rudalics@gmx.at>

    New frame parameter 'drag-with-tab-line' (Bug#49247)
    
    The new frame parameter 'drag-with-tab-line' allows to move
    frames by dragging their topmost windows' tab line with the
    mouse thus achieving a behavior similar to that provided by
    the 'drag-with-header-line' parameter.
    
    * lisp/mouse.el (mouse-drag-tab-line): New function.
    (mouse-drag-frame-resize, mouse-drag-frame-move)
    ([tab-line down-mouse-1]): Handle tab line dragging in various
    keymaps.
    * doc/lispref/frames.texi (Mouse Dragging Parameters): Describe
    new parameter 'drag-with-tab-line'.
    * etc/NEWS: Add entry for 'drag-with-tab-line'.
---
 doc/lispref/frames.texi |  9 +++++++--
 etc/NEWS                |  4 ++++
 lisp/mouse.el           | 15 +++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index a9d20c5..25706be 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -2023,8 +2023,8 @@ the @sc{cdr} of the cell is either @code{t} or 
@code{top-only}.
 
 The parameters described below provide support for resizing a frame by
 dragging its internal borders with the mouse.  They also allow moving a
-frame with the mouse by dragging the header line of its topmost or the
-mode line of its bottommost window.
+frame with the mouse by dragging the header or tab line of its topmost
+or the mode line of its bottommost window.
 
 These parameters are mostly useful for child frames (@pxref{Child
 Frames}) that come without window manager decorations.  If necessary,
@@ -2041,6 +2041,11 @@ borders, if present, with the mouse.
 If non-@code{nil}, the frame can be moved with the mouse by dragging the
 header line of its topmost window.
 
+@vindex drag-with-tab-line@r{, a frame parameter}
+@item drag-with-tab-line
+If non-@code{nil}, the frame can be moved with the mouse by dragging the
+tab line of its topmost window.
+
 @vindex drag-with-mode-line@r{, a frame parameter}
 @item drag-with-mode-line
 If non-@code{nil}, the frame can be moved with the mouse by dragging the
diff --git a/etc/NEWS b/etc/NEWS
index 605c4d2..5b04278 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -319,6 +319,10 @@ Meta characters to Emacs, e.g., send "ESC x" when the user 
types
 emulators by using the new input-meta-mode with the special value
 'encoded' with these terminal emulators.
 
++++
+** New frame parameter 'drag-with-tab-line'.
+This parameter, similar to 'drag-with-header-line', allows moving frames
+by dragging the tab lines of their topmost windows with the mouse.
 
 * Editing Changes in Emacs 28.1
 
diff --git a/lisp/mouse.el b/lisp/mouse.el
index d0064ee..ab260d4 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -550,6 +550,18 @@ the frame instead."
         (when (frame-parameter frame 'drag-with-header-line)
           (mouse-drag-frame-move start-event))))))
 
+(defun mouse-drag-tab-line (start-event)
+  "Drag frame with tab line in its topmost window.
+START-EVENT is the starting mouse event of the drag action."
+  (interactive "e")
+  (let* ((start (event-start start-event))
+        (window (posn-window start)))
+    (when (and (window-live-p window)
+               (window-at-side-p window 'top))
+      (let ((frame (window-frame window)))
+        (when (frame-parameter frame 'drag-with-tab-line)
+          (mouse-drag-frame-move start-event))))))
+
 (defun mouse-drag-vertical-line (start-event)
   "Change the width of a window by dragging on a vertical line.
 START-EVENT is the starting mouse event of the drag action."
@@ -678,6 +690,7 @@ frame with the mouse."
              ;; with a mode-line, header-line or vertical-line prefix ...
              (define-key map [mode-line] map)
              (define-key map [header-line] map)
+             (define-key map [tab-line] map)
              (define-key map [vertical-line] map)
              ;; ... and some maybe even with a right- or bottom-divider
              ;; prefix.
@@ -904,6 +917,7 @@ frame with the mouse."
              ;; with a mode-line, header-line or vertical-line prefix ...
              (define-key map [mode-line] map)
              (define-key map [header-line] map)
+             (define-key map [tab-line] map)
              (define-key map [vertical-line] map)
              ;; ... and some maybe even with a right- or bottom-divider
              ;; prefix.
@@ -2908,6 +2922,7 @@ is copied instead of being cut."
 ;; versions.
 (global-set-key [header-line down-mouse-1] 'mouse-drag-header-line)
 (global-set-key [header-line mouse-1] 'mouse-select-window)
+(global-set-key [tab-line down-mouse-1] 'mouse-drag-tab-line)
 (global-set-key [tab-line mouse-1] 'mouse-select-window)
 ;; (global-set-key [mode-line drag-mouse-1] 'mouse-select-window)
 (global-set-key [mode-line down-mouse-1] 'mouse-drag-mode-line)



reply via email to

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