Commit 09436fb7 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

Disable devices before removing, remove unrecoverable devices.

parent c7e2ba0c
...@@ -577,6 +577,7 @@ RemoveDevice(DeviceIntPtr dev) ...@@ -577,6 +577,7 @@ RemoveDevice(DeviceIntPtr dev)
return BadImplementation; return BadImplementation;
deviceid = dev->id; deviceid = dev->id;
DisableDevice(dev);
prev = NULL; prev = NULL;
for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) { for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) {
......
...@@ -771,11 +771,30 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) ...@@ -771,11 +771,30 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum)
* Device will be moved to the off_devices list, but it will still be there * Device will be moved to the off_devices list, but it will still be there
* until you really clean up after it. * until you really clean up after it.
* Notifies the client about an inactive device. * Notifies the client about an inactive device.
*
* @param panic True if device is unrecoverable and needs to be removed.
*/ */
_X_EXPORT void _X_EXPORT void
xf86DisableDevice(DeviceIntPtr dev) xf86DisableDevice(DeviceIntPtr dev, Bool panic)
{ {
DisableDevice(dev); devicePresenceNotify ev;
DeviceIntRec dummyDev;
if(!panic)
{
DisableDevice(dev);
} else
{
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceUnrecoverable;
ev.deviceid = dev->id;
dummyDev.id = 0;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
DeleteInputDeviceRequest(dev);
}
} }
/** /**
......
...@@ -187,7 +187,7 @@ void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, ...@@ -187,7 +187,7 @@ void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval,
void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum); void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum);
void xf86AddEnabledDevice(InputInfoPtr pInfo); void xf86AddEnabledDevice(InputInfoPtr pInfo);
void xf86RemoveEnabledDevice(InputInfoPtr pInfo); void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86DisableDevice(DeviceIntPtr dev); void xf86DisableDevice(DeviceIntPtr dev, Bool panic);
void xf86EnableDevice(DeviceIntPtr dev); void xf86EnableDevice(DeviceIntPtr dev);
/* xf86Helper.c */ /* xf86Helper.c */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment