]> git.eshelyaron.com Git - emacs.git/commitdiff
Use XI2 to handle xwidget button events
authorPo Lu <luangruo@yahoo.com>
Wed, 29 Dec 2021 05:13:15 +0000 (13:13 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 29 Dec 2021 05:13:15 +0000 (13:13 +0800)
* src/xterm.c (handle_one_xevent): Handle xwidget views when
handling XI_ButtonPress or XI_ButtonRelease events.
* src/xwidget.c (x_draw_xwidget_glyph_string): Add appropriate
values to the XI2 event mask.

src/xterm.c
src/xwidget.c

index 3fdf214c3da3c3974cbec1ddd6bfe0aa5773684b..3200e44a8723b1d6d26bf113dbf7667383176548 100644 (file)
@@ -10325,6 +10325,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              bool tab_bar_p = false;
              bool tool_bar_p = false;
              struct xi_device_t *device;
+#ifdef HAVE_XWIDGETS
+             struct xwidget_view *xvw;
+#endif
 
 #ifdef XIPointerEmulated
              /* Ignore emulated scroll events when XI2 native
@@ -10340,6 +10343,25 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                }
 #endif
 
+#ifdef HAVE_XWIDGETS
+             xvw = xwidget_view_from_window (xev->event);
+             if (xvw)
+               {
+                 xwidget_button (xvw, xev->evtype == XI_ButtonPress,
+                                 lrint (xev->event_x), lrint (xev->event_y),
+                                 xev->detail, xev->mods.effective, xev->time);
+
+                 if (!EQ (selected_window, xvw->w) && (xev->detail < 4))
+                   {
+                     inev.ie.kind = SELECT_WINDOW_EVENT;
+                     inev.ie.frame_or_window = xvw->w;
+                   }
+
+                 *finish = X_EVENT_DROP;
+                 goto XI_OTHER;
+               }
+#endif
+
              device = xi_device_from_id (dpyinfo, xev->deviceid);
 
              if (!device || !device->master_p)
index 574515354851b310f845d262b1d04b7d1581446c..22c42382bbf382037498a5368fc1ba47704b7f58 100644 (file)
@@ -2106,6 +2106,8 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
          mask.deviceid = XIAllMasterDevices;
 
          XISetMask (m, XI_Motion);
+         XISetMask (m, XI_ButtonPress);
+         XISetMask (m, XI_ButtonRelease);
          XISelectEvents (xv->dpy, xv->wdesc, &mask, 1);
        }
 #endif