aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2021-12-29 18:37:04 +0800
committerPo Lu2021-12-29 18:37:04 +0800
commit7d672ed069f7936b9410f61cff2df97f804fabff (patch)
tree6378bd292726c9f90f6b0c18f260a52f88cebc4f /src
parent9d1312d8e9bf78c12a94fa075cda3c8ad7d1dad7 (diff)
downloademacs-7d672ed069f7936b9410f61cff2df97f804fabff.tar.gz
emacs-7d672ed069f7936b9410f61cff2df97f804fabff.zip
Translate state of XI2 entry events when sending them to xwidgets
* src/xwidget.c (xi_translate_notify_detail): New function. (xwidget_motion_or_crossing): Translate detail and state of GenericEvents before sending them to the widget.
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index 671d0390a0b..30e9c2895d4 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1229,6 +1229,28 @@ xwidget_scroll (struct xwidget_view *view, double x, double y,
1229} 1229}
1230#endif 1230#endif
1231 1231
1232#ifdef HAVE_XINPUT2
1233static GdkNotifyType
1234xi_translate_notify_detail (int detail)
1235{
1236 switch (detail)
1237 {
1238 case NotifyInferior:
1239 return GDK_NOTIFY_INFERIOR;
1240 case NotifyAncestor:
1241 return GDK_NOTIFY_ANCESTOR;
1242 case NotifyVirtual:
1243 return GDK_NOTIFY_VIRTUAL;
1244 case NotifyNonlinear:
1245 return GDK_NOTIFY_NONLINEAR;
1246 case NotifyNonlinearVirtual:
1247 return GDK_NOTIFY_NONLINEAR_VIRTUAL;
1248 default:
1249 emacs_abort ();
1250 }
1251}
1252#endif
1253
1232void 1254void
1233xwidget_motion_or_crossing (struct xwidget_view *view, const XEvent *event) 1255xwidget_motion_or_crossing (struct xwidget_view *view, const XEvent *event)
1234{ 1256{
@@ -1306,6 +1328,19 @@ xwidget_motion_or_crossing (struct xwidget_view *view, const XEvent *event)
1306 xg_event->crossing.y_root = (gdouble) xev->root_y; 1328 xg_event->crossing.y_root = (gdouble) xev->root_y;
1307 xg_event->crossing.time = xev->time; 1329 xg_event->crossing.time = xev->time;
1308 xg_event->crossing.focus = xev->focus; 1330 xg_event->crossing.focus = xev->focus;
1331 xg_event->crossing.detail = xi_translate_notify_detail (xev->detail);
1332 xg_event->crossing.state = xev->mods.effective;
1333
1334 if (xev->buttons.mask_len)
1335 {
1336 if (XIMaskIsSet (xev->buttons.mask, 1))
1337 xg_event->crossing.state |= GDK_BUTTON1_MASK;
1338 if (XIMaskIsSet (xev->buttons.mask, 2))
1339 xg_event->crossing.state |= GDK_BUTTON2_MASK;
1340 if (XIMaskIsSet (xev->buttons.mask, 3))
1341 xg_event->crossing.state |= GDK_BUTTON3_MASK;
1342 }
1343
1309 gdk_event_set_device (xg_event, find_suitable_pointer (view->frame)); 1344 gdk_event_set_device (xg_event, find_suitable_pointer (view->frame));
1310 } 1345 }
1311#endif 1346#endif