diff options
author | Chase Douglas <chase.douglas@canonical.com> | 2011-11-18 10:29:47 -0800 |
---|---|---|
committer | Chase Douglas <chase.douglas@canonical.com> | 2011-11-28 17:33:42 -0800 |
commit | 2647cdbba8d0664243833182589b5aa7a9b496f8 (patch) | |
tree | 903313d5e73897584fbabf9788351d43e0b3395f | |
parent | 209f8d27a896eaee0d44ed351ae612a5a3a77e14 (diff) |
Only send pointer emulated motion events for touch begin once
The initial motion event occurs before a potential passive grab
activation, and thus should never be sent twice.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
-rw-r--r-- | dix/eventconvert.c | 12 | ||||
-rw-r--r-- | include/input.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 9423ec3c7..a92cb7a91 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -328,6 +328,18 @@ TouchToMotion(DeviceIntPtr dev, InternalEvent *ev, enum InputLevel level, ev->any.type != ET_TouchEnd) return BadMatch; + /* Only deliver an initial motion event once. The first motion event comes + * before the button press event, which may cause a passive grab to + * activate. Further pointer emulated motion events may be replayed multiple + * times due to pointer passive grabs. */ + if (ev->any.type == ET_TouchBegin) + { + if (ev->device_event.flags & TOUCH_BEGIN_MOTION_SENT) + return Success; + else + ev->device_event.flags |= TOUCH_BEGIN_MOTION_SENT; + } + /* Don't generate events if no valuators have changed values */ if (countValuators(&ev->device_event, &first) == 0) return Success; diff --git a/include/input.h b/include/input.h index 60cdee7e5..11241903c 100644 --- a/include/input.h +++ b/include/input.h @@ -78,6 +78,7 @@ SOFTWARE. #define TOUCH_CLIENT_ID (1 << 3) /* touch ID is the client-visible id */ #define TOUCH_REPLAYING (1 << 4) /* event is being replayed */ #define TOUCH_POINTER_EMULATED (1 << 5) /* touch event may be pointer emulated */ +#define TOUCH_BEGIN_MOTION_SENT (1 << 6) /* Pointer emulated motion event already sent */ /*int constants for pointer acceleration schemes*/ #define PtrAccelNoOp 0 |