Instead of emitting menu-item keys like [tab-1],
emit normal mouse events like [mouse-1] and [down-mouse-3]
for all mouse clicks issued on the tab-bar.
* lisp/tab-bar.el (tab--key-to-number): New internal function.
(tab-bar-handle-mouse): Use tab key to select/close tab.
(tab-bar-mouse-select-tab, tab-bar-mouse-close-tab)
(tab-bar-mouse-context-menu): New commands.
(tab-bar-map): Bind [down-mouse-1] to tab-bar-mouse-select-tab,
[down-mouse-2] to tab-bar-mouse-close-tab,
[down-mouse-3] to tab-bar-mouse-context-menu.
(tab-bar-keymap-cache): Remove.
(tab-bar-make-keymap): Don't use cache.
(tab-bar--format-tab): Remove default bindings from menu items.
(tab-bar-make-keymap-1): Prepend tab-bar-map.
* src/keyboard.c (make_lispy_event): Append event->arg to position
for Qtab_bar.
* src/term.c (handle_one_term_event): Simplify to set event arg.
* src/w32inevt.c (do_mouse_event): Set emacs_ev->arg to the value
returned from tty_handle_tab_bar_click.
* src/w32term.c (w32_handle_tab_bar_click): Return value from
handle_tab_bar_click.
(w32_read_socket): Set tab_bar_key to value returned from
w32_handle_tab_bar_click, and set event arg from it.
* src/xdisp.c (handle_tab_bar_click): Instead of emitting event,
return a list with Qtab_bar and tab caption with text properties
that contain Qmenu_item with key and binding.
(tty_handle_tab_bar_click): Simplify to return a list of Qtab_bar,
key and close_p, instead of emitting event.
* src/xterm.c (handle_one_xevent): Set tab_bar_key to value
returned from handle_tab_bar_click, and set event arg from it.