]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix xg_event_is_for_menubar for XI2 events
authorPo Lu <luangruo@yahoo.com>
Tue, 21 Dec 2021 01:52:05 +0000 (09:52 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 21 Dec 2021 01:53:10 +0000 (09:53 +0800)
* src/gtkutil.c (xg_event_is_for_menubar): Use correct fields
for XI2 events.
* src/xterm.c (handle_one_event): Drop TouchBegin events we
know about.

src/gtkutil.c
src/xterm.c

index 62a9c05a977c69928621361f5f6385b50b412624..7370a795c08d0343e3d472ebc59f12be0f546820 100644 (file)
@@ -4038,7 +4038,7 @@ xg_event_is_for_menubar (struct frame *f, const XEvent *event)
 
 #ifdef HAVE_XINPUT2
   XIDeviceEvent *xev = (XIDeviceEvent *) event->xcookie.data;
-  if (event->type == GenericEvent) /* XI_ButtonPress or XI_ButtonRelease */
+  if (event->type == GenericEvent) /* XI_ButtonPress or XI_ButtonRelease or a touch event.  */
     {
       if (! (xev->event_x >= 0
             && xev->event_x < FRAME_PIXEL_WIDTH (f)
@@ -4075,8 +4075,21 @@ xg_event_is_for_menubar (struct frame *f, const XEvent *event)
   list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget));
   if (! list) return 0;
   int scale = xg_get_scale (f);
-  rec.x = event->xbutton.x / scale;
-  rec.y = event->xbutton.y / scale;
+#ifdef HAVE_XINPUT2
+  if (event->type == GenericEvent)
+    {
+      rec.x = xev->event_x / scale;
+      rec.y = xev->event_y / scale;
+    }
+  else
+    {
+#else
+      rec.x = event->xbutton.x / scale;
+      rec.y = event->xbutton.y / scale;
+#endif
+#ifdef HAVE_XINPUT2
+    }
+#endif
   rec.width = 1;
   rec.height = 1;
 
index 0cc093dc752ec880e696bf7c612ad0c9d580cc26..1691db19659943c8b9886df522c7f1876c5f7c01 100644 (file)
@@ -10891,6 +10891,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 
              if (f && device->direct_p)
                {
+                 *finish = X_EVENT_DROP;
                  x_catch_errors (dpyinfo->display);
                  XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
                                      xev->detail, xev->event, XIAcceptTouch);