[PATCH RFC weston] libinput: support high-resolution scroll wheels

Pekka Paalanen ppaalanen at gmail.com
Tue Jan 29 13:36:41 UTC 2019


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.

> +#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?

> +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. :-)


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190129/7f7b0c7a/attachment.sig>


More information about the wayland-devel mailing list