aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2024-05-02 20:55:03 +0300
committerJuri Linkov2024-05-02 20:55:03 +0300
commit14cd4fce4b723a7f06cd7d8dba60c730670191d0 (patch)
tree504e89d60bfddecc21277de620e4ff3244ff8a1f
parenta914667a0071e3a19846fff9ea5ff8e8f1457e17 (diff)
downloademacs-14cd4fce4b723a7f06cd7d8dba60c730670191d0.tar.gz
emacs-14cd4fce4b723a7f06cd7d8dba60c730670191d0.zip
* lisp/tab-bar.el: Support mouse clicks bound in keymap properties.
(tab-bar--event-to-item): Handle mouse bindings for commands bound in keymap properties of global-mode-string (bug#70086). (tab-bar-mouse-down-1, tab-bar-mouse-1, tab-bar-touchscreen-begin): Add the symbol 'global' to the list of handled items.
-rw-r--r--lisp/tab-bar.el18
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 2a4f8fd6916..2e3d9a6b4ac 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -298,9 +298,13 @@ It returns a list of the form (KEY KEY-BINDING CLOSE-P), where:
298 nil otherwise." 298 nil otherwise."
299 (setq tab-bar--dragging-in-progress nil) 299 (setq tab-bar--dragging-in-progress nil)
300 (if (posn-window posn) 300 (if (posn-window posn)
301 (let ((caption (car (posn-string posn)))) 301 (let* ((caption (car (posn-string posn)))
302 (when caption 302 (menu-item (when caption
303 (get-text-property 0 'menu-item caption))) 303 (get-text-property 0 'menu-item caption))))
304 (when (equal menu-item '(global ignore nil))
305 (setf (nth 1 menu-item)
306 (key-binding (vector 'tab-bar last-nonmenu-event) t)))
307 menu-item)
304 ;; Text-mode emulation of switching tabs on the tab bar. 308 ;; Text-mode emulation of switching tabs on the tab bar.
305 ;; This code is used when you click the mouse in the tab bar 309 ;; This code is used when you click the mouse in the tab bar
306 ;; on a console which has no window system but does have a mouse. 310 ;; on a console which has no window system but does have a mouse.
@@ -332,7 +336,7 @@ existing tab."
332 (setq tab-bar--dragging-in-progress t) 336 (setq tab-bar--dragging-in-progress t)
333 ;; Don't close the tab when clicked on the close button. Also 337 ;; Don't close the tab when clicked on the close button. Also
334 ;; don't add new tab on down-mouse. Let `tab-bar-mouse-1' do this. 338 ;; don't add new tab on down-mouse. Let `tab-bar-mouse-1' do this.
335 (unless (or (memq (car item) '(add-tab history-back history-forward)) 339 (unless (or (memq (car item) '(add-tab history-back history-forward global))
336 (nth 2 item)) 340 (nth 2 item))
337 (if (functionp (nth 1 item)) 341 (if (functionp (nth 1 item))
338 (call-interactively (nth 1 item)) 342 (call-interactively (nth 1 item))
@@ -347,7 +351,7 @@ regardless of where you click on it. Also add a new tab."
347 (let* ((item (tab-bar--event-to-item (event-start event))) 351 (let* ((item (tab-bar--event-to-item (event-start event)))
348 (tab-number (tab-bar--key-to-number (nth 0 item)))) 352 (tab-number (tab-bar--key-to-number (nth 0 item))))
349 (cond 353 (cond
350 ((and (memq (car item) '(add-tab history-back history-forward)) 354 ((and (memq (car item) '(add-tab history-back history-forward global))
351 (functionp (nth 1 item))) 355 (functionp (nth 1 item)))
352 (call-interactively (nth 1 item))) 356 (call-interactively (nth 1 item)))
353 ((and (nth 2 item) (not (eq tab-number t))) 357 ((and (nth 2 item) (not (eq tab-number t)))
@@ -468,8 +472,8 @@ appropriate."
468 (tab-bar-select-tab number)))) 472 (tab-bar-select-tab number))))
469 ;; Cancel the timer. 473 ;; Cancel the timer.
470 (cancel-timer timer))) 474 (cancel-timer timer)))
471 ((and (memq (car item) '(add-tab history-back 475 ((and (memq (car item) '( add-tab history-back
472 history-forward)) 476 history-forward global))
473 (functionp (cadr item))) 477 (functionp (cadr item)))
474 ;; This is some kind of button. Wait for the 478 ;; This is some kind of button. Wait for the
475 ;; tap to complete and press it. 479 ;; tap to complete and press it.