aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-02-11 19:16:22 +0100
committerKirill Primak <vyivel@eclair.cafe>2024-01-23 08:37:29 +0000
commit98c708618ec09907748082850b2d4340fc63055e (patch)
tree2856dd8a3dd27316dc1a3d91b697e6ae1d5ac302
parent7a58f41416afe67e7b78b79cc297dabf8f20b533 (diff)
backend/wayland: populate pointer axis relative direction
-rw-r--r--backend/wayland/backend.c4
-rw-r--r--backend/wayland/pointer.c13
-rw-r--r--include/backend/wayland.h1
3 files changed, 16 insertions, 2 deletions
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,
diff --git a/include/backend/wayland.h b/include/backend/wayland.h
index d6796b44..098d1dc1 100644
--- a/include/backend/wayland.h
+++ b/include/backend/wayland.h
@@ -109,6 +109,7 @@ struct wlr_wl_pointer {
enum wlr_axis_source axis_source;
int32_t axis_discrete;
uint32_t fingers; // trackpad gesture
+ enum wlr_axis_relative_direction axis_relative_direction;
struct wl_listener output_destroy;