summaryrefslogtreecommitdiff
path: root/lisp/tab-bar.el
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2021-10-17 20:48:45 +0300
committerJuri Linkov <juri@linkov.net>2021-10-17 20:48:45 +0300
commit04716ca48fbaf4750a56e3c8d6f0ad125f889105 (patch)
tree80cec6c74f3468c24221df5d170d9bf662d9e963 /lisp/tab-bar.el
parent81e3697600e5c792cf2ee99bd0d2818807e62108 (diff)
downloademacs-04716ca48fbaf4750a56e3c8d6f0ad125f889105.tar.gz
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.
Diffstat (limited to 'lisp/tab-bar.el')
-rw-r--r--lisp/tab-bar.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9fb363d90bc..76a217c9368 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)))))