unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties
@ 2024-03-30  2:25 Adam Porter
  2024-03-30 18:16 ` Juri Linkov
  0 siblings, 1 reply; 13+ messages in thread
From: Adam Porter @ 2024-03-30  2:25 UTC (permalink / raw)
  To: 70086; +Cc: Juri Linkov

Hi Juri, et al,

In my listen.el package on GNU ELPA, I'm trying to make mouse clicks in 
the `global-mode-string' construct work when `mode-line-misc-info' is 
shown in the tab-bar by including `tab-bar-format-global' in 
`tab-bar-format'.  I'm including this construct in the `global-mode-string':


   `(listen-mode (:propertize listen-mode-lighter
                              keymap ,listen-mode-lighter-map))


Using this keymap:


   (defvar listen-mode-lighter-map
     (let ((map (make-sparse-keymap)))
       (define-key map [mode-line mouse-1] #'listen-pause)
       (define-key map [tab-bar mouse-1] #'listen-pause)
       (define-key map [tab-bar mouse-2] #'listen-pause)
       (define-key map [tab-bar mouse-3] #'listen-pause)
       (define-key map [tab-bar down-mouse-1] #'listen-pause)
       (define-key map [tab-bar down-mouse-2] #'listen-pause)
       (define-key map [tab-bar down-mouse-3] #'listen-pause)
       map))


When that construct is used in `mode-line-format', it works as expected: 
clicking with mouse-1 calls the command `listen-pause'.

But when that same construct is shown in the tab-bar, mouse-1 and 
mouse-2 clicks have no effect, and mouse-3 shows the tab-bar context 
menu with options for "New tab" and "Reopen closed tab".

Surprisingly, using the sequence "C-h k mouse-1" on the construct in the 
tab-bar shows that the binding appears to be read correctly:


   There were several key-sequences:

     <tab-bar> <down-mouse-1> at that spot runs the command listen-pause
     <tab-bar> <mouse-1> at that spot runs the command listen-pause

   They're all described below.

   <tab-bar> <down-mouse-1> at that spot runs the command listen-pause
   (found in listen-mode-lighter-map), which is an interactive
   native-compiled Lisp function in ‘listen.el’.

   (listen-pause PLAYER)

   Pause/unpause PLAYER.
   Interactively, uses the default player.

   <tab-bar> <mouse-1> at that spot runs the command listen-pause (found
   in listen-mode-lighter-map), which is an interactive native-compiled
   Lisp function in ‘listen.el’.

   (listen-pause PLAYER)

   Pause/unpause PLAYER.
   Interactively, uses the default player.


But when used without "C-h k", it has no effect.

Looking at tab-bar.el, I see that it does some, I suppose, unusual 
things with keymaps and clicks to make them work.  However, if this 
could be fixed to allow these commands to work properly, it would be 
very useful, as the extra space in the tab-bar is a great place to 
display extra information without crowding the mode line.

Thanks,
Adam





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-05-06 16:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-30  2:25 bug#70086: Mouse clicks in tab-bar don't call commands bound in keymap properties Adam Porter
2024-03-30 18:16 ` Juri Linkov
2024-03-30 18:56   ` Eli Zaretskii
2024-03-31 16:15   ` Adam Porter
2024-04-05 16:29     ` Juri Linkov
2024-04-05 18:41       ` Adam Porter
2024-04-10  6:42         ` Juri Linkov
2024-05-02 17:55           ` Juri Linkov
2024-05-03  5:45             ` Adam Porter
2024-05-03  6:18               ` Juri Linkov
2024-05-04  4:15                 ` Adam Porter
2024-05-05  6:49                   ` Juri Linkov
2024-05-06 16:46                   ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).