[PATCH v2 weston 2/2] Support the new wheel tilt axis source
Peter Hutterer
peter.hutterer at who-t.net
Wed Jan 18 03:05:00 UTC 2017
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v1:
- add handling for wheel-tilt-since
clients/eventdemo.c | 3 +++
libweston/input.c | 16 +++++++++++-----
libweston/libinput-device.c | 7 ++++++-
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/clients/eventdemo.c b/clients/eventdemo.c
index d8eef5b..faa2621 100644
--- a/clients/eventdemo.c
+++ b/clients/eventdemo.c
@@ -304,6 +304,9 @@ axis_source_handler(struct widget *widget, struct input *input,
case WL_POINTER_AXIS_SOURCE_CONTINUOUS:
axis_source = "continuous";
break;
+ case WL_POINTER_AXIS_SOURCE_WHEEL_TILT:
+ axis_source = "wheel-tilt";
+ break;
default:
axis_source = "<invalid source value>";
break;
diff --git a/libweston/input.c b/libweston/input.c
index 4fedc55..adee8ad 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -555,10 +555,16 @@ weston_pointer_send_axis_source(struct weston_pointer *pointer,
resource_list = &pointer->focus_client->pointer_resources;
wl_resource_for_each(resource, resource_list) {
- if (wl_resource_get_version(resource) >=
- WL_POINTER_AXIS_SOURCE_SINCE_VERSION) {
- wl_pointer_send_axis_source(resource, source);
- }
+ if (wl_resource_get_version(resource) <
+ WL_POINTER_AXIS_SOURCE_SINCE_VERSION)
+ continue;
+
+ if (source == WL_POINTER_AXIS_SOURCE_WHEEL_TILT &&
+ wl_resource_get_version(resource) <
+ WL_POINTER_AXIS_SOURCE_WHEEL_TILT_SINCE_VERSION)
+ continue;
+
+ wl_pointer_send_axis_source(resource, source);
}
}
@@ -3071,7 +3077,7 @@ weston_seat_init(struct weston_seat *seat, struct weston_compositor *ec,
wl_signal_init(&seat->destroy_signal);
wl_signal_init(&seat->updated_caps_signal);
- seat->global = wl_global_create(ec->wl_display, &wl_seat_interface, 5,
+ seat->global = wl_global_create(ec->wl_display, &wl_seat_interface, 6,
seat, bind_seat);
seat->compositor = ec;
diff --git a/libweston/libinput-device.c b/libweston/libinput-device.c
index f97afcf..55b96f3 100644
--- a/libweston/libinput-device.c
+++ b/libweston/libinput-device.c
@@ -182,6 +182,7 @@ normalize_scroll(struct libinput_event_pointer *pointer_event,
*/
switch (source) {
case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL:
+ case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
value = 10 * libinput_event_pointer_get_axis_value_discrete(
pointer_event,
axis);
@@ -204,7 +205,8 @@ get_axis_discrete(struct libinput_event_pointer *pointer_event,
source = libinput_event_pointer_get_axis_source(pointer_event);
- if (source != LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
+ if (source != LIBINPUT_POINTER_AXIS_SOURCE_WHEEL &&
+ source != LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT)
return 0;
return libinput_event_pointer_get_axis_value_discrete(pointer_event,
@@ -245,6 +247,9 @@ handle_pointer_axis(struct libinput_device *libinput_device,
case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS:
wl_axis_source = WL_POINTER_AXIS_SOURCE_CONTINUOUS;
break;
+ case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT:
+ wl_axis_source = WL_POINTER_AXIS_SOURCE_WHEEL_TILT;
+ break;
default:
if (warned < 5) {
weston_log("Unknown scroll source %d.\n", source);
--
2.9.3
More information about the wayland-devel
mailing list