1 From c54f23d8df4e758f097d127df4d44d7a00059cef Mon Sep 17 00:00:00 2001
2 From: Peter Hutterer <peter.hutterer@who-t.net>
3 Date: Tue, 13 Jan 2015 11:55:37 +1000
4 Subject: libinput-device: use the new merged scroll events
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 libinput now provides a single event for scroll events. Extract the axes from
10 that event and split them into the wl events.
12 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
13 Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
15 diff --git a/src/libinput-device.c b/src/libinput-device.c
16 index 8a48905..e68b54d 100644
17 --- a/src/libinput-device.c
18 +++ b/src/libinput-device.c
19 @@ -133,12 +133,27 @@ handle_pointer_axis(struct libinput_device *libinput_device,
20 struct evdev_device *device =
21 libinput_device_get_user_data(libinput_device);
23 + enum libinput_pointer_axis axis;
25 + axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
26 + if (libinput_event_pointer_has_axis(pointer_event, axis)) {
27 + value = libinput_event_pointer_get_axis_value(pointer_event,
29 + notify_axis(device->seat,
30 + libinput_event_pointer_get_time(pointer_event),
31 + WL_POINTER_AXIS_VERTICAL_SCROLL,
32 + wl_fixed_from_double(value));
35 - value = libinput_event_pointer_get_axis_value(pointer_event);
36 - notify_axis(device->seat,
37 - libinput_event_pointer_get_time(pointer_event),
38 - libinput_event_pointer_get_axis(pointer_event),
39 - wl_fixed_from_double(value));
40 + axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
41 + if (libinput_event_pointer_has_axis(pointer_event, axis)) {
42 + value = libinput_event_pointer_get_axis_value(pointer_event,
44 + notify_axis(device->seat,
45 + libinput_event_pointer_get_time(pointer_event),
46 + WL_POINTER_AXIS_HORIZONTAL_SCROLL,
47 + wl_fixed_from_double(value));
55 From 5dddd411d6d8587267529d0478c5dc68e9521047 Mon Sep 17 00:00:00 2001
56 From: Peter Hutterer <peter.hutterer@who-t.net>
57 Date: Thu, 15 Jan 2015 13:14:43 +1000
58 Subject: libinput-device: use the discrete axis value for wheel events
60 Content-Type: text/plain; charset=UTF-8
61 Content-Transfer-Encoding: 8bit
63 libinput < 0.8 sent wheel click events with value 10. Since 0.8
64 the value is the angle of the click in degrees but it now provides
65 the click count as separate value. To keep backwards-compat with
66 existing clients, we just send multiples of the click count.
68 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
69 Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
70 Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
72 diff --git a/src/libinput-device.c b/src/libinput-device.c
73 index e68b54d..3ce74b8 100644
74 --- a/src/libinput-device.c
75 +++ b/src/libinput-device.c
76 @@ -126,6 +126,44 @@ handle_pointer_button(struct libinput_device *libinput_device,
77 libinput_event_pointer_get_button_state(pointer_event));
81 +normalize_scroll(struct libinput_event_pointer *pointer_event,
82 + enum libinput_pointer_axis axis)
85 + enum libinput_pointer_axis_source source;
88 + source = libinput_event_pointer_get_axis_source(pointer_event);
89 + /* libinput < 0.8 sent wheel click events with value 10. Since 0.8
90 + the value is the angle of the click in degrees. To keep
91 + backwards-compat with existing clients, we just send multiples of
95 + case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
96 + value = 10 * libinput_event_pointer_get_axis_value_discrete(
100 + case LIBINPUT_POINTER_AXIS_SOURCE_FINGER:
101 + case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
102 + value = libinput_event_pointer_get_axis_value(pointer_event,
108 + weston_log("Unknown scroll source %d. Event discarded\n",
119 handle_pointer_axis(struct libinput_device *libinput_device,
120 struct libinput_event_pointer *pointer_event)
121 @@ -137,8 +175,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
123 axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
124 if (libinput_event_pointer_has_axis(pointer_event, axis)) {
125 - value = libinput_event_pointer_get_axis_value(pointer_event,
127 + value = normalize_scroll(pointer_event, axis);
128 notify_axis(device->seat,
129 libinput_event_pointer_get_time(pointer_event),
130 WL_POINTER_AXIS_VERTICAL_SCROLL,
131 @@ -147,8 +184,7 @@ handle_pointer_axis(struct libinput_device *libinput_device,
133 axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
134 if (libinput_event_pointer_has_axis(pointer_event, axis)) {
135 - value = libinput_event_pointer_get_axis_value(pointer_event,
137 + value = normalize_scroll(pointer_event, axis);
138 notify_axis(device->seat,
139 libinput_event_pointer_get_time(pointer_event),
140 WL_POINTER_AXIS_HORIZONTAL_SCROLL,
144 --- weston-1.6.1/configure.ac~ 2015-01-23 22:14:10.000000000 +0100
145 +++ weston-1.6.1/configure.ac 2015-02-01 15:11:40.242544080 +0100
147 AM_CONDITIONAL([ENABLE_LIBINPUT_BACKEND], [test x$enable_libinput_backend = xyes])
148 if test x$enable_libinput_backend = xyes; then
149 AC_DEFINE([BUILD_LIBINPUT_BACKEND], [1], [Build the libinput input device backend])
150 - PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.6.0 libinput < 0.8.0])
151 + PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.8.0])