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

Jasper St. Pierre jstpierre at mecheye.net
Fri May 23 08:00:57 PDT 2014


Any reason you switched the order of these two if statements around?


On Fri, May 23, 2014 at 10:06 AM, Hans de Goede <hdegoede at redhat.com> 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.
>
> 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
>



-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20140523/ccb432b9/attachment.html>


More information about the wayland-devel mailing list