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

Jonas Ådahl jadahl at gmail.com
Sun May 25 01:34:31 PDT 2014


On Fri, May 23, 2014 at 04:06:26PM +0200, Hans de Goede wrote:
> 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.

Is this really the case? Personally I expect to be able to scroll both
horizontally and vertically at the same time, for example for scrolling
around in a large photograph, and this is already how it works with the
current synaptics driver in X.

Jonas

> 
> 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
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list