From 98c708618ec09907748082850b2d4340fc63055e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 11 Feb 2023 19:16:22 +0100 Subject: backend/wayland: populate pointer axis relative direction --- backend/wayland/backend.c | 4 ++-- backend/wayland/pointer.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'backend') diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 9f78b6f1..0bd75610 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -355,8 +355,8 @@ static void registry_global(void *data, struct wl_registry *registry, if (version < 5) { target_version = 5; } - if (version > 8) { - target_version = 8; + if (version > 9) { + target_version = 9; } struct wl_seat *wl_seat = wl_registry_bind(registry, name, &wl_seat_interface, target_version); diff --git a/backend/wayland/pointer.c b/backend/wayland/pointer.c index 39fb337e..0cad9720 100644 --- a/backend/wayland/pointer.c +++ b/backend/wayland/pointer.c @@ -132,6 +132,7 @@ static void pointer_handle_axis(void *data, struct wl_pointer *wl_pointer, .orientation = axis, .time_msec = time, .source = pointer->axis_source, + .relative_direction = pointer->axis_relative_direction, }; wl_signal_emit_mutable(&pointer->wlr_pointer.events.axis, &event); @@ -201,6 +202,17 @@ static void pointer_handle_axis_value120(void *data, pointer->axis_discrete = value120; } +static void pointer_handle_axis_relative_direction(void *data, + struct wl_pointer *wl_pointer, uint32_t axis, uint32_t direction) { + struct wlr_wl_seat *seat = data; + struct wlr_wl_pointer *pointer = seat->active_pointer; + if (pointer == NULL) { + return; + } + + pointer->axis_relative_direction = direction; +} + static const struct wl_pointer_listener pointer_listener = { .enter = pointer_handle_enter, .leave = pointer_handle_leave, @@ -212,6 +224,7 @@ static const struct wl_pointer_listener pointer_listener = { .axis_stop = pointer_handle_axis_stop, .axis_discrete = pointer_handle_axis_discrete, .axis_value120 = pointer_handle_axis_value120, + .axis_relative_direction = pointer_handle_axis_relative_direction, }; static void gesture_swipe_begin(void *data, -- cgit v1.2.3