pointer: drop enum wlr_axis_orientation

Instead, use enum wl_pointer_axis from the Wayland protocol.
This commit is contained in:
Simon Ser 2024-02-28 10:33:39 +01:00 committed by Simon Zeni
parent ec5263e6b7
commit 488a23c169
7 changed files with 15 additions and 20 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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