aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c
index ee0035234b5..7487450d649 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -27634,6 +27634,33 @@ my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
27634 connection established. */ 27634 connection established. */
27635static unsigned x_display_id; 27635static unsigned x_display_id;
27636 27636
27637#if defined HAVE_XINPUT2 && !defined HAVE_GTK3
27638
27639/* Select for device change events on the root window of DPYINFO.
27640 These include device change and hierarchy change notifications. */
27641
27642static void
27643xi_select_hierarchy_events (struct x_display_info *dpyinfo)
27644{
27645 XIEventMask mask;
27646 ptrdiff_t l;
27647 unsigned char *m;
27648
27649 l = XIMaskLen (XI_LASTEVENT);
27650 mask.mask = m = alloca (l);
27651 memset (m, 0, l);
27652 mask.mask_len = l;
27653
27654 XISetMask (m, XI_PropertyEvent);
27655 XISetMask (m, XI_HierarchyChanged);
27656 XISetMask (m, XI_DeviceChanged);
27657
27658 XISelectEvents (dpyinfo->display, dpyinfo->root_window,
27659 &mask, 1);
27660}
27661
27662#endif
27663
27637/* Open a connection to X display DISPLAY_NAME, and return 27664/* Open a connection to X display DISPLAY_NAME, and return
27638 the structure that describes the open display. 27665 the structure that describes the open display.
27639 If we cannot contact the display, return null. */ 27666 If we cannot contact the display, return null. */
@@ -28263,6 +28290,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
28263 if (rc == Success) 28290 if (rc == Success)
28264 { 28291 {
28265 dpyinfo->supports_xi2 = true; 28292 dpyinfo->supports_xi2 = true;
28293#ifndef HAVE_GTK3
28294 /* Select for hierarchy events on the root window. GTK 3.x
28295 does this itself. */
28296 xi_select_hierarchy_events (dpyinfo);
28297#endif
28298
28266 x_cache_xi_devices (dpyinfo); 28299 x_cache_xi_devices (dpyinfo);
28267 } 28300 }
28268 } 28301 }