From: Po Lu Date: Sat, 12 Mar 2022 05:02:28 +0000 (+0800) Subject: Fix some issues with input methods that depend on button state X-Git-Tag: emacs-29.0.90~1931^2~1188 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b5ac604b15532db0418f3c2393907daa317f2ca5;p=emacs.git Fix some issues with input methods that depend on button state * src/xterm.c (handle_one_xevent): Translate button state before filtering events. --- diff --git a/src/xterm.c b/src/xterm.c index cf79135497c..d8311828116 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -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;