emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5414331d07: Make device reporting work for tool bar clicks


From: Po Lu
Subject: master 5414331d07: Make device reporting work for tool bar clicks
Date: Thu, 7 Apr 2022 20:14:01 -0400 (EDT)

branch: master
commit 5414331d07a77d8e72aa44d4dd31f6af09bc161e
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 src/dispextern.h |  2 ++
 src/xdisp.c      | 13 ++++++++++---
 src/xterm.c      |  5 +++--
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/dispextern.h b/src/dispextern.h
index b7cfde7033..e9b19a7f13 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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 *,
diff --git a/src/xdisp.c b/src/xdisp.c
index d731308173..bdefd2b042 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,
    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
diff --git a/src/xterm.c b/src/xterm.c
index 8c6068e654..9336b9420f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -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 */
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]