dix: refuse events from disabled devices.

If the device is disabled ("off"), it must not send events to a client.
The driver shouldn't send events in that case anyway, but just to make sure
we simply drop events coming while the device is disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-05-20 14:29:13 +10:00
parent 47a89b1cba
commit c2785ae7eb

View File

@ -835,6 +835,10 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
DeviceEvent *event;
RawDeviceEvent *raw;
/* refuse events from disabled devices */
if (!pDev->enabled)
return 0;
if (!events ||!pDev->key || !pDev->focus || !pDev->kbdfeed ||
(type != KeyPress && type != KeyRelease) ||
(key_code < 8 || key_code > 255))
@ -997,6 +1001,10 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
cx, cy; /* only screen coordinates */
ScreenPtr scr = miPointerGetScreen(pDev);
/* refuse events from disabled devices */
if (!pDev->enabled)
return 0;
ms = GetTimeInMillis(); /* before pointer update to help precision */
if (!scr || !pDev->valuator || first_valuator < 0 ||
@ -1096,6 +1104,10 @@ GetProximityEvents(EventList *events, DeviceIntPtr pDev, int type,
int num_events = 1;
DeviceEvent *event;
/* refuse events from disabled devices */
if (!pDev->enabled)
return 0;
/* Sanity checks. */
if (type != ProximityIn && type != ProximityOut)
return 0;