1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 11:00:45 -08:00

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.
This commit is contained in:
Po Lu 2022-04-08 08:13:49 +08:00
parent 0622df3611
commit 5414331d07
3 changed files with 15 additions and 5 deletions

View file

@ -3460,6 +3460,8 @@ extern Lisp_Object handle_tab_bar_click (struct frame *,
int, int, bool, int);
extern void handle_tool_bar_click (struct frame *,
int, int, bool, int);
extern void handle_tool_bar_click_with_device (struct frame *, int, int, bool,
int, Lisp_Object);
extern void expose_frame (struct frame *, int, int, int, int);
extern bool gui_intersect_rectangles (const Emacs_Rectangle *,

View file

@ -15114,11 +15114,11 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
Handle mouse button event on the tool-bar of frame F, at
frame-relative coordinates X/Y. DOWN_P is true for a button press,
false for button release. MODIFIERS is event modifiers for button
release. */
release. DEVICE is the device the click came from, or Qt. */
void
handle_tool_bar_click (struct frame *f, int x, int y, bool down_p,
int modifiers)
handle_tool_bar_click_with_device (struct frame *f, int x, int y, bool down_p,
int modifiers, Lisp_Object device)
{
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
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,
event.frame_or_window = frame;
event.arg = key;
event.modifiers = modifiers;
event.device = device;
kbd_buffer_store_event (&event);
f->last_tool_bar_item = -1;
}
}
void
handle_tool_bar_click (struct frame *f, int x, int y, bool down_p,
int modifiers)
{
handle_tool_bar_click_with_device (f, x, y, down_p, modifiers, Qt);
}
/* Possibly highlight a tool-bar item on frame F when mouse moves to
tool-bar window-relative coordinates X/Y. Called from

View file

@ -17038,9 +17038,10 @@ handle_one_xevent (struct x_display_info *dpyinfo,
tool_bar_p = EQ (window, f->tool_bar_window);
if (tool_bar_p && xev->detail < 4)
handle_tool_bar_click
handle_tool_bar_click_with_device
(f, x, y, xev->evtype == XI_ButtonPress,
x_x_to_emacs_modifiers (dpyinfo, bv.state));
x_x_to_emacs_modifiers (dpyinfo, bv.state),
source ? source->name : Qt);
}
#endif /* !USE_GTK */