[PATCH libinput 5/6] touchpad: Don't allow diagonal scrolling

Hans de Goede hdegoede at redhat.com
Fri May 23 07:06:26 PDT 2014


We pin scrolling to the initial direction, so a 2 finger scroll starting
in the vertical direction, will from then on only generate vertical scroll
events, and the same for horizontal.

But if the first 2 finger motion is diagonal, then we go into a diagonal
scrolling mode where we post both horizontal and vertical scrolling events.

This is inconsistent, if we want to allow both at the same time (which we
don;t), we should always allow both, not only when the first motion is
diagonal.

This commit fixes things so that if the initial motion is diagonal, we go
into vertical scrolling mode as that is what the user most likely wants.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 src/evdev-mt-touchpad.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index f28cd13..e7943f6 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -465,14 +465,12 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
 
 	if (tp->scroll.state == SCROLL_STATE_NONE) {
 		/* Require at least one px scrolling to start */
-		if (dx <= -1.0 || dx >= 1.0) {
-			tp->scroll.state = SCROLL_STATE_SCROLLING;
-			tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL);
-		}
-
 		if (dy <= -1.0 || dy >= 1.0) {
 			tp->scroll.state = SCROLL_STATE_SCROLLING;
 			tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL);
+		} else if (dx <= -1.0 || dx >= 1.0) {
+			tp->scroll.state = SCROLL_STATE_SCROLLING;
+			tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL);
 		}
 
 		if (tp->scroll.state == SCROLL_STATE_NONE)
-- 
1.9.3



More information about the wayland-devel mailing list