From 4d2aa420bd09ac5109a4c13bd163386ea276297e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Fri, 15 Apr 2022 15:09:18 +0800 Subject: [PATCH] Fix core string lookup with modifiers on XI2 * src/xterm.c (handle_one_xevent): Clean modifiers from xkey.state before giving it to XLookupString. --- src/xterm.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xterm.c b/src/xterm.c index 289ea06d929..f80b2ad2f02 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17535,6 +17535,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, char *copy_bufptr = copy_buffer; int copy_bufsiz = sizeof (copy_buffer); ptrdiff_t i; + uint old_state; struct xi_device_t *device, *source; coding = Qlatin_1; @@ -17779,9 +17780,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, else #endif { + old_state = xkey.state; + xkey.state &= ~ControlMask; + xkey.state &= ~(dpyinfo->meta_mod_mask + | dpyinfo->super_mod_mask + | dpyinfo->hyper_mod_mask + | dpyinfo->alt_mod_mask); + nbytes = XLookupString (&xkey, copy_bufptr, copy_bufsiz, &keysym, NULL); + + xkey.state = old_state; } } -- 2.39.5