]> git.eshelyaron.com Git - emacs.git/commitdiff
Translate buttons when sending XI2 motion events to xwidgets
authorPo Lu <luangruo@yahoo.com>
Wed, 29 Dec 2021 05:30:46 +0000 (13:30 +0800)
committerPo Lu <luangruo@yahoo.com>
Wed, 29 Dec 2021 05:30:46 +0000 (13:30 +0800)
* src/xterm.c (handle_one_xevent): Translate all three buttons
when passing XI2 motion events to xwidgets.

src/xterm.c

index 3200e44a8723b1d6d26bf113dbf7667383176548..a986681ab7792c8c4d2e5a282fffb4978a647b1c 100644 (file)
@@ -10210,13 +10210,25 @@ handle_one_xevent (struct x_display_info *dpyinfo,
 #ifdef HAVE_XWIDGETS
              if (xv)
                {
+                 uint state = xev->mods.effective;
+
+                 if (xev->buttons.mask_len)
+                   {
+                     if (XIMaskIsSet (xev->buttons.mask, 1))
+                       state |= Button1Mask;
+                     if (XIMaskIsSet (xev->buttons.mask, 2))
+                       state |= Button2Mask;
+                     if (XIMaskIsSet (xev->buttons.mask, 3))
+                       state |= Button3Mask;
+                   }
+
                  if (found_valuator)
                    xwidget_scroll (xv, xev->event_x, xev->event_y,
-                                   xv_total_x, xv_total_y, xev->mods.effective,
+                                   xv_total_x, xv_total_y, state,
                                    xev->time, any_stop_p);
                  else
                    xwidget_motion_notify (xv, xev->event_x, xev->event_y,
-                                          xev->mods.effective, xev->time);
+                                          state, xev->time);
 
                  goto XI_OTHER;
                }