[PATCH libinput 5/5] touchpad: don't post 2fg scrolling when edge scrolling is enabled

Peter Hutterer peter.hutterer at who-t.net
Mon Apr 20 22:28:40 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=90070

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-gestures.c |  6 ++++++
 test/touchpad.c                  | 21 +++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index e01b921..d332186 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -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);
diff --git a/test/touchpad.c b/test/touchpad.c
index 88ae2b1..f3d2e6a 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -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);
-- 
2.3.5



More information about the wayland-devel mailing list