<div dir="auto">Darn, that's not what I wanted!<div dir="auto">This may take longer than I thought.</div><div dir="auto"><br></div><div dir="auto">Jiayi</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 29, 2017 4:42 PM, "Peter Hutterer" <<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Jan 27, 2017 at 09:46:49PM -0500, Jiayi Zhao wrote:<br>
> [libinput]<br>
> natural_scroll=true<br>
><br>
> CHANGES:<br>
>  - libinput_device_config_scroll_<wbr>has_natural_scroll() is no longer compared to != 0<br>
>  - added configuration option to weston.ini man page<br>
><br>
> Signed-off-by: Jiayi Zhao <<a href="mailto:jeff.no.zhao@gmail.com">jeff.no.zhao@gmail.com</a>><br>
> ---<br>
>  compositor/main.c  | 13 +++++++++++++<br>
>  man/weston.ini.man |  3 +++<br>
>  <a href="http://weston.ini.in" rel="noreferrer" target="_blank">weston.ini.in</a>      |  1 +<br>
>  3 files changed, 17 insertions(+)<br>
><br>
> diff --git a/compositor/main.c b/compositor/main.c<br>
> index 4bd6e68..84bb8dd 100644<br>
> --- a/compositor/main.c<br>
> +++ b/compositor/main.c<br>
> @@ -1133,6 +1133,8 @@ configure_input_device(struct weston_compositor *compositor,<br>
>       struct weston_config *config = wet_get_config(compositor);<br>
>       int enable_tap;<br>
>       int enable_tap_default;<br>
> +     int natural_scroll;<br>
> +     int natural_scroll_default;<br>
><br>
>       s = weston_config_get_section(<wbr>config,<br>
>                                     "libinput", NULL, NULL);<br>
> @@ -1147,6 +1149,17 @@ configure_input_device(struct weston_compositor *compositor,<br>
>               libinput_device_config_tap_<wbr>set_enabled(device,<br>
>                                                      enable_tap);<br>
>       }<br>
> +<br>
> +     if (libinput_device_config_<wbr>scroll_has_natural_scroll(<wbr>device)) {<br>
> +             natural_scroll_default =<br>
> +                     libinput_device_config_scroll_<wbr>get_default_natural_scroll_<wbr>enabled(<br>
> +                             device);<br>
> +             weston_config_section_get_<wbr>bool(s, "natural_scroll",<br>
> +                                             &natural_scroll,<br>
> +                                             natural_scroll_default);<br>
> +             libinput_device_config_scroll_<wbr>set_natural_scroll_enabled(<wbr>device,<br>
> +                                                     natural_scroll);<br>
> +     }<br>
<br>
libinput exposes natural scrolling on mice as well and with this code<br>
you're enabling it on any device that has the option. so your mouse<br>
wheels will be upside down too when you enable this. That's probably not<br>
what you intended, but if so, prepare for angry emails :)<br>
<br>
there are two options to work around this:<br>
* check the udev device for ID_INPUT_TOUCHPAD<br>
* assume anything that has tapping is a touchpad<br>
<br>
Cheers,<br>
   Peter<br>
<br>
>  }<br>
><br>
>  static void<br>
> diff --git a/man/weston.ini.man b/man/weston.ini.man<br>
> index 2edb085..62e0f92 100644<br>
> --- a/man/weston.ini.man<br>
> +++ b/man/weston.ini.man<br>
> @@ -187,6 +187,9 @@ Available configuration are:<br>
>  .TP 7<br>
>  .BI "enable_tap=" true<br>
>  enables tap to click on touchpad devices<br>
> +.TP 7<br>
> +.BI "natural_scroll=" true<br>
> +enables natural scrolling on touchpad devices<br>
>  .RS<br>
>  .PP<br>
><br>
> diff --git a/<a href="http://weston.ini.in" rel="noreferrer" target="_blank">weston.ini.in</a> b/<a href="http://weston.ini.in" rel="noreferrer" target="_blank">weston.ini.in</a><br>
> index 257c4ec..f957ec6 100644<br>
> --- a/<a href="http://weston.ini.in" rel="noreferrer" target="_blank">weston.ini.in</a><br>
> +++ b/<a href="http://weston.ini.in" rel="noreferrer" target="_blank">weston.ini.in</a><br>
> @@ -61,6 +61,7 @@ path=@libexecdir@/weston-<wbr>keyboard<br>
><br>
>  #[libinput]<br>
>  #enable_tap=true<br>
> +#natural_scroll=false<br>
><br>
>  #[touchpad]<br>
>  #constant_accel_factor = 50<br>
> --<br>
> 2.10.2<br>
><br>
> ______________________________<wbr>_________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.<wbr>freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/wayland-devel</a><br>
><br>
</blockquote></div></div>