summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-08-17 12:08:52 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-11-10 11:13:48 +1000
commit79f2a58c323bd1ad373f1f929207b5af98031b95 (patch)
tree4a86c15eb0743f4b5f742f0bfb7024f2bfd3635a /dix
parente3769c20d5f656f76e2c475a722db97c58089260 (diff)
dix: don't create core motion events for non-x/y valuators.
Devices that send motion events with valuators other than x/y get core motion events with unchanged x/y coordinates. This confuses some applications. If the DeviceEvent does not have the x/y valuators set, return BadMatch on core conversion, thus skipping the event altogether. Reported-by: Bartosz Brachaczek <b.brachaczek@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Bartosz Brachaczek <b.brachaczek@gmail.com> (cherry picked from commit de8be07cc0a8163b6ef04455706fd5ca2cebe587)
Diffstat (limited to 'dix')
-rw-r--r--dix/eventconvert.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 4e3de0b46..0f747c1a0 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -102,6 +102,15 @@ EventToCore(InternalEvent *event, xEvent *core)
switch(event->any.type)
{
case ET_Motion:
+ {
+ DeviceEvent *e = &event->device_event;
+ /* Don't create core motion event if neither x nor y are
+ * present */
+ if (!BitIsOn(e->valuators.mask, 0) &&
+ !BitIsOn(e->valuators.mask, 1))
+ return BadMatch;
+ }
+ /* fallthrough */
case ET_ButtonPress:
case ET_ButtonRelease:
case ET_KeyPress: