From: Po Lu Date: Thu, 13 Jan 2022 09:56:55 +0000 (+0800) Subject: Filter key release events through GTK when using native input X-Git-Tag: emacs-29.0.90~3098 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=626c1dce02d4f2e8d0822decf8b421eee00674b1;p=emacs.git Filter key release events through GTK when using native input * src/gtkutil.c (xg_filter_key): Set correct event type for key release events. * src/xterm.c (x_filter_event): Also filter release events. --- diff --git a/src/gtkutil.c b/src/gtkutil.c index 7f635f8fe2b..36ed55bc039 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -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; diff --git a/src/xterm.c b/src/xterm.c index 058c1dccc22..34097ebfd94 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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 *)