]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix core string lookup with modifiers on XI2
authorPo Lu <luangruo@yahoo.com>
Fri, 15 Apr 2022 07:09:18 +0000 (15:09 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 15 Apr 2022 07:09:18 +0000 (15:09 +0800)
* src/xterm.c (handle_one_xevent): Clean modifiers from
xkey.state before giving it to XLookupString.

src/xterm.c

index 289ea06d9291ba9a480130ee69f3f9499bfd3f35..f80b2ad2f0278dbdbf4785c10e290fa041d543f6 100644 (file)
@@ -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;
                        }
                    }