mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-05 05:05:57 +01:00
pointer: use enum wl_pointer_button_state
This commit is contained in:
parent
9f4cf242d9
commit
812451cd8f
8 changed files with 21 additions and 21 deletions
|
@ -69,13 +69,13 @@ void handle_pointer_button(struct libinput_event *event,
|
|||
uint32_t seat_count = libinput_event_pointer_get_seat_button_count(pevent);
|
||||
switch (libinput_event_pointer_get_button_state(pevent)) {
|
||||
case LIBINPUT_BUTTON_STATE_PRESSED:
|
||||
wlr_event.state = WLR_BUTTON_PRESSED;
|
||||
wlr_event.state = WL_POINTER_BUTTON_STATE_PRESSED;
|
||||
if (seat_count != 1) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case LIBINPUT_BUTTON_STATE_RELEASED:
|
||||
wlr_event.state = WLR_BUTTON_RELEASED;
|
||||
wlr_event.state = WL_POINTER_BUTTON_STATE_RELEASED;
|
||||
if (seat_count != 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ static void send_key_event(struct wlr_x11_backend *x11, uint32_t key,
|
|||
}
|
||||
|
||||
static void send_button_event(struct wlr_x11_output *output, uint32_t key,
|
||||
enum wlr_button_state st, xcb_timestamp_t time) {
|
||||
enum wl_pointer_button_state st, xcb_timestamp_t time) {
|
||||
struct wlr_pointer_button_event ev = {
|
||||
.pointer = &output->pointer,
|
||||
.time_msec = time,
|
||||
|
@ -155,15 +155,15 @@ void handle_x11_xinput_event(struct wlr_x11_backend *x11,
|
|||
|
||||
switch (ev->detail) {
|
||||
case XCB_BUTTON_INDEX_1:
|
||||
send_button_event(output, BTN_LEFT, WLR_BUTTON_PRESSED,
|
||||
send_button_event(output, BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED,
|
||||
ev->time);
|
||||
break;
|
||||
case XCB_BUTTON_INDEX_2:
|
||||
send_button_event(output, BTN_MIDDLE, WLR_BUTTON_PRESSED,
|
||||
send_button_event(output, BTN_MIDDLE, WL_POINTER_BUTTON_STATE_PRESSED,
|
||||
ev->time);
|
||||
break;
|
||||
case XCB_BUTTON_INDEX_3:
|
||||
send_button_event(output, BTN_RIGHT, WLR_BUTTON_PRESSED,
|
||||
send_button_event(output, BTN_RIGHT, WL_POINTER_BUTTON_STATE_PRESSED,
|
||||
ev->time);
|
||||
break;
|
||||
case XCB_BUTTON_INDEX_4:
|
||||
|
@ -188,15 +188,15 @@ void handle_x11_xinput_event(struct wlr_x11_backend *x11,
|
|||
|
||||
switch (ev->detail) {
|
||||
case XCB_BUTTON_INDEX_1:
|
||||
send_button_event(output, BTN_LEFT, WLR_BUTTON_RELEASED,
|
||||
send_button_event(output, BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED,
|
||||
ev->time);
|
||||
break;
|
||||
case XCB_BUTTON_INDEX_2:
|
||||
send_button_event(output, BTN_MIDDLE, WLR_BUTTON_RELEASED,
|
||||
send_button_event(output, BTN_MIDDLE, WL_POINTER_BUTTON_STATE_RELEASED,
|
||||
ev->time);
|
||||
break;
|
||||
case XCB_BUTTON_INDEX_3:
|
||||
send_button_event(output, BTN_RIGHT, WLR_BUTTON_RELEASED,
|
||||
send_button_event(output, BTN_RIGHT, WL_POINTER_BUTTON_STATE_RELEASED,
|
||||
ev->time);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
|
|||
struct wlr_pointer_button_event *event = data;
|
||||
|
||||
float (*color)[4];
|
||||
if (event->state == WLR_BUTTON_RELEASED) {
|
||||
if (event->state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||
color = &sample->default_color;
|
||||
memcpy(&sample->clear_color, color, sizeof(*color));
|
||||
} else {
|
||||
|
|
|
@ -63,7 +63,7 @@ struct wlr_pointer_button_event {
|
|||
struct wlr_pointer *pointer;
|
||||
uint32_t time_msec;
|
||||
uint32_t button;
|
||||
enum wlr_button_state state;
|
||||
enum wl_pointer_button_state state;
|
||||
};
|
||||
|
||||
enum wlr_axis_orientation {
|
||||
|
|
|
@ -98,7 +98,7 @@ struct wlr_pointer_grab_interface {
|
|||
void (*motion)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec,
|
||||
double sx, double sy);
|
||||
uint32_t (*button)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec,
|
||||
uint32_t button, enum wlr_button_state state);
|
||||
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,
|
||||
int32_t value_discrete, enum wl_pointer_axis_source source,
|
||||
|
@ -399,7 +399,7 @@ void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time_msec,
|
|||
* instead.
|
||||
*/
|
||||
uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat,
|
||||
uint32_t time_msec, uint32_t button, enum wlr_button_state state);
|
||||
uint32_t time_msec, uint32_t button, enum wl_pointer_button_state state);
|
||||
|
||||
/**
|
||||
* Send an axis event to the surface with pointer focus. This function does not
|
||||
|
@ -453,7 +453,7 @@ void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat,
|
|||
* pointer.
|
||||
*/
|
||||
uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
|
||||
uint32_t time_msec, uint32_t button, enum wlr_button_state state);
|
||||
uint32_t time_msec, uint32_t button, enum wl_pointer_button_state state);
|
||||
|
||||
/**
|
||||
* Notify the seat of an axis event. Defers to any grab of the pointer.
|
||||
|
|
|
@ -525,7 +525,7 @@ static void server_cursor_button(struct wl_listener *listener, void *data) {
|
|||
struct wlr_surface *surface = NULL;
|
||||
struct tinywl_toplevel *toplevel = desktop_toplevel_at(server,
|
||||
server->cursor->x, server->cursor->y, &surface, &sx, &sy);
|
||||
if (event->state == WLR_BUTTON_RELEASED) {
|
||||
if (event->state == WL_POINTER_BUTTON_STATE_RELEASED) {
|
||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||
reset_cursor_mode(server);
|
||||
} else {
|
||||
|
|
|
@ -23,7 +23,7 @@ static void default_pointer_motion(struct wlr_seat_pointer_grab *grab,
|
|||
}
|
||||
|
||||
static uint32_t default_pointer_button(struct wlr_seat_pointer_grab *grab,
|
||||
uint32_t time, uint32_t button, enum wlr_button_state state) {
|
||||
uint32_t time, uint32_t button, enum wl_pointer_button_state state) {
|
||||
return wlr_seat_pointer_send_button(grab->seat, time, button, state);
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
}
|
||||
|
||||
uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
|
||||
uint32_t button, enum wlr_button_state state) {
|
||||
uint32_t button, enum wl_pointer_button_state state) {
|
||||
struct wlr_seat_client *client = wlr_seat->pointer_state.focused_client;
|
||||
if (client == NULL) {
|
||||
return 0;
|
||||
|
@ -453,12 +453,12 @@ void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, uint32_t time,
|
|||
}
|
||||
|
||||
uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
|
||||
uint32_t time, uint32_t button, enum wlr_button_state state) {
|
||||
uint32_t time, uint32_t button, enum wl_pointer_button_state state) {
|
||||
clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event);
|
||||
|
||||
struct wlr_seat_pointer_state* pointer_state = &wlr_seat->pointer_state;
|
||||
|
||||
if (state == WLR_BUTTON_PRESSED) {
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||
if (pointer_state->button_count == 0) {
|
||||
pointer_state->grab_button = button;
|
||||
pointer_state->grab_time = time;
|
||||
|
@ -475,7 +475,7 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
|
|||
uint32_t serial = grab->interface->button(grab, time, button, state);
|
||||
|
||||
if (serial && pointer_state->button_count == 1 &&
|
||||
state == WLR_BUTTON_PRESSED) {
|
||||
state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||
pointer_state->grab_serial = serial;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ static void virtual_pointer_button(struct wl_client *client,
|
|||
.pointer = &pointer->pointer,
|
||||
.time_msec = time,
|
||||
.button = button,
|
||||
.state = state ? WLR_BUTTON_PRESSED : WLR_BUTTON_RELEASED
|
||||
.state = state ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED,
|
||||
};
|
||||
wl_signal_emit_mutable(&pointer->pointer.events.button, &event);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue