From 9f4cf242d9f51922c1bb364d9b11a1ed83f518fb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 28 Feb 2024 10:15:13 +0100 Subject: [PATCH] pointer: drop enum wlr_axis_source Instead, use enum wl_pointer_axis_source from the Wayland protocol. --- backend/libinput/events.c | 6 +++--- backend/libinput/pointer.c | 12 ++++++------ backend/x11/input_device.c | 2 +- include/backend/libinput.h | 2 +- include/backend/wayland.h | 2 +- include/wlr/types/wlr_pointer.h | 9 +-------- include/wlr/types/wlr_seat.h | 8 ++++---- types/data_device/wlr_drag.c | 2 +- types/seat/wlr_seat_pointer.c | 6 +++--- types/xdg_shell/wlr_xdg_popup.c | 2 +- 10 files changed, 22 insertions(+), 29 deletions(-) diff --git a/backend/libinput/events.c b/backend/libinput/events.c index dcc65137..1bf70ce2 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -180,15 +180,15 @@ void handle_libinput_event(struct wlr_libinput_backend *backend, #if HAVE_LIBINPUT_SCROLL_VALUE120 case LIBINPUT_EVENT_POINTER_SCROLL_WHEEL: handle_pointer_axis_value120(event, &dev->pointer, - WLR_AXIS_SOURCE_WHEEL); + WL_POINTER_AXIS_SOURCE_WHEEL); break; case LIBINPUT_EVENT_POINTER_SCROLL_FINGER: handle_pointer_axis_value120(event, &dev->pointer, - WLR_AXIS_SOURCE_FINGER); + WL_POINTER_AXIS_SOURCE_FINGER); break; case LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS: handle_pointer_axis_value120(event, &dev->pointer, - WLR_AXIS_SOURCE_CONTINUOUS); + WL_POINTER_AXIS_SOURCE_CONTINUOUS); break; #endif case LIBINPUT_EVENT_TOUCH_DOWN: diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index b124c663..01bfc190 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -95,16 +95,16 @@ void handle_pointer_axis(struct libinput_event *event, }; switch (libinput_event_pointer_get_axis_source(pevent)) { case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL: - wlr_event.source = WLR_AXIS_SOURCE_WHEEL; + wlr_event.source = WL_POINTER_AXIS_SOURCE_WHEEL; break; case LIBINPUT_POINTER_AXIS_SOURCE_FINGER: - wlr_event.source = WLR_AXIS_SOURCE_FINGER; + wlr_event.source = WL_POINTER_AXIS_SOURCE_FINGER; break; case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS: - wlr_event.source = WLR_AXIS_SOURCE_CONTINUOUS; + wlr_event.source = WL_POINTER_AXIS_SOURCE_CONTINUOUS; break; case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: - wlr_event.source = WLR_AXIS_SOURCE_WHEEL_TILT; + wlr_event.source = WL_POINTER_AXIS_SOURCE_WHEEL_TILT; break; } const enum libinput_pointer_axis axes[] = { @@ -140,7 +140,7 @@ void handle_pointer_axis(struct libinput_event *event, #if HAVE_LIBINPUT_SCROLL_VALUE120 void handle_pointer_axis_value120(struct libinput_event *event, - struct wlr_pointer *pointer, enum wlr_axis_source source) { + struct wlr_pointer *pointer, enum wl_pointer_axis_source source) { struct libinput_event_pointer *pevent = libinput_event_get_pointer_event(event); struct wlr_pointer_axis_event wlr_event = { @@ -167,7 +167,7 @@ void handle_pointer_axis_value120(struct libinput_event *event, } wlr_event.delta = libinput_event_pointer_get_scroll_value(pevent, axes[i]); - if (source == WLR_AXIS_SOURCE_WHEEL) { + if (source == WL_POINTER_AXIS_SOURCE_WHEEL) { wlr_event.delta_discrete = libinput_event_pointer_get_scroll_value_v120(pevent, axes[i]); } diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 02d4210f..8526ae9b 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -45,7 +45,7 @@ static void send_axis_event(struct wlr_x11_output *output, int32_t delta, struct wlr_pointer_axis_event ev = { .pointer = &output->pointer, .time_msec = time, - .source = WLR_AXIS_SOURCE_WHEEL, + .source = WL_POINTER_AXIS_SOURCE_WHEEL, .orientation = WLR_AXIS_ORIENTATION_VERTICAL, // Most mice use a 15 degree angle per scroll click .delta = delta * 15, diff --git a/include/backend/libinput.h b/include/backend/libinput.h index 2b8babb4..910af47f 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -72,7 +72,7 @@ void handle_pointer_axis(struct libinput_event *event, struct wlr_pointer *pointer); #if HAVE_LIBINPUT_SCROLL_VALUE120 void handle_pointer_axis_value120(struct libinput_event *event, - struct wlr_pointer *pointer, enum wlr_axis_source source); + struct wlr_pointer *pointer, enum wl_pointer_axis_source source); #endif void handle_pointer_swipe_begin(struct libinput_event *event, struct wlr_pointer *pointer); diff --git a/include/backend/wayland.h b/include/backend/wayland.h index f8fb66ba..273aa4f7 100644 --- a/include/backend/wayland.h +++ b/include/backend/wayland.h @@ -106,7 +106,7 @@ struct wlr_wl_pointer { struct wlr_wl_seat *seat; struct wlr_wl_output *output; - enum wlr_axis_source axis_source; + enum wl_pointer_axis_source axis_source; int32_t axis_discrete; uint32_t fingers; // trackpad gesture enum wlr_axis_relative_direction axis_relative_direction; diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index e4740550..240b69d6 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -66,13 +66,6 @@ struct wlr_pointer_button_event { enum wlr_button_state state; }; -enum wlr_axis_source { - WLR_AXIS_SOURCE_WHEEL, - WLR_AXIS_SOURCE_FINGER, - WLR_AXIS_SOURCE_CONTINUOUS, - WLR_AXIS_SOURCE_WHEEL_TILT, -}; - enum wlr_axis_orientation { WLR_AXIS_ORIENTATION_VERTICAL, WLR_AXIS_ORIENTATION_HORIZONTAL, @@ -88,7 +81,7 @@ enum wlr_axis_relative_direction { struct wlr_pointer_axis_event { struct wlr_pointer *pointer; uint32_t time_msec; - enum wlr_axis_source source; + enum wl_pointer_axis_source source; enum wlr_axis_orientation orientation; enum wlr_axis_relative_direction relative_direction; double delta; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index bafd00ad..b6d80f15 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -101,7 +101,7 @@ struct wlr_pointer_grab_interface { uint32_t button, enum wlr_button_state state); void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec, enum wlr_axis_orientation orientation, double value, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction); void (*frame)(struct wlr_seat_pointer_grab *grab); void (*cancel)(struct wlr_seat_pointer_grab *grab); @@ -182,7 +182,7 @@ struct wlr_seat_pointer_state { struct wlr_seat_pointer_grab *default_grab; bool sent_axis_source; - enum wlr_axis_source cached_axis_source; + enum wl_pointer_axis_source cached_axis_source; uint32_t buttons[WLR_POINTER_BUTTONS_CAP]; size_t button_count; @@ -408,7 +408,7 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, */ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time_msec, enum wlr_axis_orientation orientation, double value, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction); /** @@ -460,7 +460,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_msec, enum wlr_axis_orientation orientation, double value, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction); /** diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index 42691116..55db414e 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -235,7 +235,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, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_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 1d57fff2..c872ddf3 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -29,7 +29,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, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction) { wlr_seat_pointer_send_axis(grab->seat, time, orientation, value, value_discrete, source, relative_direction); @@ -321,7 +321,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, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction) { struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client; if (client == NULL) { @@ -484,7 +484,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, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction) { clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event); struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 97e6c8e2..6cc235f8 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -82,7 +82,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, - int32_t value_discrete, enum wlr_axis_source source, + int32_t value_discrete, enum wl_pointer_axis_source source, enum wlr_axis_relative_direction relative_direction) { wlr_seat_pointer_send_axis(grab->seat, time, orientation, value, value_discrete, source, relative_direction);