summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-02-15 09:19:12 +0800
committerPo Lu <luangruo@yahoo.com>2022-02-15 09:19:12 +0800
commitbb33446f2a4a2540fe3fcbc07d9fadacb024f963 (patch)
tree59d5a0b03d28db27b69071280bcf21edf9b328f0 /src
parentd43ca3855608752d26f3d615424339cd522322f4 (diff)
Better handle devices being enabled on XI2
* src/xterm.c (handle_one_xevent): Don't abort on DeviceChanged if the device couldn't be found, instead regenerating the device hierarchy to see if it was enabled.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/xterm.c b/src/xterm.c
index cff4b07c6ea..9c24a074e3d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -581,6 +581,11 @@ x_free_xi_devices (struct x_display_info *dpyinfo)
/* Setup valuator tracking for XI2 master devices on
DPYINFO->display. */
+/* This function's name is a misnomer: these days, it keeps a
+ client-side record of all devices, which includes basic information
+ about the device and also touchscreen tracking information, instead
+ of just scroll valuators. */
+
static void
x_init_master_valuators (struct x_display_info *dpyinfo)
{
@@ -11906,7 +11911,18 @@ handle_one_xevent (struct x_display_info *dpyinfo,
device = xi_device_from_id (dpyinfo, device_changed->deviceid);
if (!device)
- emacs_abort ();
+ {
+ /* An existing device might have been enabled. */
+ x_init_master_valuators (dpyinfo);
+
+ /* Now try to find the device again, in case it was
+ just enabled. */
+ device = xi_device_from_id (dpyinfo, device_changed->deviceid);
+ }
+
+ /* If it wasn't enabled, then stop handling this event. */
+ if (!device)
+ goto XI_OTHER;
/* Free data that we will regenerate from new
information. */