mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-16 02:50:26 -08:00
Add tab-bar-drag-maybe for indication of tab dragging (bug#50993)
* lisp/tab-bar.el (tab-bar--event-to-item) (tab-bar-mouse-move-tab): Set tab-bar-drag-maybe to nil. (tab-bar-mouse-down-1): Set tab-bar-drag-maybe to t. * src/xdisp.c (note_mouse_highlight): Set cursor to 'hand_cursor' when tab_bar_drag_maybe is true. (syms_of_xdisp): New variable tab-bar-drag-maybe.
This commit is contained in:
parent
81e3697600
commit
04716ca48f
2 changed files with 16 additions and 1 deletions
|
|
@ -239,11 +239,14 @@ and `t' for other values."
|
||||||
(string-to-number (string-replace "tab-" "" key-name)))))
|
(string-to-number (string-replace "tab-" "" key-name)))))
|
||||||
(t t)))
|
(t t)))
|
||||||
|
|
||||||
|
(defvar tab-bar-drag-maybe)
|
||||||
|
|
||||||
(defun tab-bar--event-to-item (posn)
|
(defun tab-bar--event-to-item (posn)
|
||||||
"This function extracts extra info from the mouse event POSN.
|
"This function extracts extra info from the mouse event POSN.
|
||||||
It returns a list that contains three elements: a key,
|
It returns a list that contains three elements: a key,
|
||||||
a key binding, and a boolean value whether the close button \"+\"
|
a key binding, and a boolean value whether the close button \"+\"
|
||||||
was clicked."
|
was clicked."
|
||||||
|
(setq tab-bar-drag-maybe nil)
|
||||||
(if (posn-window posn)
|
(if (posn-window posn)
|
||||||
(let ((caption (car (posn-string posn))))
|
(let ((caption (car (posn-string posn))))
|
||||||
(when caption
|
(when caption
|
||||||
|
|
@ -275,6 +278,7 @@ existing tab."
|
||||||
(interactive "e")
|
(interactive "e")
|
||||||
(let* ((item (tab-bar--event-to-item (event-start event)))
|
(let* ((item (tab-bar--event-to-item (event-start event)))
|
||||||
(tab-number (tab-bar--key-to-number (nth 0 item))))
|
(tab-number (tab-bar--key-to-number (nth 0 item))))
|
||||||
|
(setq tab-bar-drag-maybe t)
|
||||||
;; Don't close the tab when clicked on the close button. Also
|
;; Don't close the tab when clicked on the close button. Also
|
||||||
;; don't add new tab on down-mouse. Let `tab-bar-mouse-1' do this.
|
;; don't add new tab on down-mouse. Let `tab-bar-mouse-1' do this.
|
||||||
(unless (or (eq (car item) 'add-tab) (nth 2 item))
|
(unless (or (eq (car item) 'add-tab) (nth 2 item))
|
||||||
|
|
@ -351,6 +355,7 @@ only when you click on its \"x\" close button."
|
||||||
This command should be bound to a drag event. It moves the tab
|
This command should be bound to a drag event. It moves the tab
|
||||||
at the mouse-down event to the position at mouse-up event."
|
at the mouse-down event to the position at mouse-up event."
|
||||||
(interactive "e")
|
(interactive "e")
|
||||||
|
(setq tab-bar-drag-maybe nil)
|
||||||
(let ((from (tab-bar--key-to-number
|
(let ((from (tab-bar--key-to-number
|
||||||
(nth 0 (tab-bar--event-to-item
|
(nth 0 (tab-bar--event-to-item
|
||||||
(event-start event)))))
|
(event-start event)))))
|
||||||
|
|
|
||||||
12
src/xdisp.c
12
src/xdisp.c
|
|
@ -33644,7 +33644,13 @@ note_mouse_highlight (struct frame *f, int x, int y)
|
||||||
if (EQ (window, f->tab_bar_window))
|
if (EQ (window, f->tab_bar_window))
|
||||||
{
|
{
|
||||||
note_tab_bar_highlight (f, x, y);
|
note_tab_bar_highlight (f, x, y);
|
||||||
return;
|
if (tab_bar_drag_maybe)
|
||||||
|
{
|
||||||
|
cursor = FRAME_OUTPUT_DATA (f)->hand_cursor;
|
||||||
|
goto set_cursor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -35774,6 +35780,10 @@ When nil, mouse-movement events will not be generated as long as the
|
||||||
mouse stays within the extent of a single glyph (except for images). */);
|
mouse stays within the extent of a single glyph (except for images). */);
|
||||||
mouse_fine_grained_tracking = false;
|
mouse_fine_grained_tracking = false;
|
||||||
|
|
||||||
|
DEFVAR_BOOL ("tab-bar-drag-maybe", tab_bar_drag_maybe,
|
||||||
|
doc: /* Non-nil when maybe dragging tab bar item. */);
|
||||||
|
tab_bar_drag_maybe = false;
|
||||||
|
|
||||||
DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame,
|
DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame,
|
||||||
doc: /* Non-nil to skip redisplay in initial frame.
|
doc: /* Non-nil to skip redisplay in initial frame.
|
||||||
The initial frame is not displayed anywhere, so skipping it is
|
The initial frame is not displayed anywhere, so skipping it is
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue