1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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'.
This commit is contained in:
Martin Rudalics 2021-07-02 10:55:42 +02:00
parent aaa32f3942
commit f449890508
3 changed files with 26 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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)