]> git.eshelyaron.com Git - emacs.git/commitdiff
Update XI2 device use on slave attachment and detachment
authorPo Lu <luangruo@yahoo.com>
Sun, 10 Apr 2022 03:06:41 +0000 (11:06 +0800)
committerPo Lu <luangruo@yahoo.com>
Sun, 10 Apr 2022 03:06:41 +0000 (11:06 +0800)
* src/xterm.c (handle_one_xevent): Update whether device is a
master device when it's detached or attached.

src/xterm.c

index 14a15066044cd6035f7532b4331a055210edb9a2..34b7c026be89ad4f7b0a9e16c220da49d8458d1e 100644 (file)
@@ -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)