xserver: Branch 'mpx'

Peter Hutterer whot at kemper.freedesktop.org
Thu Oct 4 21:10:43 PDT 2007


 dix/devices.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
diff-tree d42909b23a9be64a26aa349c1d6dcd8b228bffa7 (from ff2351246da30b56a3a8f90654993c41b8eb3921)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Fri Oct 5 13:04:10 2007 +0930

    dix: when disabling a device, make sure all paired devices are re-paired.
    
    We re-pair them with the VCP, not a real device! If we would do otherwise,
    somebody may change our keyboard focus and thus get us typing where we don't
    want to type.

diff --git a/dix/devices.c b/dix/devices.c
index 7cf82ee..59404e9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -252,7 +252,7 @@ EnableDevice(DeviceIntPtr dev)
 Bool
 DisableDevice(DeviceIntPtr dev)
 {
-    DeviceIntPtr *prev;
+    DeviceIntPtr *prev, paired;
     DeviceIntRec dummyDev;
     devicePresenceNotify ev;
 
@@ -268,6 +268,16 @@ DisableDevice(DeviceIntPtr dev)
     dev->next = inputInfo.off_devices;
     inputInfo.off_devices = dev;
 
+    /* Some other device may have been paired with this device. 
+       Re-pair with VCP. We don't repair with a real device, as this
+       may cause somebody suddenly typing where they shouldn't. 
+     */
+    for (paired = inputInfo.devices; paired; paired = paired->next)
+    {
+        if (paired->spriteInfo->paired == dev)
+            PairDevices(NULL, inputInfo.pointer, paired);
+    }
+
     ev.type = DevicePresenceNotify;
     ev.time = currentTime.milliseconds;
     ev.devchange = DeviceDisabled;


More information about the xorg-commit mailing list