From 697298e7451a5d60c8d89c4c3c931eb07c688c6a Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 10 Jan 2022 11:29:35 +0800 Subject: [PATCH] Make toggling native input methods via shift work again * src/xterm.c (handle_one_xevent): Start filtering XI key release events again, but drop the event if the IM asked. --- src/xterm.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index 5e4941a4aed..712792674f2 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11110,6 +11110,37 @@ handle_one_xevent (struct x_display_info *dpyinfo, } case XI_KeyRelease: x_display_set_last_user_time (dpyinfo, xev->time); + +#if defined HAVE_X_I18N || defined USE_GTK + XKeyPressedEvent xkey; + + memset (&xkey, 0, sizeof xkey); + + xkey.type = KeyRelease; + xkey.serial = xev->serial; + xkey.send_event = xev->send_event; + xkey.display = xev->display; + xkey.window = xev->event; + xkey.root = xev->root; + xkey.subwindow = xev->child; + xkey.time = xev->time; + xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14)) + | (xev->group.effective << 13)); + xkey.keycode = xev->detail; + xkey.same_screen = True; + +#ifdef HAVE_X_I18N + if (x_filter_event (dpyinfo, (XEvent *) &xkey)) + *finish = X_EVENT_DROP; +#else + f = x_any_window_to_frame (xkey->event); + + if (f && + xg_filter_event (dpyinfo, event)) + *finish = X_EVENT_DROP; +#endif +#endif + goto XI_OTHER; case XI_PropertyEvent: -- 2.39.2