[PATCH] libinput: enable natural scroll for touchpad devices Enable by setting natural_scroll=true under [libinput] in weston.ini
Changes: - no longer affects all devices that support natural scroll, only for touchpad devices (devices that supports tap to click) Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> --- compositor/main.c | 13 + man/weston.ini.man | 3 +++ weston.ini.in | 1 + 3 files changed, 17 insertions(+) diff --git a/compositor/main.c b/compositor/main.c index 7feb4cb0..4b0dae0d 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1136,6 +1136,8 @@ configure_input_device(struct weston_compositor *compositor, struct weston_config *config = wet_get_config(compositor); int enable_tap; int enable_tap_default; + int natural_scroll; + int natural_scroll_default; s = weston_config_get_section(config, "libinput", NULL, NULL); @@ -1149,6 +1151,17 @@ configure_input_device(struct weston_compositor *compositor, enable_tap_default); libinput_device_config_tap_set_enabled(device, enable_tap); + + if (libinput_device_config_scroll_has_natural_scroll(device)) { + natural_scroll_default = + libinput_device_config_scroll_get_default_natural_scroll_enabled( + device); + weston_config_section_get_bool(s, "natural_scroll", + _scroll, + natural_scroll_default); + libinput_device_config_scroll_set_natural_scroll_enabled( + device, natural_scroll); + } } } diff --git a/man/weston.ini.man b/man/weston.ini.man index f237fd60..ce4dd2ee 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -200,6 +200,9 @@ Available configuration are: .TP 7 .BI "enable_tap=" true enables tap to click on touchpad devices +.TP 7 +.BI "natural_scroll=" true +enables natural scrolling on touchpad devices .RS .PP diff --git a/weston.ini.in b/weston.ini.in index 257c4ec4..f957ec6c 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -61,6 +61,7 @@ path=@libexecdir@/weston-keyboard #[libinput] #enable_tap=true +#natural_scroll=false #[touchpad] #constant_accel_factor = 50 -- 2.13.6 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[weston,v5] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini I've changed it so it only affects devices supporting tap-to-click (touchpads) instead of all devices supporting natural scroll. ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] [weston, v4] weston.ini: Add natural scroll support to weston.ini This adds support for enabling/disabling natural scrolling via a boolean in weston.ini:
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: compositor/weston-main.o: undefined reference to symbol 'udev_device_has_tag@@LIBUDEV_183' /usr/lib/libudev.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make[1]: *** [Makefile:4126: weston] Error 1 On Sun, Feb 5, 2017 at 7:30 PM, Jiayi Zhao <jeff.no.z...@gmail.com> wrote: > > Hmmm, after using udev_device_has_tag(udev_device, "ID_INPUT_TOUCHPAD"), > I'm getting linking errors. Quick google of this leads to: libraries on > the command line should be after the object files being compiled. > Is this a bug? > > On Sun, Feb 5, 2017 at 7:20 PM, Peter Hutterer <peter.hutte...@who-t.net> > wrote: > >> On Sun, Feb 05, 2017 at 07:13:04PM -0500, Jiayi Zhao wrote: >> > How would ID_INPUT_TOUCHPAD work? >> > I have something like udev_device_has_tag(udev_device, >> ID_INPUT_TOUCHPAD) >> > Unfortunately, I'm not sure where this constant is declared and its >> unable >> > to find the tag. :/ >> >> it's a udev property name, so use it as a string, not a #define. >> value is either 1 or 0, so you do need to check for validity. >> >> Cheers, >>Peter >> >> > On Jan 29, 2017 4:42 PM, "Peter Hutterer" <peter.hutte...@who-t.net> >> wrote: >> > >> > > On Fri, Jan 27, 2017 at 09:46:49PM -0500, Jiayi Zhao wrote: >> > > > [libinput] >> > > > natural_scroll=true >> > > > >> > > > CHANGES: >> > > > - libinput_device_config_scroll_has_natural_scroll() is no longer >> > > compared to != 0 >> > > > - added configuration option to weston.ini man page >> > > > >> > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> >> > > > --- >> > > > compositor/main.c | 13 + >> > > > man/weston.ini.man | 3 +++ >> > > > weston.ini.in | 1 + >> > > > 3 files changed, 17 insertions(+) >> > > > >> > > > diff --git a/compositor/main.c b/compositor/main.c >> > > > index 4bd6e68..84bb8dd 100644 >> > > > --- a/compositor/main.c >> > > > +++ b/compositor/main.c >> > > > @@ -1133,6 +1133,8 @@ configure_input_device(struct >> weston_compositor >> > > *compositor, >> > > > struct weston_config *config = wet_get_config(compositor); >> > > > int enable_tap; >> > > > int enable_tap_default; >> > > > + int natural_scroll; >> > > > + int natural_scroll_default; >> > > > >> > > > s = weston_config_get_section(config, >> > > > "libinput", NULL, NULL); >> > > > @@ -1147,6 +1149,17 @@ configure_input_device(struct >> weston_compositor >> > > *compositor, >> > > > libinput_device_config_tap_set_enabled(device, >> > > > enable_tap); >> > > > } >> > > > + >> > > > + if (libinput_device_config_scroll_has_natural_scroll(device)) >> { >> > > > + natural_scroll_default = >> > > > + libinput_device_config_ >> scroll_get_default_natural_ >> > > scroll_enabled( >> > > > + device); >> > > > + weston_config_section_get_bool(s, "natural_scroll", >> > > > + _scroll, >> > > > + >> natural_scroll_default); >> > > > + libinput_device_config_scroll_set_natural_scroll_ >> > > enabled(device, >> > > > + >> natural_scroll); >> > > > + } >> > > >> > > libinput exposes natural scrolling on mice as well and with this code >> > > you're enabling it on any device that has the option. so your mouse >> > > wheels will be upside down too when you enable this. That's probably >> not >> > > what you intended, but if so, prepare for angry emails :) >> > > >> > > there are two options to work around this: >> > > * check the udev device for ID_INPUT_TOUCHPAD >> > > * assume anything that has tapping is a touchpad >> > > >> > > Cheers, >> > >Peter >> > > >> >
Re: [PATCH] [weston, v4] weston.ini: Add natural scroll support to weston.ini This adds support for enabling/disabling natural scrolling via a boolean in weston.ini:
Hmmm, after using udev_device_has_tag(udev_device, "ID_INPUT_TOUCHPAD"), I'm getting linking errors. Quick google of this leads to: libraries on the command line should be after the object files being compiled. Is this a bug? On Sun, Feb 5, 2017 at 7:20 PM, Peter Hutterer <peter.hutte...@who-t.net> wrote: > On Sun, Feb 05, 2017 at 07:13:04PM -0500, Jiayi Zhao wrote: > > How would ID_INPUT_TOUCHPAD work? > > I have something like udev_device_has_tag(udev_device, > ID_INPUT_TOUCHPAD) > > Unfortunately, I'm not sure where this constant is declared and its > unable > > to find the tag. :/ > > it's a udev property name, so use it as a string, not a #define. > value is either 1 or 0, so you do need to check for validity. > > Cheers, >Peter > > > On Jan 29, 2017 4:42 PM, "Peter Hutterer" <peter.hutte...@who-t.net> > wrote: > > > > > On Fri, Jan 27, 2017 at 09:46:49PM -0500, Jiayi Zhao wrote: > > > > [libinput] > > > > natural_scroll=true > > > > > > > > CHANGES: > > > > - libinput_device_config_scroll_has_natural_scroll() is no longer > > > compared to != 0 > > > > - added configuration option to weston.ini man page > > > > > > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> > > > > --- > > > > compositor/main.c | 13 + > > > > man/weston.ini.man | 3 +++ > > > > weston.ini.in | 1 + > > > > 3 files changed, 17 insertions(+) > > > > > > > > diff --git a/compositor/main.c b/compositor/main.c > > > > index 4bd6e68..84bb8dd 100644 > > > > --- a/compositor/main.c > > > > +++ b/compositor/main.c > > > > @@ -1133,6 +1133,8 @@ configure_input_device(struct weston_compositor > > > *compositor, > > > > struct weston_config *config = wet_get_config(compositor); > > > > int enable_tap; > > > > int enable_tap_default; > > > > + int natural_scroll; > > > > + int natural_scroll_default; > > > > > > > > s = weston_config_get_section(config, > > > > "libinput", NULL, NULL); > > > > @@ -1147,6 +1149,17 @@ configure_input_device(struct > weston_compositor > > > *compositor, > > > > libinput_device_config_tap_set_enabled(device, > > > > enable_tap); > > > > } > > > > + > > > > + if (libinput_device_config_scroll_has_natural_scroll(device)) > { > > > > + natural_scroll_default = > > > > + libinput_device_config_scroll_ > get_default_natural_ > > > scroll_enabled( > > > > + device); > > > > + weston_config_section_get_bool(s, "natural_scroll", > > > > + _scroll, > > > > + > natural_scroll_default); > > > > + libinput_device_config_scroll_set_natural_scroll_ > > > enabled(device, > > > > + > natural_scroll); > > > > + } > > > > > > libinput exposes natural scrolling on mice as well and with this code > > > you're enabling it on any device that has the option. so your mouse > > > wheels will be upside down too when you enable this. That's probably > not > > > what you intended, but if so, prepare for angry emails :) > > > > > > there are two options to work around this: > > > * check the udev device for ID_INPUT_TOUCHPAD > > > * assume anything that has tapping is a touchpad > > > > > > Cheers, > > >Peter > > > > > > > } > > > > > > > > static void > > > > diff --git a/man/weston.ini.man b/man/weston.ini.man > > > > index 2edb085..62e0f92 100644 > > > > --- a/man/weston.ini.man > > > > +++ b/man/weston.ini.man > > > > @@ -187,6 +187,9 @@ Available configuration are: > > > > .TP 7 > > > > .BI "enable_tap=" true > > > > enables tap to click on touchpad devices > > > > +.TP 7 > > > > +.BI "natural_scroll=" true > > > > +enables natural scrolling on touchpad devices > > > > .RS > > > > .PP > > > > > > > > diff --git a/weston.ini.in b/weston.ini.in > > > > index 257c4ec..f957ec6 100644 > > > > --- a/weston.ini.in > > > > +++ b/weston.ini.in > > > > @@ -61,6 +61,7 @@ path=@libexecdir@/weston-keyboard > > > > > > > > #[libinput] > > > > #enable_tap=true > > > > +#natural_scroll=false > > > > > > > > #[touchpad] > > > > #constant_accel_factor = 50 > > > > -- > > > > 2.10.2 > > > > > > > > ___ > > > > wayland-devel mailing list > > > > wayland-devel@lists.freedesktop.org > > > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel > > > > > > > > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] [weston, v4] weston.ini: Add natural scroll support to weston.ini This adds support for enabling/disabling natural scrolling via a boolean in weston.ini:
Darn, that's not what I wanted! This may take longer than I thought. Jiayi On Jan 29, 2017 4:42 PM, "Peter Hutterer" <peter.hutte...@who-t.net> wrote: > On Fri, Jan 27, 2017 at 09:46:49PM -0500, Jiayi Zhao wrote: > > [libinput] > > natural_scroll=true > > > > CHANGES: > > - libinput_device_config_scroll_has_natural_scroll() is no longer > compared to != 0 > > - added configuration option to weston.ini man page > > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> > > --- > > compositor/main.c | 13 + > > man/weston.ini.man | 3 +++ > > weston.ini.in | 1 + > > 3 files changed, 17 insertions(+) > > > > diff --git a/compositor/main.c b/compositor/main.c > > index 4bd6e68..84bb8dd 100644 > > --- a/compositor/main.c > > +++ b/compositor/main.c > > @@ -1133,6 +1133,8 @@ configure_input_device(struct weston_compositor > *compositor, > > struct weston_config *config = wet_get_config(compositor); > > int enable_tap; > > int enable_tap_default; > > + int natural_scroll; > > + int natural_scroll_default; > > > > s = weston_config_get_section(config, > > "libinput", NULL, NULL); > > @@ -1147,6 +1149,17 @@ configure_input_device(struct weston_compositor > *compositor, > > libinput_device_config_tap_set_enabled(device, > > enable_tap); > > } > > + > > + if (libinput_device_config_scroll_has_natural_scroll(device)) { > > + natural_scroll_default = > > + libinput_device_config_scroll_ > get_default_natural_scroll_enabled( > > + device); > > + weston_config_section_get_bool(s, "natural_scroll", > > + _scroll, > > + natural_scroll_default); > > + libinput_device_config_scroll_set_natural_scroll_enabled( > device, > > + natural_scroll); > > + } > > libinput exposes natural scrolling on mice as well and with this code > you're enabling it on any device that has the option. so your mouse > wheels will be upside down too when you enable this. That's probably not > what you intended, but if so, prepare for angry emails :) > > there are two options to work around this: > * check the udev device for ID_INPUT_TOUCHPAD > * assume anything that has tapping is a touchpad > > Cheers, >Peter > > > } > > > > static void > > diff --git a/man/weston.ini.man b/man/weston.ini.man > > index 2edb085..62e0f92 100644 > > --- a/man/weston.ini.man > > +++ b/man/weston.ini.man > > @@ -187,6 +187,9 @@ Available configuration are: > > .TP 7 > > .BI "enable_tap=" true > > enables tap to click on touchpad devices > > +.TP 7 > > +.BI "natural_scroll=" true > > +enables natural scrolling on touchpad devices > > .RS > > .PP > > > > diff --git a/weston.ini.in b/weston.ini.in > > index 257c4ec..f957ec6 100644 > > --- a/weston.ini.in > > +++ b/weston.ini.in > > @@ -61,6 +61,7 @@ path=@libexecdir@/weston-keyboard > > > > #[libinput] > > #enable_tap=true > > +#natural_scroll=false > > > > #[touchpad] > > #constant_accel_factor = 50 > > -- > > 2.10.2 > > > > ___ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel > > > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] [weston, v4] weston.ini: Add natural scroll support to weston.ini This adds support for enabling/disabling natural scrolling via a boolean in weston.ini:
[libinput] natural_scroll=true CHANGES: - libinput_device_config_scroll_has_natural_scroll() is no longer compared to != 0 - added configuration option to weston.ini man page Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> --- compositor/main.c | 13 + man/weston.ini.man | 3 +++ weston.ini.in | 1 + 3 files changed, 17 insertions(+) diff --git a/compositor/main.c b/compositor/main.c index 4bd6e68..84bb8dd 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1133,6 +1133,8 @@ configure_input_device(struct weston_compositor *compositor, struct weston_config *config = wet_get_config(compositor); int enable_tap; int enable_tap_default; + int natural_scroll; + int natural_scroll_default; s = weston_config_get_section(config, "libinput", NULL, NULL); @@ -1147,6 +1149,17 @@ configure_input_device(struct weston_compositor *compositor, libinput_device_config_tap_set_enabled(device, enable_tap); } + + if (libinput_device_config_scroll_has_natural_scroll(device)) { + natural_scroll_default = + libinput_device_config_scroll_get_default_natural_scroll_enabled( + device); + weston_config_section_get_bool(s, "natural_scroll", + _scroll, + natural_scroll_default); + libinput_device_config_scroll_set_natural_scroll_enabled(device, + natural_scroll); + } } static void diff --git a/man/weston.ini.man b/man/weston.ini.man index 2edb085..62e0f92 100644 --- a/man/weston.ini.man +++ b/man/weston.ini.man @@ -187,6 +187,9 @@ Available configuration are: .TP 7 .BI "enable_tap=" true enables tap to click on touchpad devices +.TP 7 +.BI "natural_scroll=" true +enables natural scrolling on touchpad devices .RS .PP diff --git a/weston.ini.in b/weston.ini.in index 257c4ec..f957ec6 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -61,6 +61,7 @@ path=@libexecdir@/weston-keyboard #[libinput] #enable_tap=true +#natural_scroll=false #[touchpad] #constant_accel_factor = 50 -- 2.10.2 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[no subject]
This latest patch (v4) adds documentation for the new natural_scoll option in weston.ini via the weston.ini.man man page. Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] [weston, v2] weston.ini: Add natural scroll support to weston.ini
Hey, okay, I'll make a new patch with updated weston.ini manual soon. Cheers, Jiayi On Jan 27, 2017 6:59 AM, "Pekka Paalanen" <ppaala...@gmail.com> wrote: > On Sat, 22 Oct 2016 13:31:28 -0400 > Jiayi Zhao <jeff.no.z...@gmail.com> wrote: > > > This adds support for enabling/disabling natural scrolling > > via a boolean in weston.ini: > > > > [libinput] > > natural_scroll=true > > > > CHANGES: > > - libinput_device_config_scroll_has_natural_scroll() is not longer > compared to != 0 > > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> > > --- > > compositor/main.c | 13 + > > weston.ini.in | 1 + > > 2 files changed, 14 insertions(+) > > > > diff --git a/compositor/main.c b/compositor/main.c > > index 080aa61..abfb55b 100644 > > --- a/compositor/main.c > > +++ b/compositor/main.c > > @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor > *compositor, > > struct weston_config *config = wet_get_config(compositor); > > int enable_tap; > > int enable_tap_default; > > + int natural_scroll; > > + int natural_scroll_default; > > > > s = weston_config_get_section(config, > > "libinput", NULL, NULL); > > @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor > *compositor, > > libinput_device_config_tap_set_enabled(device, > > enable_tap); > > } > > + > > + if (libinput_device_config_scroll_has_natural_scroll(device)) { > > + natural_scroll_default = > > + libinput_device_config_scroll_ > get_default_natural_scroll_enabled( > > + device); > > + weston_config_section_get_bool(s, "natural_scroll", > > +_scroll, > > +natural_scroll_default); > > + libinput_device_config_scroll_set_natural_scroll_enabled( > device, > > +natural_scroll); > > + } > > } > > > > static void > > diff --git a/weston.ini.in b/weston.ini.in > > index d837fb5..c7b8b98 100644 > > --- a/weston.ini.in > > +++ b/weston.ini.in > > @@ -60,6 +60,7 @@ path=@libexecdir@/weston-keyboard > > > > #[libinput] > > #enable_tap=true > > +#natural_scroll=false > > > > #[touchpad] > > #constant_accel_factor = 50 > > Hi, > > I suppose this is ok, but it should also update the manual page for > weston.ini to mention this option. > > > Thanks, > pq > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] [weston, v2] weston.ini: Add natural scroll support to weston.ini
The most recent patch is the one with natural_scroll in weston.ini I tried changing it to enable_natural_scroll, but it was giving me a hard time and wasnt working properly :/ Jiayi On Oct 23, 2016 5:51 PM, "Peter Hutterer" <peter.hutte...@who-t.net> wrote: > > sorry, I'm getting lost here, which one is the most recent patch now? there > are two labelled v2 > > Cheers, >Peter > > On Sat, Oct 22, 2016 at 01:31:28PM -0400, Jiayi Zhao wrote: > > This adds support for enabling/disabling natural scrolling > > via a boolean in weston.ini: > > > > [libinput] > > natural_scroll=true > > > > CHANGES: > > - libinput_device_config_scroll_has_natural_scroll() is not longer compared to != 0 > > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> > > --- > > compositor/main.c | 13 + > > weston.ini.in | 1 + > > 2 files changed, 14 insertions(+) > > > > diff --git a/compositor/main.c b/compositor/main.c > > index 080aa61..abfb55b 100644 > > --- a/compositor/main.c > > +++ b/compositor/main.c > > @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor *compositor, > > struct weston_config *config = wet_get_config(compositor); > > int enable_tap; > > int enable_tap_default; > > + int natural_scroll; > > + int natural_scroll_default; > > > > s = weston_config_get_section(config, > > "libinput", NULL, NULL); > > @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor *compositor, > > libinput_device_config_tap_set_enabled(device, > > enable_tap); > > } > > + > > + if (libinput_device_config_scroll_has_natural_scroll(device)) { > > + natural_scroll_default = > > + libinput_device_config_scroll_get_default_natural_scroll_enabled( > > + device); > > + weston_config_section_get_bool(s, "natural_scroll", > > +_scroll, > > +natural_scroll_default); > > + libinput_device_config_scroll_set_natural_scroll_enabled(device, > > +natural_scroll); > > + } > > } > > > > static void > > diff --git a/weston.ini.in b/weston.ini.in > > index d837fb5..c7b8b98 100644 > > --- a/weston.ini.in > > +++ b/weston.ini.in > > @@ -60,6 +60,7 @@ path=@libexecdir@/weston-keyboard > > > > #[libinput] > > #enable_tap=true > > +#natural_scroll=false > > > > #[touchpad] > > #constant_accel_factor = 50 > > -- > > 2.7.3 > > > > ___ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel > > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] [weston, v2] weston.ini: Add natural scroll support to weston.ini
The most recent patch is the one with natural_scroll in weston.ini I tried changing it to enable_natural_scroll, but it was giving me a hard time and wasnt working properly. :/ Jiayi On Oct 23, 2016 5:51 PM, "Peter Hutterer" <peter.hutte...@who-t.net> wrote: > sorry, I'm getting lost here, which one is the most recent patch now? there > are two labelled v2 > > Cheers, >Peter > > On Sat, Oct 22, 2016 at 01:31:28PM -0400, Jiayi Zhao wrote: > > This adds support for enabling/disabling natural scrolling > > via a boolean in weston.ini: > > > > [libinput] > > natural_scroll=true > > > > CHANGES: > > - libinput_device_config_scroll_has_natural_scroll() is not longer > compared to != 0 > > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> > > --- > > compositor/main.c | 13 + > > weston.ini.in | 1 + > > 2 files changed, 14 insertions(+) > > > > diff --git a/compositor/main.c b/compositor/main.c > > index 080aa61..abfb55b 100644 > > --- a/compositor/main.c > > +++ b/compositor/main.c > > @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor > *compositor, > > struct weston_config *config = wet_get_config(compositor); > > int enable_tap; > > int enable_tap_default; > > + int natural_scroll; > > + int natural_scroll_default; > > > > s = weston_config_get_section(config, > > "libinput", NULL, NULL); > > @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor > *compositor, > > libinput_device_config_tap_set_enabled(device, > > enable_tap); > > } > > + > > + if (libinput_device_config_scroll_has_natural_scroll(device)) { > > + natural_scroll_default = > > + libinput_device_config_scroll_ > get_default_natural_scroll_enabled( > > + device); > > + weston_config_section_get_bool(s, "natural_scroll", > > +_scroll, > > +natural_scroll_default); > > + libinput_device_config_scroll_set_natural_scroll_enabled( > device, > > +natural_scroll); > > + } > > } > > > > static void > > diff --git a/weston.ini.in b/weston.ini.in > > index d837fb5..c7b8b98 100644 > > --- a/weston.ini.in > > +++ b/weston.ini.in > > @@ -60,6 +60,7 @@ path=@libexecdir@/weston-keyboard > > > > #[libinput] > > #enable_tap=true > > +#natural_scroll=false > > > > #[touchpad] > > #constant_accel_factor = 50 > > -- > > 2.7.3 > > > > ___ > > wayland-devel mailing list > > wayland-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel > > > ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] [weston, v2] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini: [libinput] natural_scroll=true CHANGES: - libinput_device_config_scroll_has_natural_scroll() is not longer compared to != 0 Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> --- compositor/main.c | 13 + weston.ini.in | 1 + 2 files changed, 14 insertions(+) diff --git a/compositor/main.c b/compositor/main.c index 080aa61..abfb55b 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor *compositor, struct weston_config *config = wet_get_config(compositor); int enable_tap; int enable_tap_default; + int natural_scroll; + int natural_scroll_default; s = weston_config_get_section(config, "libinput", NULL, NULL); @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor *compositor, libinput_device_config_tap_set_enabled(device, enable_tap); } + + if (libinput_device_config_scroll_has_natural_scroll(device)) { + natural_scroll_default = + libinput_device_config_scroll_get_default_natural_scroll_enabled( + device); + weston_config_section_get_bool(s, "natural_scroll", + _scroll, + natural_scroll_default); + libinput_device_config_scroll_set_natural_scroll_enabled(device, + natural_scroll); + } } static void diff --git a/weston.ini.in b/weston.ini.in index d837fb5..c7b8b98 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -60,6 +60,7 @@ path=@libexecdir@/weston-keyboard #[libinput] #enable_tap=true +#natural_scroll=false #[touchpad] #constant_accel_factor = 50 -- 2.7.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[weston,v2] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini: [libinput] natural_scroll=true CHANGES: - libinput_device_config_scroll_has_natural_scroll() is not longer compared to != 0 Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[weston,v2] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini: [libinput] enable_natural_scroll=true CHANGES: - natural_scroll option has been changed to enable_natural_scroll - libinput_device_config_scroll_has_natural_scroll() is not longer compared to != 0 Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] [weston, v2] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini: [libinput] enable_natural_scroll=true CHANGES: - natural_scroll option has been changed to enable_natural_scroll - libinput_device_config_scroll_has_natural_scroll() is not longer compared to != 0 Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> --- compositor/main.c | 13 + weston.ini.in | 1 + 2 files changed, 14 insertions(+) diff --git a/compositor/main.c b/compositor/main.c index 080aa61..a077a98 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor *compositor, struct weston_config *config = wet_get_config(compositor); int enable_tap; int enable_tap_default; + int natural_scroll; + int natural_scroll_default; s = weston_config_get_section(config, "libinput", NULL, NULL); @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor *compositor, libinput_device_config_tap_set_enabled(device, enable_tap); } + + if (libinput_device_config_scroll_has_natural_scroll(device)) { + natural_scroll_default = + libinput_device_config_scroll_get_default_natural_scroll_enabled( + device); + weston_config_section_get_bool(s, "enable_natural_scroll", + _scroll, + natural_scroll_default); + libinput_device_config_scroll_set_natural_scroll_enabled(device, + natural_scroll); + } } static void diff --git a/weston.ini.in b/weston.ini.in index d837fb5..c590eb9 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -60,6 +60,7 @@ path=@libexecdir@/weston-keyboard #[libinput] #enable_tap=true +#enable_natural_scroll=false #[touchpad] #constant_accel_factor = 50 -- 2.7.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
Re: [PATCH] [weston] weston.ini: Add natural scroll support to weston.ini
Hmm, it says here that libinput_device_config_scroll_has_natural_scroll() returns a zero value if device does not support natural scrolling and returns a non-zero value if it does support natural scrolling: https://wayland.freedesktop.org/libinput/doc/latest/group__config.html#ga82d1aa961d2bb2f0c72c22e2441a4fc3 So I don't really know how I else I can program it. On Oct 20, 2016 9:05 PM, "Peter Hutterer" <peter.hutte...@who-t.net> wrote: > > > > On Thu, Oct 20, 2016 at 08:43:18PM -0400, Jiayi Zhao wrote: > > This adds support for enabling/disabling natural scrolling > > via a boolean in weston.ini: > > > > [libinput] > > natural_scroll=true > > > > Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> > > --- > > compositor/main.c | 13 + > > weston.ini.in | 1 + > > 2 files changed, 14 insertions(+) > > > > diff --git a/compositor/main.c b/compositor/main.c > > index 8028ec3..6cd2a25 100644 > > --- a/compositor/main.c > > +++ b/compositor/main.c > > @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor *compositor, > > struct weston_config *config = wet_get_config(compositor); > > int enable_tap; > > int enable_tap_default; > > + int natural_scroll; > > + int natural_scroll_default; > > > > s = weston_config_get_section(config, > > "libinput", NULL, NULL); > > @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor *compositor, > > libinput_device_config_tap_set_enabled(device, > > enable_tap); > > } > > + > > + if (libinput_device_config_scroll_has_natural_scroll(device) != 0) { > > libinput's *_has_* API is designed to return a boolean value, IMO you > shouldn't use the != 0 here. > > > + natural_scroll_default = > > + libinput_device_config_scroll_get_default_natural_scroll_enabled( > > + device); > > + weston_config_section_get_bool(s, "natural_scroll", > > +_scroll, > > +natural_scroll_default); > > + libinput_device_config_scroll_set_natural_scroll_enabled(device, > > +natural_scroll); > > + } > > } > > > > static void > > diff --git a/weston.ini.in b/weston.ini.in > > index 14a4c0c..08f931a 100644 > > --- a/weston.ini.in > > +++ b/weston.ini.in > > @@ -59,6 +59,7 @@ path=@libexecdir@/weston-keyboard > > > > #[libinput] > > #enable_tap=true > > +#natural_scroll=false > > "enable_natural_scroll" is more precise > > these are just nitpicks, the code itself looks fine, thanks. > > Cheers, >Peter > > > > > #[touchpad] > > #constant_accel_factor = 50 > > -- > > 2.7.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] [weston] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini: [libinput] natural_scroll=true Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel
[PATCH] [weston] weston.ini: Add natural scroll support to weston.ini
This adds support for enabling/disabling natural scrolling via a boolean in weston.ini: [libinput] natural_scroll=true Signed-off-by: Jiayi Zhao <jeff.no.z...@gmail.com> --- compositor/main.c | 13 + weston.ini.in | 1 + 2 files changed, 14 insertions(+) diff --git a/compositor/main.c b/compositor/main.c index 8028ec3..6cd2a25 100644 --- a/compositor/main.c +++ b/compositor/main.c @@ -1095,6 +1095,8 @@ configure_input_device(struct weston_compositor *compositor, struct weston_config *config = wet_get_config(compositor); int enable_tap; int enable_tap_default; + int natural_scroll; + int natural_scroll_default; s = weston_config_get_section(config, "libinput", NULL, NULL); @@ -1109,6 +,17 @@ configure_input_device(struct weston_compositor *compositor, libinput_device_config_tap_set_enabled(device, enable_tap); } + + if (libinput_device_config_scroll_has_natural_scroll(device) != 0) { + natural_scroll_default = + libinput_device_config_scroll_get_default_natural_scroll_enabled( + device); + weston_config_section_get_bool(s, "natural_scroll", + _scroll, + natural_scroll_default); + libinput_device_config_scroll_set_natural_scroll_enabled(device, + natural_scroll); + } } static void diff --git a/weston.ini.in b/weston.ini.in index 14a4c0c..08f931a 100644 --- a/weston.ini.in +++ b/weston.ini.in @@ -59,6 +59,7 @@ path=@libexecdir@/weston-keyboard #[libinput] #enable_tap=true +#natural_scroll=false #[touchpad] #constant_accel_factor = 50 -- 2.7.3 ___ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel