diff --git a/dix/devices.c b/dix/devices.c index e8ca5dfa7..e227617ef 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -577,6 +577,7 @@ RemoveDevice(DeviceIntPtr dev) return BadImplementation; deviceid = dev->id; + DisableDevice(dev); prev = NULL; for (tmp = inputInfo.devices; tmp; (prev = tmp), (tmp = next)) { diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 0af1c6a59..2d0a37674 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -771,11 +771,30 @@ xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum) * Device will be moved to the off_devices list, but it will still be there * until you really clean up after it. * Notifies the client about an inactive device. + * + * @param panic True if device is unrecoverable and needs to be removed. */ _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); + } } /** diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index f5beb6c94..7ef28ed73 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -187,7 +187,7 @@ void xf86InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, void xf86InitValuatorDefaults(DeviceIntPtr dev, int axnum); void xf86AddEnabledDevice(InputInfoPtr pInfo); void xf86RemoveEnabledDevice(InputInfoPtr pInfo); -void xf86DisableDevice(DeviceIntPtr dev); +void xf86DisableDevice(DeviceIntPtr dev, Bool panic); void xf86EnableDevice(DeviceIntPtr dev); /* xf86Helper.c */