summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-05-20 14:29:13 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-05-20 16:22:24 +1000
commitc2785ae7eb6197bbfc75e92e99fffbb8ad8064da (patch)
treeec33f3304536631c08c30c4f7b5d476f10bc1c16
parent47a89b1cba67a43ddc225f7e1b5d2b3b217c8d93 (diff)
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>
-rw-r--r--dix/getevents.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 30b2c69b6..2f6153736 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -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;