From 488a23c16908a83041cf28e134a6f149d831598d Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 28 Feb 2024 10:33:39 +0100 Subject: [PATCH] pointer: drop enum wlr_axis_orientation Instead, use enum wl_pointer_axis from the Wayland protocol. --- backend/libinput/pointer.c | 8 ++++---- backend/x11/input_device.c | 2 +- include/wlr/types/wlr_pointer.h | 7 +------ include/wlr/types/wlr_seat.h | 6 +++--- types/data_device/wlr_drag.c | 2 +- types/seat/wlr_seat_pointer.c | 8 ++++---- types/xdg_shell/wlr_xdg_popup.c | 2 +- 7 files changed, 15 insertions(+), 20 deletions(-) diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 36ade694..f808e1f0 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -118,10 +118,10 @@ void handle_pointer_axis(struct libinput_event *event, switch (axes[i]) { case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL: - wlr_event.orientation = WLR_AXIS_ORIENTATION_VERTICAL; + wlr_event.orientation = WL_POINTER_AXIS_VERTICAL_SCROLL; break; case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL: - wlr_event.orientation = WLR_AXIS_ORIENTATION_HORIZONTAL; + wlr_event.orientation = WL_POINTER_AXIS_HORIZONTAL_SCROLL; break; } wlr_event.delta = @@ -159,10 +159,10 @@ void handle_pointer_axis_value120(struct libinput_event *event, } switch (axes[i]) { case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL: - wlr_event.orientation = WLR_AXIS_ORIENTATION_VERTICAL; + wlr_event.orientation = WL_POINTER_AXIS_VERTICAL_SCROLL; break; case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL: - wlr_event.orientation = WLR_AXIS_ORIENTATION_HORIZONTAL; + wlr_event.orientation = WL_POINTER_AXIS_HORIZONTAL_SCROLL; break; } wlr_event.delta = diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 82d9c151..c3536531 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -46,7 +46,7 @@ static void send_axis_event(struct wlr_x11_output *output, int32_t delta, .pointer = &output->pointer, .time_msec = time, .source = WL_POINTER_AXIS_SOURCE_WHEEL, - .orientation = WLR_AXIS_ORIENTATION_VERTICAL, + .orientation = WL_POINTER_AXIS_VERTICAL_SCROLL, // Most mice use a 15 degree angle per scroll click .delta = delta * 15, .delta_discrete = delta * WLR_POINTER_AXIS_DISCRETE_STEP, diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index b3b0f056..2fa85138 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -66,18 +66,13 @@ struct wlr_pointer_button_event { enum wl_pointer_button_state state; }; -enum wlr_axis_orientation { - WLR_AXIS_ORIENTATION_VERTICAL, - WLR_AXIS_ORIENTATION_HORIZONTAL, -}; - #define WLR_POINTER_AXIS_DISCRETE_STEP 120 struct wlr_pointer_axis_event { struct wlr_pointer *pointer; uint32_t time_msec; enum wl_pointer_axis_source source; - enum wlr_axis_orientation orientation; + enum wl_pointer_axis orientation; enum wl_pointer_axis_relative_direction relative_direction; double delta; int32_t delta_discrete; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index ec2c439b..0318b0f1 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -100,7 +100,7 @@ struct wlr_pointer_grab_interface { uint32_t (*button)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec, uint32_t button, enum wl_pointer_button_state state); void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec, - enum wlr_axis_orientation orientation, double value, + enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction); void (*frame)(struct wlr_seat_pointer_grab *grab); @@ -407,7 +407,7 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, * instead. */ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time_msec, - enum wlr_axis_orientation orientation, double value, + enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction); @@ -459,7 +459,7 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat, * Notify the seat of an axis event. Defers to any grab of the pointer. */ void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time_msec, - enum wlr_axis_orientation orientation, double value, + enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction); diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index 9b0b12a9..7161d91e 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -234,7 +234,7 @@ static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab, } static void drag_handle_pointer_axis(struct wlr_seat_pointer_grab *grab, - uint32_t time, enum wlr_axis_orientation orientation, double value, + uint32_t time, enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction) { // This space is intentionally left blank diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index eb5e1d94..9618d52b 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -28,7 +28,7 @@ static uint32_t default_pointer_button(struct wlr_seat_pointer_grab *grab, } static void default_pointer_axis(struct wlr_seat_pointer_grab *grab, - uint32_t time, enum wlr_axis_orientation orientation, double value, + uint32_t time, enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction) { wlr_seat_pointer_send_axis(grab->seat, time, orientation, value, @@ -287,7 +287,7 @@ static bool should_reset_value120_accumulators(int32_t current, int32_t last) { } static void update_value120_accumulators(struct wlr_seat_client *client, - enum wlr_axis_orientation orientation, + enum wl_pointer_axis orientation, double value, int32_t value_discrete, double *low_res_value, int32_t *low_res_value_discrete) { if (value_discrete == 0) { @@ -320,7 +320,7 @@ static void update_value120_accumulators(struct wlr_seat_client *client, } void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time, - enum wlr_axis_orientation orientation, double value, + enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction) { struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client; @@ -483,7 +483,7 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat, } void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time, - enum wlr_axis_orientation orientation, double value, + enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction) { clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event); diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 0ed71e7a..e2038c8d 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -81,7 +81,7 @@ static uint32_t xdg_pointer_grab_button(struct wlr_seat_pointer_grab *grab, } static void xdg_pointer_grab_axis(struct wlr_seat_pointer_grab *grab, - uint32_t time, enum wlr_axis_orientation orientation, double value, + uint32_t time, enum wl_pointer_axis orientation, double value, int32_t value_discrete, enum wl_pointer_axis_source source, enum wl_pointer_axis_relative_direction relative_direction) { wlr_seat_pointer_send_axis(grab->seat, time, orientation, value,