Bug 91475

Summary: Gestures vs scrolling on semi-mt touchpads
Product: Wayland Reporter: Mantas Mikulėnas <grawity>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: jwrdegoede, peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: evemu recording
evemu recording (pinch)

Description Mantas Mikulėnas 2015-07-27 16:46:14 UTC
As I learned in bug 91364, my old laptop has a semi-mt touchpad with insufficient resolution to quickly distinguish pinch from two-finger scroll. While the hwdb quirk improved it, a way to disable gesture support for semi-mt and regain precision scrolling would still be useful, as the latter is used much more frequently than pinch-zoom.
Comment 1 Peter Hutterer 2015-07-28 03:57:28 UTC
CC-ing Hans, he added the 4mm threshold and he has access to a semi-mt device.

fwiw, the problem is not the gesture detection itself but rather the low resolution on semi-mt touchpads when two fingers are down. That makes it harder to guess the direction they're moving and thus harder to distinguish between pinch and scroll. The main question here would be how to avoid false positives when we bias towards two-finger scrolling.
Comment 2 Hans de Goede 2015-07-29 09:25:31 UTC
Hi,

There are 2 ways to trigger 2 finger scrolling, move past the threshold, or wait a bit, atm the wait a bit threshold is set to 1s which seems quite long, we should maybe reduce that to allow finer grained scrolling by just holding the fingers still for the threshold and then moving them slowly.

Regards,

Hans
Comment 3 Hans de Goede 2015-07-29 12:00:05 UTC
Hi,

I discussed this a bit with Peter, the 4mm threshold is based on experience with alps touchpads, and we may need to deal with elantech semi-mt touchpads like yours differently.

We've come to the conclusion that we need to do one of 2 things for your touchpad depending on how accurate your touchpad is:

1) If it is accurate enough then we can lower the threshold for gesture detection to 2 mm which should solve your problem
2) If it is not accurate enough then we may end up simply disabling gestures on semi-mt elantech touchpads such as yours

Can you please install evemu, and run evemu-record on your touchpad and then create 2 recordings:

1) A (slow) vertical 2fg scroll gesture
2) A (slow) zoom-in pinch gesture

To do this first run sudo evemu-record without any cmdline options to see which device is your touchpad, then press control+c, then do:

sudo evemu-record /dev/input/event# > 2fg-scroll.log
-do scroll gesture, press ctrl+c
sudo evemu-record /dev/input/event# > pinch.log
-do pinch gesture, press ctrl+c

And then attach the 2 generated files here ?

Regards,

Hans
Comment 4 Mantas Mikulėnas 2015-07-29 12:17:34 UTC
Created attachment 117442 [details]
evemu recording
Comment 5 Mantas Mikulėnas 2015-07-29 12:19:13 UTC
Created attachment 117443 [details]
evemu recording (pinch)
Comment 6 Hans de Goede 2015-07-29 12:28:46 UTC
Hi,

Thanks for the recordings, the precision of the touchpad seems to be excellent with both gestures.

Can you try changing these lines in libinput/src/evdev-mt-touchpad-gestures.c (around line 200):

        /*
         * Semi-mt touchpads have somewhat inaccurate coordinates when
         * 2 fingers are down, so use a slightly larger threshold.
         */
        if (tp->semi_mt)
                move_threshold = TP_MM_TO_DPI_NORMALIZED(4);
        else
                move_threshold = TP_MM_TO_DPI_NORMALIZED(2);

To:

        move_threshold = TP_MM_TO_DPI_NORMALIZED(2);

Then re-build libinput, install the new version and see if that solves your 2fg scrolling problems?

Regards,

Hans
Comment 7 Mantas Mikulėnas 2015-07-29 17:50:43 UTC
(In reply to Hans de Goede from comment #6)
> Can you try changing these lines in
> libinput/src/evdev-mt-touchpad-gestures.c (around line 200):
> 
>         /*
>          * Semi-mt touchpads have somewhat inaccurate coordinates when
>          * 2 fingers are down, so use a slightly larger threshold.
>          */
>         if (tp->semi_mt)
>                 move_threshold = TP_MM_TO_DPI_NORMALIZED(4);
>         else
>                 move_threshold = TP_MM_TO_DPI_NORMALIZED(2);
> 
> To:
> 
>         move_threshold = TP_MM_TO_DPI_NORMALIZED(2);
> 
> Then re-build libinput, install the new version and see if that solves your
> 2fg scrolling problems?

Scrolling seems to be much better, yes. (Played with tools/event-gui, it still recognizes both scroll & pinch correctly.)
Comment 9 Peter Hutterer 2015-08-03 05:44:32 UTC
commit 2fdf71f82be4c57602e5b7a8b0c39cdfb49e3c38
Merge: cbc0b20 7013a20
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Aug 3 11:40:37 2015 +1000

    Merge branch 'disable-gestures-semi-mt'

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.