]> git.eshelyaron.com Git - emacs.git/commit
Redesign tab-bar event processing (bug#41342, bug#41343)
authorJuri Linkov <juri@linkov.net>
Wed, 18 Aug 2021 17:32:32 +0000 (20:32 +0300)
committerJuri Linkov <juri@linkov.net>
Wed, 18 Aug 2021 17:32:32 +0000 (20:32 +0300)
commite6bea0cbc76bc47f435be9c7f6f3c4b770994924
tree2ee98e933d595d6ad970b78a8c51d7a51597f210
parent54039d721c5b7fd210a79dc641914cba8fc82185
Redesign tab-bar event processing (bug#41342, bug#41343)

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/mouse.el (mouse-posn-property): Handle 'tab-bar' posn-area.

* 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.
etc/NEWS
lisp/mouse.el
lisp/tab-bar.el
src/dispextern.h
src/keyboard.c
src/term.c
src/termchar.h
src/w32inevt.c
src/w32term.c
src/xdisp.c
src/xterm.c