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:
		
							parent
							
								
									ff2351246d
								
							
						
					
					
						commit
						d42909b23a
					
				| 
						 | 
					@ -252,7 +252,7 @@ EnableDevice(DeviceIntPtr dev)
 | 
				
			||||||
Bool
 | 
					Bool
 | 
				
			||||||
DisableDevice(DeviceIntPtr dev)
 | 
					DisableDevice(DeviceIntPtr dev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DeviceIntPtr *prev;
 | 
					    DeviceIntPtr *prev, paired;
 | 
				
			||||||
    DeviceIntRec dummyDev;
 | 
					    DeviceIntRec dummyDev;
 | 
				
			||||||
    devicePresenceNotify ev;
 | 
					    devicePresenceNotify ev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -268,6 +268,16 @@ DisableDevice(DeviceIntPtr dev)
 | 
				
			||||||
    dev->next = inputInfo.off_devices;
 | 
					    dev->next = inputInfo.off_devices;
 | 
				
			||||||
    inputInfo.off_devices = dev;
 | 
					    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.type = DevicePresenceNotify;
 | 
				
			||||||
    ev.time = currentTime.milliseconds;
 | 
					    ev.time = currentTime.milliseconds;
 | 
				
			||||||
    ev.devchange = DeviceDisabled;
 | 
					    ev.devchange = DeviceDisabled;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue