[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 04716ca: Add tab-bar-drag-maybe for indication of tab dragging
From: |
Juri Linkov |
Subject: |
emacs-28 04716ca: Add tab-bar-drag-maybe for indication of tab dragging (bug#50993) |
Date: |
Sun, 17 Oct 2021 13:49:03 -0400 (EDT) |
branch: emacs-28
commit 04716ca48fbaf4750a56e3c8d6f0ad125f889105
Author: Martin Rudalics <rudalics@gmx.at>
Commit: Juri Linkov <juri@linkov.net>
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.
---
lisp/tab-bar.el | 5 +++++
src/xdisp.c | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9fb363d..76a217c 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -239,11 +239,14 @@ and `t' for other values."
(string-to-number (string-replace "tab-" "" key-name)))))
(t t)))
+(defvar tab-bar-drag-maybe)
+
(defun tab-bar--event-to-item (posn)
"This function extracts extra info from the mouse event POSN.
It returns a list that contains three elements: a key,
a key binding, and a boolean value whether the close button \"+\"
was clicked."
+ (setq tab-bar-drag-maybe nil)
(if (posn-window posn)
(let ((caption (car (posn-string posn))))
(when caption
@@ -275,6 +278,7 @@ existing tab."
(interactive "e")
(let* ((item (tab-bar--event-to-item (event-start event)))
(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 add new tab on down-mouse. Let `tab-bar-mouse-1' do this.
(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
at the mouse-down event to the position at mouse-up event."
(interactive "e")
+ (setq tab-bar-drag-maybe nil)
(let ((from (tab-bar--key-to-number
(nth 0 (tab-bar--event-to-item
(event-start event)))))
diff --git a/src/xdisp.c b/src/xdisp.c
index 40d578a..dc92725 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -33644,7 +33644,13 @@ note_mouse_highlight (struct frame *f, int x, int y)
if (EQ (window, f->tab_bar_window))
{
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
@@ -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_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,
doc: /* Non-nil to skip redisplay in initial frame.
The initial frame is not displayed anywhere, so skipping it is
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-28 04716ca: Add tab-bar-drag-maybe for indication of tab dragging (bug#50993),
Juri Linkov <=