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.brachac...@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 dix/eventconvert.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 4e3de0b..0f747c1 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:
-- 
1.7.2.1

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to