]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix some issues with input methods that depend on button state
authorPo Lu <luangruo@yahoo.com>
Sat, 12 Mar 2022 05:02:28 +0000 (13:02 +0800)
committerPo Lu <luangruo@yahoo.com>
Sat, 12 Mar 2022 05:03:00 +0000 (13:03 +0800)
* src/xterm.c (handle_one_xevent): Translate button state before
filtering events.

src/xterm.c

index cf79135497ca86c05c84341bdb466cb4c2637e9d..d8311828116ba34e4ef60417216803c15df152e4 100644 (file)
@@ -12771,6 +12771,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              xkey.time = xev->time;
              xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
                            | (xev->group.effective << 13));
+
+             /* Some input methods react differently depending on the
+                buttons that are pressed.  */
+             if (xev->buttons.mask_len)
+               {
+                 if (XIMaskIsSet (xev->buttons.mask, 1))
+                   xkey.state |= Button1Mask;
+                 if (XIMaskIsSet (xev->buttons.mask, 2))
+                   xkey.state |= Button2Mask;
+                 if (XIMaskIsSet (xev->buttons.mask, 3))
+                   xkey.state |= Button3Mask;
+               }
+
              xkey.keycode = xev->detail;
              xkey.same_screen = True;
 
@@ -13126,6 +13139,19 @@ handle_one_xevent (struct x_display_info *dpyinfo,
              xkey.time = xev->time;
              xkey.state = ((xev->mods.effective & ~(1 << 13 | 1 << 14))
                            | (xev->group.effective << 13));
+
+             /* Some input methods react differently depending on the
+                buttons that are pressed.  */
+             if (xev->buttons.mask_len)
+               {
+                 if (XIMaskIsSet (xev->buttons.mask, 1))
+                   xkey.state |= Button1Mask;
+                 if (XIMaskIsSet (xev->buttons.mask, 2))
+                   xkey.state |= Button2Mask;
+                 if (XIMaskIsSet (xev->buttons.mask, 3))
+                   xkey.state |= Button3Mask;
+               }
+
              xkey.keycode = xev->detail;
              xkey.same_screen = True;