memset (m, 0, l);
#endif
- mask.deviceid = XIAllDevices;
-
- XISetMask (m, XI_PropertyEvent);
- XISetMask (m, XI_HierarchyChanged);
- XISetMask (m, XI_DeviceChanged);
#ifdef HAVE_XINPUT2_2
if (FRAME_DISPLAY_INFO (f)->xi2_version >= 2)
{
+ mask.deviceid = XIAllDevices;
+
XISetMask (m, XI_TouchBegin);
XISetMask (m, XI_TouchUpdate);
XISetMask (m, XI_TouchEnd);
XISetMask (m, XI_GesturePinchEnd);
}
#endif
+
+ XISelectEvents (FRAME_X_DISPLAY (f),
+ FRAME_X_WINDOW (f),
+ &mask, 1);
}
#endif
- XISelectEvents (FRAME_X_DISPLAY (f),
- FRAME_X_WINDOW (f),
- &mask, 1);
#ifndef HAVE_XINPUT2_1
FRAME_X_OUTPUT (f)->xi_masks = selected;
connection established. */
static unsigned x_display_id;
+#if defined HAVE_XINPUT2 && !defined HAVE_GTK3
+
+/* Select for device change events on the root window of DPYINFO.
+ These include device change and hierarchy change notifications. */
+
+static void
+xi_select_hierarchy_events (struct x_display_info *dpyinfo)
+{
+ XIEventMask mask;
+ ptrdiff_t l;
+ unsigned char *m;
+
+ l = XIMaskLen (XI_LASTEVENT);
+ mask.mask = m = alloca (l);
+ memset (m, 0, l);
+ mask.mask_len = l;
+
+ XISetMask (m, XI_PropertyEvent);
+ XISetMask (m, XI_HierarchyChanged);
+ XISetMask (m, XI_DeviceChanged);
+
+ XISelectEvents (dpyinfo->display, dpyinfo->root_window,
+ &mask, 1);
+}
+
+#endif
+
/* Open a connection to X display DISPLAY_NAME, and return
the structure that describes the open display.
If we cannot contact the display, return null. */
if (rc == Success)
{
dpyinfo->supports_xi2 = true;
+#ifndef HAVE_GTK3
+ /* Select for hierarchy events on the root window. GTK 3.x
+ does this itself. */
+ xi_select_hierarchy_events (dpyinfo);
+#endif
+
x_cache_xi_devices (dpyinfo);
}
}