touchpad: Only use slot 0 deltas for 2fg scrolling on semi-mt touchpads

Some semi-mt model touchpads have a better accuracy for slot 0 then for
slot 1 (they only have 2), so on semi-mt models only use the movement of
the touch in slot 0 for 2fg scrolling, rather then the average movement of
the 2 touches.

This fixes 2fg scrolling being choppy / jumpy in some cases.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89683
Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Also needed: change the touchpad scroll source test to use more separate
events. The current litest semi-mt touch implementation only moves the first
touch on every second move. With 5 movements this isn't enough to fill the
motion history and generate events, so double it to 10 so we're guaranteed to
get scroll events.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Hans de Goede 2015-04-24 16:49:36 +02:00 committed by Peter Hutterer
parent 26ceea3e3b
commit 07b20dcce6
2 changed files with 12 additions and 2 deletions

View file

@ -113,7 +113,17 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
return;
delta = tp_get_average_touches_delta(tp);
/* On some semi-mt models slot 0 is more accurate, so for semi-mt
* we only use slot 0. */
if (tp->semi_mt) {
if (!tp->touches[0].dirty)
return;
delta = tp_get_delta(&tp->touches[0]);
} else {
delta = tp_get_average_touches_delta(tp);
}
delta = tp_filter_motion(tp, &delta, time);
if (normalized_is_zero(delta))

View file

@ -2464,7 +2464,7 @@ test_2fg_scroll(struct litest_device *dev, double dx, double dy, int want_sleep)
litest_touch_down(dev, 0, 49, 50);
litest_touch_down(dev, 1, 51, 50);
litest_touch_move_two_touches(dev, 49, 50, 51, 50, dx, dy, 5, 0);
litest_touch_move_two_touches(dev, 49, 50, 51, 50, dx, dy, 10, 0);
/* Avoid a small scroll being seen as a tap */
if (want_sleep) {