diff options
author | Eli Zaretskii <eliz@gnu.org> | 2019-10-06 19:53:18 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2019-10-06 19:53:18 +0300 |
commit | ad76020af8498d148984daf4de545d5d610d0589 (patch) | |
tree | 1f748991403fdb1f7f1f92f449dc38e5ddcceff7 /src/w32inevt.c | |
parent | 9d829b8be5b86668d5165b9d0c0cdc392b558dd3 (diff) | |
download | emacs-ad76020af8498d148984daf4de545d5d610d0589.tar.gz emacs-ad76020af8498d148984daf4de545d5d610d0589.tar.bz2 emacs-ad76020af8498d148984daf4de545d5d610d0589.zip |
Support mouse clicks on tab bar on TTY frames
This for now doesn't work on GPM.
* src/xdisp.c (display_tab_bar): Make the loop over tab-bar
items more efficient.
(tab_bar_item_info, tool_bar_item_info): Correct data type for
CHARPOS.
(tty_get_tab_bar_item, tty_handle_tab_bar_click): New functions.
(note_mouse_highlight): Handle help-echo of tab-bar tabs on
TTY frames.
* src/w32inevt.c (do_mouse_event): Call
tty_handle_tab_bar_click to process mouse clicks on the tab bar.
* src/termchar.h (tty_handle_tab_bar_click): Add prototype.
* src/w32console.c (w32con_set_terminal_modes): Disable Quick
Edit mode on entry, to make sure mouse events get reported to
us.
Diffstat (limited to 'src/w32inevt.c')
-rw-r--r-- | src/w32inevt.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/w32inevt.c b/src/w32inevt.c index 0a1321c6d89..1a901d4e0aa 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -559,8 +559,6 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, if (event->dwButtonState == button_state) return 0; - emacs_ev->kind = MOUSE_CLICK_EVENT; - /* Find out what button has changed state since the last button event. */ but_change = button_state ^ event->dwButtonState; @@ -576,15 +574,24 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, } button_state = event->dwButtonState; - emacs_ev->modifiers = - w32_kbd_mods_to_emacs (event->dwControlKeyState, 0) - | ((event->dwButtonState & mask) ? down_modifier : up_modifier); + emacs_ev->modifiers = w32_kbd_mods_to_emacs (event->dwControlKeyState, 0); + emacs_ev->timestamp = GetTickCount (); + + int x = event->dwMousePosition.X; + int y = event->dwMousePosition.Y; + struct frame *f = get_frame (); + if (tty_handle_tab_bar_click (f, x, y, (button_state & mask) != 0, + emacs_ev)) + return 0; /* tty_handle_tab_bar_click adds the event to queue */ - XSETFASTINT (emacs_ev->x, event->dwMousePosition.X); - XSETFASTINT (emacs_ev->y, event->dwMousePosition.Y); - XSETFRAME (emacs_ev->frame_or_window, get_frame ()); + emacs_ev->modifiers |= ((button_state & mask) + ? down_modifier : up_modifier); + + emacs_ev->kind = MOUSE_CLICK_EVENT; + XSETFASTINT (emacs_ev->x, x); + XSETFASTINT (emacs_ev->y, y); + XSETFRAME (emacs_ev->frame_or_window, f); emacs_ev->arg = Qnil; - emacs_ev->timestamp = GetTickCount (); return 1; } |