From c2785ae7eb6197bbfc75e92e99fffbb8ad8064da Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 May 2009 14:29:13 +1000 Subject: [PATCH] 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 --- dix/getevents.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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;