aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorPo Lu2022-02-15 09:19:12 +0800
committerPo Lu2022-02-15 09:19:12 +0800
commitbb33446f2a4a2540fe3fcbc07d9fadacb024f963 (patch)
tree59d5a0b03d28db27b69071280bcf21edf9b328f0 /src/xterm.c
parentd43ca3855608752d26f3d615424339cd522322f4 (diff)
downloademacs-bb33446f2a4a2540fe3fcbc07d9fadacb024f963.tar.gz
emacs-bb33446f2a4a2540fe3fcbc07d9fadacb024f963.zip
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/xterm.c')
-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)
581/* Setup valuator tracking for XI2 master devices on 581/* Setup valuator tracking for XI2 master devices on
582 DPYINFO->display. */ 582 DPYINFO->display. */
583 583
584/* This function's name is a misnomer: these days, it keeps a
585 client-side record of all devices, which includes basic information
586 about the device and also touchscreen tracking information, instead
587 of just scroll valuators. */
588
584static void 589static void
585x_init_master_valuators (struct x_display_info *dpyinfo) 590x_init_master_valuators (struct x_display_info *dpyinfo)
586{ 591{
@@ -11906,7 +11911,18 @@ handle_one_xevent (struct x_display_info *dpyinfo,
11906 device = xi_device_from_id (dpyinfo, device_changed->deviceid); 11911 device = xi_device_from_id (dpyinfo, device_changed->deviceid);
11907 11912
11908 if (!device) 11913 if (!device)
11909 emacs_abort (); 11914 {
11915 /* An existing device might have been enabled. */
11916 x_init_master_valuators (dpyinfo);
11917
11918 /* Now try to find the device again, in case it was
11919 just enabled. */
11920 device = xi_device_from_id (dpyinfo, device_changed->deviceid);
11921 }
11922
11923 /* If it wasn't enabled, then stop handling this event. */
11924 if (!device)
11925 goto XI_OTHER;
11910 11926
11911 /* Free data that we will regenerate from new 11927 /* Free data that we will regenerate from new
11912 information. */ 11928 information. */