From: Neil Roberts Date: Fri, 20 Sep 2013 14:03:29 +0000 (+0100) Subject: evdev: Flush motion events when the slot changes, not just after sync X-Git-Tag: 0.1.0~163^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3023f5d0ac71798d83fc9f6755c88e40abbb9dc;p=platform%2Fupstream%2Flibinput.git evdev: Flush motion events when the slot changes, not just after sync If two fingers are released almost simultaneously then evdev can send the touch up events in one bunch without sending a sync event in-between. However, the evdev_device struct only keeps track of one pending touch up event so in this case the second touch up event would override the first and it would be lost. This patch changes it to also flush the events whenever the slot changes so that it will flush the previous touch up event before trying to queue the next one. https://bugs.freedesktop.org/show_bug.cgi?id=67563 --- diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c index 600df07..aa9df62 100644 --- a/src/evdev-touchpad.c +++ b/src/evdev-touchpad.c @@ -493,7 +493,7 @@ touchpad_update_state(struct touchpad_dispatch *touchpad, uint32_t time) touchpad->device->rel.dx = wl_fixed_from_double(dx); touchpad->device->rel.dy = wl_fixed_from_double(dy); touchpad->device->pending_events |= - EVDEV_RELATIVE_MOTION | EVDEV_SYN; + EVDEV_RELATIVE_MOTION | EVDEV_SYN_OR_SLOT; } else if (touchpad->finger_state == TOUCHPAD_FINGERS_TWO) { if (dx != 0.0) notify_axis(touchpad->device->seat, diff --git a/src/evdev.c b/src/evdev.c index 2367d56..3ccdd3c 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -110,6 +110,7 @@ evdev_process_touch(struct evdev_device *device, struct input_event *e) switch (e->code) { case ABS_MT_SLOT: device->mt.slot = e->value; + device->pending_events |= EVDEV_SYN_OR_SLOT; break; case ABS_MT_TRACKING_ID: if (e->value >= 0) @@ -261,11 +262,11 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time) int32_t cx, cy; int slot; - if (!(device->pending_events & EVDEV_SYN)) + if (!(device->pending_events & EVDEV_SYN_OR_SLOT)) return; slot = device->mt.slot; - device->pending_events &= ~EVDEV_SYN; + device->pending_events &= ~EVDEV_SYN_OR_SLOT; if (device->pending_events & EVDEV_RELATIVE_MOTION) { notify_motion(master, time, device->rel.dx, device->rel.dy); device->pending_events &= ~EVDEV_RELATIVE_MOTION; @@ -332,7 +333,7 @@ fallback_process(struct evdev_dispatch *dispatch, evdev_process_key(device, event, time); break; case EV_SYN: - device->pending_events |= EVDEV_SYN; + device->pending_events |= EVDEV_SYN_OR_SLOT; break; } } diff --git a/src/evdev.h b/src/evdev.h index 524fa22..7edcce6 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -36,7 +36,7 @@ enum evdev_event_type { EVDEV_ABSOLUTE_MT_MOTION = (1 << 2), EVDEV_ABSOLUTE_MT_UP = (1 << 3), EVDEV_RELATIVE_MOTION = (1 << 4), - EVDEV_SYN = (1 << 5), + EVDEV_SYN_OR_SLOT = (1 << 5), }; enum evdev_device_capability {