From: Po Lu Date: Sun, 10 Apr 2022 03:06:41 +0000 (+0800) Subject: Update XI2 device use on slave attachment and detachment X-Git-Tag: emacs-29.0.90~1931^2~680 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=75bdf15c2972e216a2c10a7562d96ad217192356;p=emacs.git Update XI2 device use on slave attachment and detachment * src/xterm.c (handle_one_xevent): Update whether device is a master device when it's detached or attached. --- diff --git a/src/xterm.c b/src/xterm.c index 14a15066044..34b7c026be8 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17741,6 +17741,26 @@ handle_one_xevent (struct x_display_info *dpyinfo, } else if (hev->info[i].flags & XIDeviceDisabled) disabled[n_disabled++] = hev->info[i].deviceid; + else if (hev->info[i].flags & XISlaveDetached + || hev->info[i].flags & XISlaveAttached) + { + device = xi_device_from_id (dpyinfo, hev->info[i].deviceid); + x_catch_errors (dpyinfo->display); + info = XIQueryDevice (dpyinfo->display, hev->info[i].deviceid, + &ndevices); + x_uncatch_errors (); + + if (info) + { + if (device && info->enabled) + device->master_p = (info->use == XIMasterKeyboard + || info->use == XIMasterPointer); + else if (device) + disabled[n_disabled++] = hev->info[i].deviceid; + + XIFreeDeviceInfo (info); + } + } } if (n_disabled)