]> git.eshelyaron.com Git - emacs.git/commitdiff
Filter key release events through GTK when using native input
authorPo Lu <luangruo@yahoo.com>
Thu, 13 Jan 2022 09:56:55 +0000 (17:56 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 13 Jan 2022 09:56:55 +0000 (17:56 +0800)
* src/gtkutil.c (xg_filter_key): Set correct event type for key
release events.
* src/xterm.c (x_filter_event): Also filter release events.

src/gtkutil.c
src/xterm.c

index 7f635f8fe2b7e0c08c4f9a26fe81a8e18b059512..36ed55bc0397d0ed3c31776ba2582af79b5f8d58 100644 (file)
@@ -6262,7 +6262,12 @@ xg_widget_key_press_event_cb (GtkWidget *widget, GdkEvent *event,
 bool
 xg_filter_key (struct frame *frame, XEvent *xkey)
 {
-  GdkEvent *xg_event = gdk_event_new (GDK_KEY_PRESS);
+  GdkEvent *xg_event = gdk_event_new ((xkey->type == ButtonPress
+#ifdef HAVE_XINPUT2
+                                      || (xkey->type == GenericEvent
+                                          && xkey->xgeneric.evtype == XI_KeyPress)
+#endif
+                                      ) ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
   GdkDisplay *dpy = gtk_widget_get_display (FRAME_GTK_WIDGET (frame));
   GdkKeymap *keymap = gdk_keymap_get_for_display (dpy);
   GdkModifierType consumed;
index 058c1dccc22bc8aee3dc44408bee703e3f15a8ad..34097ebfd94eab87e88062ac629fef5c80e3ffc0 100644 (file)
@@ -8284,8 +8284,10 @@ x_filter_event (struct x_display_info *dpyinfo, XEvent *event)
       && event->type == GenericEvent
       && (event->xgeneric.extension
          == dpyinfo->xi2_opcode)
-      && (event->xgeneric.evtype
-         == XI_KeyPress))
+      && ((event->xgeneric.evtype
+          == XI_KeyPress)
+         || (event->xgeneric.evtype
+             == XI_KeyRelease)))
     {
       f1 = x_any_window_to_frame (dpyinfo,
                                  ((XIDeviceEvent *)