touchpad: don't post 2fg scrolling when edge scrolling is enabled
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 21 Apr 2015 02:07:55 +0000 (12:07 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 21 Apr 2015 07:59:12 +0000 (17:59 +1000)
https://bugs.freedesktop.org/show_bug.cgi?id=90070

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev-mt-touchpad-gestures.c
test/touchpad.c

index e01b9218fef7eece787970c32b36067461d2606b..d332186b9ba9168f2f2868dcef450eb4009481a9 100644 (file)
@@ -110,6 +110,9 @@ tp_gesture_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
 {
        struct normalized_coords delta;
 
+       if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
+               return;
+
        delta = tp_get_average_touches_delta(tp);
        delta = tp_filter_motion(tp, &delta, time);
 
@@ -153,6 +156,9 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
 void
 tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
 {
+       if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
+               return;
+
        evdev_stop_scroll(tp->device,
                          time,
                          LIBINPUT_POINTER_AXIS_SOURCE_FINGER);
index 88ae2b16add036165f06bcc3973e40b7fdacd179..f3d2e6a28c586b8c77814aa7d59c989f61af6e9a 100644 (file)
@@ -2821,6 +2821,26 @@ START_TEST(touchpad_edge_scroll_source)
 }
 END_TEST
 
+START_TEST(touchpad_edge_scroll_no_2fg)
+{
+       struct litest_device *dev = litest_current_device();
+       struct libinput *li = dev->libinput;
+
+       litest_drain_events(li);
+       enable_edge_scroll(dev);
+
+       litest_touch_down(dev, 0, 20, 20);
+       litest_touch_down(dev, 1, 40, 20);
+       litest_touch_move_two_touches(dev, 20, 20, 40, 20, 20, 30, 10, 3);
+       libinput_dispatch(li);
+       litest_touch_up(dev, 0);
+       litest_touch_up(dev, 1);
+       libinput_dispatch(li);
+
+       litest_assert_empty_queue(li);
+}
+END_TEST
+
 START_TEST(touchpad_tap_is_available)
 {
        struct litest_device *dev = litest_current_device();
@@ -4143,6 +4163,7 @@ int main(int argc, char **argv) {
        litest_add("touchpad:scroll", touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD, LITEST_CLICKPAD);
        litest_add("touchpad:scroll", touchpad_edge_scroll_timeout, LITEST_TOUCHPAD, LITEST_CLICKPAD);
        litest_add("touchpad:scroll", touchpad_edge_scroll_source, LITEST_TOUCHPAD, LITEST_CLICKPAD);
+       litest_add("touchpad:scroll", touchpad_edge_scroll_no_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD);
 
        litest_add("touchpad:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY);
        litest_add("touchpad:palm", touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD);