[PATCH RFC weston] libinput: support high-resolution scroll wheels
Peter Hutterer
peter.hutterer at who-t.net
Tue Jan 29 23:47:39 UTC 2019
On Tue, Jan 29, 2019 at 03:36:41PM +0200, Pekka Paalanen wrote:
> On Tue, 29 Jan 2019 16:57:34 +1000
> Peter Hutterer <peter.hutterer at who-t.net> wrote:
>
> > The new API returns scroll wheels as fractions of 120.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > Turns out it's not the most complicated patch...
> >
> > This is an RFC only because libinput hasn't been released yet, and it's
> > waiting on the kernel release anyway. Given the expected delay, I hope
> > autotools is removed by the time this becomes a mergeable.
> >
> > libweston/libinput-device.c | 6 ++++++
> > meson.build | 9 +++++++++
> > 2 files changed, 15 insertions(+)
> >
> > diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c
> > index e25df144..e028d246 100644
> > --- a/libweston/libinput-device.c
> > +++ b/libweston/libinput-device.c
> > @@ -190,9 +190,15 @@ normalize_scroll(struct libinput_event_pointer *pointer_event,
> > */
> > switch (source) {
> > case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
> > +#if HAVE_LIBINPUT_AXIS_V120
> > + value = 10 * libinput_event_pointer_get_axis_value_v120(
> > + pointer_event,
> > + axis)/120.0;
>
> Hi Peter,
>
> spaces needed around the operator.
thx, and I will submit a MR proper anyway, this was just a FYI patch to
illustrate the world probably won't end if we add hi-res scrolling.
> > +#else
> > value = 10 * libinput_event_pointer_get_axis_value_discrete(
> > pointer_event,
> > axis);
> > +#endif
> > break;
> > case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
> > case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
> > diff --git a/meson.build b/meson.build
> > index 7826dbb0..dfb10ce5 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -143,6 +143,15 @@ dep_wayland_server = dependency('wayland-server', version: '>= 1.12.0')
> > dep_wayland_client = dependency('wayland-client', version: '>= 1.12.0')
> > dep_pixman = dependency('pixman-1', version: '>= 0.25.2')
> > dep_libinput = dependency('libinput', version: '>= 0.8.0')
> > +have_libinput_axis_v120_code = '''
> > +#include <libinput.h>
> > +int main(void) { libinput_event_pointer_get_axis_value_v120(NULL, 0); }
> > +'''
> > +have_libinput_axis_v120 = cc.links(have_libinput_axis_v120_code,
> > + name: 'libinput_event_pointer_get_axis_value_v120',
> > + dependencies: dep_libinput)
>
> I guess the above gets replaced with a version check after libinput is
> released?
I found the direct function check works just as well and has the benefit of
working with pre-releases (or patched versions) where needed. Esp. because
here we just look for a single API call here. Do you have a preference?
> > +config_h.set10('HAVE_LIBINPUT_AXIS_V120', have_libinput_axis_v120)
> > +
> > dep_libm = cc.find_library('m')
> > dep_libdl = cc.find_library('dl')
> > dep_libdrm = dependency('libdrm', version: '>= 2.4.68')
>
> Fine by me, but I can't claim to have actually verified the correctness
> of the semantics. A Weston MR would be cool, if you prefix the title
> with "WIP:" Gitlab makes it unmergeable until the prefix is removed. :-)
Testing a bit more yesterday, there's some issue with Firefox (double
scrolling) that I haven't identified yet, but expect the MR to show up once
I know what it is.
Cheers,
Peter
More information about the wayland-devel
mailing list