[PATCH libinput] touchpad: Drop the scroll direction lock, increase threshold instead

Hans de Goede hdegoede at redhat.com
Wed Jun 4 02:49:43 PDT 2014


Hi,

On 06/04/2014 06:09 AM, Peter Hutterer wrote:
> The direction lock was intended to avoid erroneous horizontal scroll events
> when scrolling vertically (and vice versa). Some testing on my touchpad here
> shows that it is too easy to accidentally lock the direction when no lock is
> intended (e.g. moving around an image). And quite hard to figure out what a
> pure vertical gesture is.
> 
> I get movements from 90 degrees to 70 degrees for something my brain would
> consider vertical scrolling. Depending on the hand position, the fingers
> actually perform a slight curve, not a straight line.
> 
> Hence - drop the direction lock, but increase the threshold a little. It
> doesn't totally avoid horizontal scroll events but keeps them minimal.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Ok, I give up. I thought I could find a simple way of locking the scroll
> directions but I ran out of time and the simplest approach didn't work that
> greatly.
> 
> This patch replaces 5 and 6 of this series (the ones I never pushed)

Thanks, looks good:

Reviewed-by: Hans de Goede <hdegoede at redhat.com>

Regards,

Hans


> 
>  src/evdev-mt-touchpad.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
> index 26d5f7d..466cf5e 100644
> --- a/src/evdev-mt-touchpad.c
> +++ b/src/evdev-mt-touchpad.c
> @@ -463,21 +463,18 @@ tp_post_twofinger_scroll(struct tp_dispatch *tp, uint64_t time)
>  
>  	tp_filter_motion(tp, &dx, &dy, 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);
> -		}
> -
> -		if (tp->scroll.state == SCROLL_STATE_NONE)
> -			return;
> +	/* Require at least three px scrolling to start */
> +	if (dy <= -3.0 || dy >= 3.0) {
> +		tp->scroll.state = SCROLL_STATE_SCROLLING;
> +		tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL);
>  	}
> +	if (dx <= -3.0 || dx >= 3.0) {
> +		tp->scroll.state = SCROLL_STATE_SCROLLING;
> +		tp->scroll.direction |= (1 << LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL);
> +	}
> +
> +	if (tp->scroll.state == SCROLL_STATE_NONE)
> +		return;
>  
>  	/* Stop spurious MOTION events at the end of scrolling */
>  	tp_for_each_touch(tp, t)
> 


More information about the wayland-devel mailing list