<p dir="ltr">Hmm,</p>
<p dir="ltr">it says here that</p>
<p dir="ltr">libinput_device_config_scroll_has_natural_scroll()</p>
<p dir="ltr">returns a zero value if device does not support natural scrolling</p>
<p dir="ltr">and returns a non-zero value if it does support natural scrolling:</p>
<p dir="ltr"><a href="https://wayland.freedesktop.org/libinput/doc/latest/group__config.html#ga82d1aa961d2bb2f0c72c22e2441a4fc3">https://wayland.freedesktop.org/libinput/doc/latest/group__config.html#ga82d1aa961d2bb2f0c72c22e2441a4fc3</a></p>
<p dir="ltr">So I don't really know how I else I can program it.</p>
<p dir="ltr">On Oct 20, 2016 9:05 PM, "Peter Hutterer" <<a href="mailto:peter.hutterer@who-t.net">peter.hutterer@who-t.net</a>> wrote:<br>
</p>
<blockquote><p dir="ltr">><br>
</p>
</blockquote>
<p dir="ltr">> ></p>
<p dir="ltr">> On Thu, Oct 20, 2016 at 08:43:18PM -0400, Jiayi Zhao wrote:<br>
> > This adds support for enabling/disabling natural scrolling<br>
> > via a boolean in weston.ini:<br>
> ><br>
> > [libinput]<br>
> > natural_scroll=true<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>
> > <a href="http://weston.ini.in"> weston.ini.in</a>     |  1 +<br>
> >  2 files changed, 14 insertions(+)<br>
> ><br>
> > diff --git a/compositor/main.c b/compositor/main.c<br>
> > index 8028ec3..6cd2a25 100644<br>
> > --- a/compositor/main.c<br>
> > +++ b/compositor/main.c<br>
> > @@ -1095,6 +1095,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(config,<br>
> >                                     "libinput", NULL, NULL);<br>
> > @@ -1109,6 +1111,17 @@ configure_input_device(struct weston_compositor *compositor,<br>
> >               libinput_device_config_tap_set_enabled(device,<br>
> >                                                      enable_tap);<br>
> >       }<br>
> > +<br>
> > +     if (libinput_device_config_scroll_has_natural_scroll(device) != 0) {<br>
><br>
> libinput's *_has_* API is designed to return a boolean value, IMO you<br>
> shouldn't use the != 0 here.<br>
><br>
> > +             natural_scroll_default =<br>
> > +                     libinput_device_config_scroll_get_default_natural_scroll_enabled(<br>
> > +                             device);<br>
> > +             weston_config_section_get_bool(s, "natural_scroll",<br>
> > +                                            &natural_scroll,<br>
> > +                                            natural_scroll_default);<br>
> > +             libinput_device_config_scroll_set_natural_scroll_enabled(device,<br>
> > +                                                    natural_scroll);<br>
> > +     }<br>
> >  }<br>
> ><br>
> >  static void<br>
> > diff --git a/<a href="http://weston.ini.in">weston.ini.in</a> b/<a href="http://weston.ini.in">weston.ini.in</a><br>
> > index 14a4c0c..08f931a 100644<br>
> > --- a/<a href="http://weston.ini.in">weston.ini.in</a><br>
> > +++ b/<a href="http://weston.ini.in">weston.ini.in</a><br>
> > @@ -59,6 +59,7 @@ path=@libexecdir@/weston-keyboard<br>
> ><br>
> >  #[libinput]<br>
> >  #enable_tap=true<br>
> > +#natural_scroll=false<br>
><br>
> "enable_natural_scroll" is more precise<br>
><br>
> these are just nitpicks, the code itself looks fine, thanks.<br>
><br>
> Cheers,<br>
>    Peter<br>
><br>
> ><br>
> >  #[touchpad]<br>
> >  #constant_accel_factor = 50<br>
> > --<br>
> > 2.7.3<br>
</p>