Bug 51909

Summary: [bug] wl_touch::down event has wrong coordinates
Product: Wayland Reporter: Pekka Paalanen <ppaalanen>
Component: westonAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Pekka Paalanen 2012-07-09 13:34:33 UTC
By tracing simple-touch client on Android, Galaxy Nexus touchscreen, I see:

[2275673.175] wl_touch@7.down(0, 252776, wl_surface@6, 0, 123.000000, 194.000000)
[2275673.724] wl_touch@7.motion(252777, 0, 482.000000, 362.000000)
[2275771.437] wl_touch@7.motion(252875, 0, 480.000000, 362.000000)
[2275830.500] wl_touch@7.motion(252934, 0, 478.000000, 360.000000)
[2275909.090] wl_touch@7.motion(253013, 0, 477.000000, 358.000000)
[2276262.972] wl_touch@7.motion(253366, 0, 475.000000, 358.000000)
[2276377.413] wl_touch@7.up(0, 253481, 0)
[2278921.704] wl_touch@7.down(0, 256025, wl_surface@6, 0, 475.000000, 358.000000)
[2278922.254] wl_touch@7.motion(256025, 0, 130.000000, 371.000000)
[2279177.370] wl_touch@7.motion(256281, 0, 128.000000, 371.000000)
[2279235.597] wl_touch@7.motion(256339, 0, 126.000000, 371.000000)
[2279459.627] wl_touch@7.up(0, 256563, 0)

Only wl_touch events are listed above.

The coordinates to wl_touch:down seem to be the coordinates of the previous wl_touch:motion. This causes simple-touch to draw an extra mark at the old position.

This also causes the initial notify_touch(WL_TOUCH_DOWN) call to have wrong coordinates and therefore focus on a wrong surface. In practice, a surface needs to be tapped twice to actually give it touch focus.

I assume that the proper fix would be to make evdev.c react to SYN events, instead of only the heuristic buffering it does now.
Comment 1 Kristian Høgsberg 2013-02-28 03:03:38 UTC
commit 964a342e5367035b02104b54d340c37dfc1aada9
Author: Satyeshwar Singh <satyeshwar.singh@intel.com>
Date:   Wed Feb 27 15:26:23 2013 -0500

    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

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.