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.
This commit is contained in:
Peter Hutterer 2007-10-05 13:04:10 +09:30
parent ff2351246d
commit d42909b23a

View File

@ -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;