[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master b4879603fd: Fix XInput hierarchy events not being delivered in da
From: |
Po Lu |
Subject: |
master b4879603fd: Fix XInput hierarchy events not being delivered in daemon mode |
Date: |
Tue, 16 Aug 2022 09:12:01 -0400 (EDT) |
branch: master
commit b4879603fd8f9c8e82e30c5fbb65fa63d8166ee4
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Fix XInput hierarchy events not being delivered in daemon mode
* src/xfns.c (setup_xi_event_mask): Stop selecting for device
hierarchy events.
* src/xterm.c (xi_select_hierarchy_events, x_term_init): Select
those here instead, on the default root window.
---
src/xfns.c | 14 ++++++--------
src/xterm.c | 33 +++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/src/xfns.c b/src/xfns.c
index 6ed93ee42c..a275e3e11a 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3773,14 +3773,11 @@ setup_xi_event_mask (struct frame *f)
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);
@@ -3792,11 +3789,12 @@ setup_xi_event_mask (struct frame *f)
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;
diff --git a/src/xterm.c b/src/xterm.c
index ee0035234b..7487450d64 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -27634,6 +27634,33 @@ my_log_handler (const gchar *log_domain,
GLogLevelFlags log_level,
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. */
@@ -28263,6 +28290,12 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
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);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master b4879603fd: Fix XInput hierarchy events not being delivered in daemon mode,
Po Lu <=