From: Satyeshwar Singh Date: Wed, 27 Feb 2013 20:26:23 +0000 (-0500) Subject: evdev: Wait for SYN event before sending events over to the client X-Git-Tag: 0.1.0~163^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3e195bd271eba7064eba4a1e5b04edcc34390c5;p=platform%2Fupstream%2Flibinput.git evdev: Wait for SYN event before sending events over to the client The issue was that touch::down event from the compositor to client apps would send the previous motion events coordinates and this obviously made the client do the wrong thing. This happened because we were not waiting for a SYN event to come from evdev before sending down, motion or up events. https://bugs.freedesktop.org/show_bug.cgi?id=51909 --- diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c index 73c04eb..c25a199 100644 --- a/src/evdev-touchpad.c +++ b/src/evdev-touchpad.c @@ -481,7 +481,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_RELATIVE_MOTION | EVDEV_SYN; } 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 286543a..a1fa01f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -249,9 +249,10 @@ evdev_flush_motion(struct evdev_device *device, uint32_t time) { struct weston_seat *master = device->seat; - if (!device->pending_events) + if (!(device->pending_events & EVDEV_SYN)) return; + device->pending_events &= ~EVDEV_SYN; if (device->pending_events & EVDEV_RELATIVE_MOTION) { notify_motion(master, time, master->seat.pointer->x + device->rel.dx, @@ -308,6 +309,9 @@ fallback_process(struct evdev_dispatch *dispatch, case EV_KEY: evdev_process_key(device, event, time); break; + case EV_SYN: + device->pending_events |= EVDEV_SYN; + break; } } diff --git a/src/evdev.h b/src/evdev.h index ccbb222..eb5c868 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -34,6 +34,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), }; enum evdev_device_capability {