backend/wayland: populate pointer axis relative direction

master
Simon Ser 2 years ago committed by Kirill Primak
parent 7a58f41416
commit 98c708618e

@ -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);

@ -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,

@ -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;

Loading…
Cancel
Save