diff options
| author | Po Lu | 2022-04-08 08:13:49 +0800 |
|---|---|---|
| committer | Po Lu | 2022-04-08 08:13:49 +0800 |
| commit | 5414331d07a77d8e72aa44d4dd31f6af09bc161e (patch) | |
| tree | da8a18c7ff8533f950f2614d087bf5090208d871 /src | |
| parent | 0622df36112e41074dfff432c782e3e3b5de3e47 (diff) | |
| download | emacs-5414331d07a77d8e72aa44d4dd31f6af09bc161e.tar.gz emacs-5414331d07a77d8e72aa44d4dd31f6af09bc161e.zip | |
Make device reporting work for tool bar clicks
* src/dispextern.h: Update prototyupes.
* src/xdisp.c (handle_tool_bar_click): Pass Qt to that function
instead.
(handle_tool_bar_click_with_device): New function.
* src/xterm.c (handle_one_xevent): Pass device to tool bar click
logic.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 13 | ||||
| -rw-r--r-- | src/xterm.c | 5 |
3 files changed, 15 insertions, 5 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index b7cfde70339..e9b19a7f135 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -3460,6 +3460,8 @@ extern Lisp_Object handle_tab_bar_click (struct frame *, | |||
| 3460 | int, int, bool, int); | 3460 | int, int, bool, int); |
| 3461 | extern void handle_tool_bar_click (struct frame *, | 3461 | extern void handle_tool_bar_click (struct frame *, |
| 3462 | int, int, bool, int); | 3462 | int, int, bool, int); |
| 3463 | extern void handle_tool_bar_click_with_device (struct frame *, int, int, bool, | ||
| 3464 | int, Lisp_Object); | ||
| 3463 | 3465 | ||
| 3464 | extern void expose_frame (struct frame *, int, int, int, int); | 3466 | extern void expose_frame (struct frame *, int, int, int, int); |
| 3465 | extern bool gui_intersect_rectangles (const Emacs_Rectangle *, | 3467 | extern bool gui_intersect_rectangles (const Emacs_Rectangle *, |
diff --git a/src/xdisp.c b/src/xdisp.c index d7313081733..bdefd2b0423 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -15114,11 +15114,11 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, | |||
| 15114 | Handle mouse button event on the tool-bar of frame F, at | 15114 | Handle mouse button event on the tool-bar of frame F, at |
| 15115 | frame-relative coordinates X/Y. DOWN_P is true for a button press, | 15115 | frame-relative coordinates X/Y. DOWN_P is true for a button press, |
| 15116 | false for button release. MODIFIERS is event modifiers for button | 15116 | false for button release. MODIFIERS is event modifiers for button |
| 15117 | release. */ | 15117 | release. DEVICE is the device the click came from, or Qt. */ |
| 15118 | 15118 | ||
| 15119 | void | 15119 | void |
| 15120 | handle_tool_bar_click (struct frame *f, int x, int y, bool down_p, | 15120 | handle_tool_bar_click_with_device (struct frame *f, int x, int y, bool down_p, |
| 15121 | int modifiers) | 15121 | int modifiers, Lisp_Object device) |
| 15122 | { | 15122 | { |
| 15123 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 15123 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 15124 | struct window *w = XWINDOW (f->tool_bar_window); | 15124 | struct window *w = XWINDOW (f->tool_bar_window); |
| @@ -15175,11 +15175,18 @@ handle_tool_bar_click (struct frame *f, int x, int y, bool down_p, | |||
| 15175 | event.frame_or_window = frame; | 15175 | event.frame_or_window = frame; |
| 15176 | event.arg = key; | 15176 | event.arg = key; |
| 15177 | event.modifiers = modifiers; | 15177 | event.modifiers = modifiers; |
| 15178 | event.device = device; | ||
| 15178 | kbd_buffer_store_event (&event); | 15179 | kbd_buffer_store_event (&event); |
| 15179 | f->last_tool_bar_item = -1; | 15180 | f->last_tool_bar_item = -1; |
| 15180 | } | 15181 | } |
| 15181 | } | 15182 | } |
| 15182 | 15183 | ||
| 15184 | void | ||
| 15185 | handle_tool_bar_click (struct frame *f, int x, int y, bool down_p, | ||
| 15186 | int modifiers) | ||
| 15187 | { | ||
| 15188 | handle_tool_bar_click_with_device (f, x, y, down_p, modifiers, Qt); | ||
| 15189 | } | ||
| 15183 | 15190 | ||
| 15184 | /* Possibly highlight a tool-bar item on frame F when mouse moves to | 15191 | /* Possibly highlight a tool-bar item on frame F when mouse moves to |
| 15185 | tool-bar window-relative coordinates X/Y. Called from | 15192 | tool-bar window-relative coordinates X/Y. Called from |
diff --git a/src/xterm.c b/src/xterm.c index 8c6068e6541..9336b9420f6 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -17038,9 +17038,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 17038 | tool_bar_p = EQ (window, f->tool_bar_window); | 17038 | tool_bar_p = EQ (window, f->tool_bar_window); |
| 17039 | 17039 | ||
| 17040 | if (tool_bar_p && xev->detail < 4) | 17040 | if (tool_bar_p && xev->detail < 4) |
| 17041 | handle_tool_bar_click | 17041 | handle_tool_bar_click_with_device |
| 17042 | (f, x, y, xev->evtype == XI_ButtonPress, | 17042 | (f, x, y, xev->evtype == XI_ButtonPress, |
| 17043 | x_x_to_emacs_modifiers (dpyinfo, bv.state)); | 17043 | x_x_to_emacs_modifiers (dpyinfo, bv.state), |
| 17044 | source ? source->name : Qt); | ||
| 17044 | } | 17045 | } |
| 17045 | #endif /* !USE_GTK */ | 17046 | #endif /* !USE_GTK */ |
| 17046 | 17047 | ||