diff --git a/include/types/wlr_seat.h b/include/types/wlr_seat.h index c39889b62..96676723e 100644 --- a/include/types/wlr_seat.h +++ b/include/types/wlr_seat.h @@ -4,7 +4,8 @@ #include #include -extern const struct wlr_pointer_grab_interface default_pointer_grab_impl; +extern const struct wlr_pointer_grab default_pointer_grab; + extern const struct wlr_keyboard_grab_interface default_keyboard_grab_impl; extern const struct wlr_touch_grab_interface default_touch_grab_impl; diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 697987b20..0ea6579f8 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -12,9 +12,6 @@ #include #include -extern const struct wlr_pointer_grab_interface - wlr_data_device_pointer_drag_interface; - extern const struct wlr_keyboard_grab_interface wlr_data_device_keyboard_drag_interface; @@ -113,7 +110,6 @@ enum wlr_drag_grab_type { struct wlr_drag { enum wlr_drag_grab_type grab_type; struct wlr_seat_keyboard_grab keyboard_grab; - struct wlr_seat_pointer_grab pointer_grab; struct wlr_seat_touch_grab touch_grab; struct wlr_seat *seat; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index d19844497..3f4604387 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -89,21 +89,18 @@ struct wlr_touch_point { struct wl_list link; }; -struct wlr_seat_pointer_grab; - -struct wlr_pointer_grab_interface { - void (*enter)(struct wlr_seat_pointer_grab *grab, - struct wlr_surface *surface, double sx, double sy); - void (*clear_focus)(struct wlr_seat_pointer_grab *grab); - 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); - 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); - void (*frame)(struct wlr_seat_pointer_grab *grab); - void (*cancel)(struct wlr_seat_pointer_grab *grab); +struct wlr_pointer_grab { + void (*enter)(void *data, struct wlr_surface *surface, double sx, double sy); + void (*clear_focus)(void *data); + void (*motion)(void *data, uint32_t time_msec, + double sx, double sy); + uint32_t (*button)(void *data, uint32_t time_msec, + uint32_t button, enum wlr_button_state state); + void (*axis)(void *data, uint32_t time_msec, + enum wlr_axis_orientation orientation, double value, + int32_t value_discrete, enum wlr_axis_source source); + void (*frame)(void *data); + void (*cancel)(void *data); }; struct wlr_seat_keyboard_grab; @@ -159,16 +156,6 @@ struct wlr_seat_keyboard_grab { void *data; }; -/** - * Passed to wlr_seat_pointer_start_grab() to start a grab of the pointer. The - * grabber is responsible for handling pointer events for the seat. - */ -struct wlr_seat_pointer_grab { - const struct wlr_pointer_grab_interface *interface; - struct wlr_seat *seat; - void *data; -}; - #define WLR_POINTER_BUTTONS_CAP 16 struct wlr_seat_pointer_state { @@ -177,8 +164,8 @@ struct wlr_seat_pointer_state { struct wlr_surface *focused_surface; double sx, sy; - struct wlr_seat_pointer_grab *grab; - struct wlr_seat_pointer_grab *default_grab; + const struct wlr_pointer_grab *grab; + void *grab_data; bool sent_axis_source; enum wlr_axis_source cached_axis_source; @@ -473,7 +460,7 @@ void wlr_seat_pointer_notify_frame(struct wlr_seat *wlr_seat); * handling all pointer events until the grab ends. */ void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat, - struct wlr_seat_pointer_grab *grab); + const struct wlr_pointer_grab *grab, void *data); /** * End the grab of the pointer of this seat. This reverts the grab back to the diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index f2aae2526..022b1c323 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -117,7 +117,6 @@ struct wlr_xdg_popup { // each seat gets a popup grab struct wlr_xdg_popup_grab { struct wl_client *client; - struct wlr_seat_pointer_grab pointer_grab; struct wlr_seat_keyboard_grab keyboard_grab; struct wlr_seat_touch_grab touch_grab; struct wlr_seat *seat; diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index c1fa801ba..fec97e701 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -160,20 +160,20 @@ static void drag_destroy(struct wlr_drag *drag) { free(drag); } -static void drag_handle_pointer_enter(struct wlr_seat_pointer_grab *grab, +static void drag_handle_pointer_enter(void *data, struct wlr_surface *surface, double sx, double sy) { - struct wlr_drag *drag = grab->data; + struct wlr_drag *drag = data; drag_set_focus(drag, surface, sx, sy); } -static void drag_handle_pointer_clear_focus(struct wlr_seat_pointer_grab *grab) { - struct wlr_drag *drag = grab->data; +static void drag_handle_pointer_clear_focus(void *data) { + struct wlr_drag *drag = data; drag_set_focus(drag, NULL, 0, 0); } -static void drag_handle_pointer_motion(struct wlr_seat_pointer_grab *grab, +static void drag_handle_pointer_motion(void *data, uint32_t time, double sx, double sy) { - struct wlr_drag *drag = grab->data; + struct wlr_drag *drag = data; if (drag->focus != NULL && drag->focus_client != NULL) { struct wl_resource *resource; wl_resource_for_each(resource, &drag->focus_client->data_devices) { @@ -211,12 +211,12 @@ static void drag_drop(struct wlr_drag *drag, uint32_t time) { wl_signal_emit_mutable(&drag->events.drop, &event); } -static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab, +static uint32_t drag_handle_pointer_button(void *data, uint32_t time, uint32_t button, uint32_t state) { - struct wlr_drag *drag = grab->data; + struct wlr_drag *drag = data; if (drag->source && - grab->seat->pointer_state.grab_button == button && + drag->seat->pointer_state.grab_button == button && state == WL_POINTER_BUTTON_STATE_RELEASED) { if (drag->focus_client && drag->source->current_dnd_action && drag->source->accepted) { @@ -228,7 +228,7 @@ static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab, } } - if (grab->seat->pointer_state.button_count == 0 && + if (drag->seat->pointer_state.button_count == 0 && state == WL_POINTER_BUTTON_STATE_RELEASED) { drag_destroy(drag); } @@ -236,19 +236,18 @@ static uint32_t drag_handle_pointer_button(struct wlr_seat_pointer_grab *grab, return 0; } -static void drag_handle_pointer_axis(struct wlr_seat_pointer_grab *grab, +static void drag_handle_pointer_axis(void *data, uint32_t time, enum wlr_axis_orientation orientation, double value, int32_t value_discrete, enum wlr_axis_source source) { // This space is intentionally left blank } -static void drag_handle_pointer_cancel(struct wlr_seat_pointer_grab *grab) { - struct wlr_drag *drag = grab->data; +static void drag_handle_pointer_cancel(void *data) { + struct wlr_drag *drag = data; drag_destroy(drag); } -static const struct wlr_pointer_grab_interface - data_device_pointer_drag_interface = { +static const struct wlr_pointer_grab drag_pointer_grab = { .enter = drag_handle_pointer_enter, .clear_focus = drag_handle_pointer_clear_focus, .motion = drag_handle_pointer_motion, @@ -436,9 +435,6 @@ struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client, wl_signal_add(&source->events.destroy, &drag->source_destroy); } - drag->pointer_grab.data = drag; - drag->pointer_grab.interface = &data_device_pointer_drag_interface; - drag->touch_grab.data = drag; drag->touch_grab.interface = &data_device_touch_drag_interface; @@ -502,7 +498,7 @@ void wlr_seat_start_pointer_drag(struct wlr_seat *seat, struct wlr_drag *drag, drag->grab_type = WLR_DRAG_GRAB_KEYBOARD_POINTER; wlr_seat_pointer_clear_focus(seat); - wlr_seat_pointer_start_grab(seat, &drag->pointer_grab); + wlr_seat_pointer_start_grab(seat, &drag_pointer_grab, drag); wlr_seat_start_drag(seat, drag, serial); } diff --git a/types/seat/wlr_seat.c b/types/seat/wlr_seat.c index c29858246..843578a67 100644 --- a/types/seat/wlr_seat.c +++ b/types/seat/wlr_seat.c @@ -211,7 +211,6 @@ void wlr_seat_destroy(struct wlr_seat *seat) { } wlr_global_destroy_safe(seat->global); - free(seat->pointer_state.default_grab); free(seat->keyboard_state.default_grab); free(seat->touch_state.default_grab); free(seat->name); @@ -234,16 +233,8 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) { seat->pointer_state.seat = seat; wl_list_init(&seat->pointer_state.surface_destroy.link); - struct wlr_seat_pointer_grab *pointer_grab = - calloc(1, sizeof(struct wlr_seat_pointer_grab)); - if (!pointer_grab) { - free(seat); - return NULL; - } - pointer_grab->interface = &default_pointer_grab_impl; - pointer_grab->seat = seat; - seat->pointer_state.default_grab = pointer_grab; - seat->pointer_state.grab = pointer_grab; + seat->pointer_state.grab = &default_pointer_grab; + seat->pointer_state.grab_data = seat; wl_signal_init(&seat->pointer_state.events.focus_change); @@ -251,7 +242,6 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) { struct wlr_seat_keyboard_grab *keyboard_grab = calloc(1, sizeof(struct wlr_seat_keyboard_grab)); if (!keyboard_grab) { - free(pointer_grab); free(seat); return NULL; } @@ -269,7 +259,6 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) { struct wlr_seat_touch_grab *touch_grab = calloc(1, sizeof(struct wlr_seat_touch_grab)); if (!touch_grab) { - free(pointer_grab); free(keyboard_grab); free(seat); return NULL; @@ -286,7 +275,6 @@ struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name) { SEAT_VERSION, seat, seat_handle_bind); if (seat->global == NULL) { free(touch_grab); - free(pointer_grab); free(keyboard_grab); free(seat); return NULL; diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c index ffa706bd6..b1be7a484 100644 --- a/types/seat/wlr_seat_pointer.c +++ b/types/seat/wlr_seat_pointer.c @@ -9,41 +9,41 @@ #include "types/wlr_seat.h" #include "util/set.h" -static void default_pointer_enter(struct wlr_seat_pointer_grab *grab, +static void default_pointer_enter(void *data, struct wlr_surface *surface, double sx, double sy) { - wlr_seat_pointer_enter(grab->seat, surface, sx, sy); + wlr_seat_pointer_enter(data, surface, sx, sy); } -static void default_pointer_clear_focus(struct wlr_seat_pointer_grab *grab) { - wlr_seat_pointer_clear_focus(grab->seat); +static void default_pointer_clear_focus(void *data) { + wlr_seat_pointer_clear_focus(data); } -static void default_pointer_motion(struct wlr_seat_pointer_grab *grab, +static void default_pointer_motion(void *data, uint32_t time, double sx, double sy) { - wlr_seat_pointer_send_motion(grab->seat, time, sx, sy); + wlr_seat_pointer_send_motion(data, time, sx, sy); } -static uint32_t default_pointer_button(struct wlr_seat_pointer_grab *grab, +static uint32_t default_pointer_button(void *data, uint32_t time, uint32_t button, enum wlr_button_state state) { - return wlr_seat_pointer_send_button(grab->seat, time, button, state); + return wlr_seat_pointer_send_button(data, time, button, state); } -static void default_pointer_axis(struct wlr_seat_pointer_grab *grab, +static void default_pointer_axis(void *data, uint32_t time, enum wlr_axis_orientation orientation, double value, int32_t value_discrete, enum wlr_axis_source source) { - wlr_seat_pointer_send_axis(grab->seat, time, orientation, value, + wlr_seat_pointer_send_axis(data, time, orientation, value, value_discrete, source); } -static void default_pointer_frame(struct wlr_seat_pointer_grab *grab) { - wlr_seat_pointer_send_frame(grab->seat); +static void default_pointer_frame(void *data) { + wlr_seat_pointer_send_frame(data); } -static void default_pointer_cancel(struct wlr_seat_pointer_grab *grab) { +static void default_pointer_cancel(void *data) { // cannot be cancelled } -const struct wlr_pointer_grab_interface default_pointer_grab_impl = { +const struct wlr_pointer_grab default_pointer_grab = { .enter = default_pointer_enter, .clear_focus = default_pointer_clear_focus, .motion = default_pointer_motion, @@ -53,7 +53,6 @@ const struct wlr_pointer_grab_interface default_pointer_grab_impl = { .cancel = default_pointer_cancel, }; - static void pointer_send_frame(struct wl_resource *resource) { if (wl_resource_get_version(resource) >= WL_POINTER_FRAME_SINCE_VERSION) { @@ -397,21 +396,23 @@ void wlr_seat_pointer_send_frame(struct wlr_seat *wlr_seat) { } void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat, - struct wlr_seat_pointer_grab *grab) { - assert(wlr_seat); - grab->seat = wlr_seat; + const struct wlr_pointer_grab *grab, void *data) { wlr_seat->pointer_state.grab = grab; + wlr_seat->pointer_state.grab_data = data; - wl_signal_emit_mutable(&wlr_seat->events.pointer_grab_begin, grab); + wl_signal_emit_mutable(&wlr_seat->events.pointer_grab_begin, NULL); } void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat) { - struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; - if (grab != wlr_seat->pointer_state.default_grab) { - wlr_seat->pointer_state.grab = wlr_seat->pointer_state.default_grab; - wl_signal_emit_mutable(&wlr_seat->events.pointer_grab_end, grab); - if (grab->interface->cancel) { - grab->interface->cancel(grab); + const struct wlr_pointer_grab *grab = wlr_seat->pointer_state.grab; + void *grab_data = wlr_seat->pointer_state.grab_data; + + if (grab != &default_pointer_grab) { + wlr_seat->pointer_state.grab = &default_pointer_grab; + wlr_seat->pointer_state.grab_data = wlr_seat; + wl_signal_emit_mutable(&wlr_seat->events.pointer_grab_end, NULL); + if (grab->cancel != NULL) { + grab->cancel(grab_data); } } } @@ -421,27 +422,27 @@ void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat, // NULL surfaces are prohibited in the grab-compatible API. Use // wlr_seat_pointer_notify_clear_focus() instead. assert(surface); - struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; - grab->interface->enter(grab, surface, sx, sy); + struct wlr_seat_pointer_state *pointer_state = &wlr_seat->pointer_state; + pointer_state->grab->enter(pointer_state->grab_data, surface, sx, sy); } void wlr_seat_pointer_notify_clear_focus(struct wlr_seat *wlr_seat) { - struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; - grab->interface->clear_focus(grab); + struct wlr_seat_pointer_state *pointer_state = &wlr_seat->pointer_state; + pointer_state->grab->clear_focus(pointer_state->grab_data); } void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, uint32_t time, double sx, double sy) { clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event); - struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; - grab->interface->motion(grab, time, sx, sy); + struct wlr_seat_pointer_state *pointer_state = &wlr_seat->pointer_state; + pointer_state->grab->motion(pointer_state->grab_data, time, sx, sy); } uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat, uint32_t time, uint32_t button, enum wlr_button_state state) { clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event); - struct wlr_seat_pointer_state* pointer_state = &wlr_seat->pointer_state; + struct wlr_seat_pointer_state *pointer_state = &wlr_seat->pointer_state; if (state == WLR_BUTTON_PRESSED) { if (pointer_state->button_count == 0) { @@ -455,9 +456,8 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat, WLR_POINTER_BUTTONS_CAP, button); } - - struct wlr_seat_pointer_grab *grab = pointer_state->grab; - uint32_t serial = grab->interface->button(grab, time, button, state); + uint32_t serial = + pointer_state->grab->button(pointer_state->grab_data, time, button, state); if (serial && pointer_state->button_count == 1 && state == WLR_BUTTON_PRESSED) { @@ -471,24 +471,23 @@ 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) { clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event); - struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; - grab->interface->axis(grab, time, orientation, value, value_discrete, - source); + struct wlr_seat_pointer_state *pointer_state = &wlr_seat->pointer_state; + pointer_state->grab->axis(pointer_state->grab_data, time, orientation, + value, value_discrete, source); } void wlr_seat_pointer_notify_frame(struct wlr_seat *wlr_seat) { clock_gettime(CLOCK_MONOTONIC, &wlr_seat->last_event); - struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab; - if (grab->interface->frame) { - grab->interface->frame(grab); + struct wlr_seat_pointer_state *pointer_state = &wlr_seat->pointer_state; + if (pointer_state->grab->frame != NULL) { + pointer_state->grab->frame(pointer_state->grab_data); } } bool wlr_seat_pointer_has_grab(struct wlr_seat *seat) { - return seat->pointer_state.grab->interface != &default_pointer_grab_impl; + return seat->pointer_state.grab != &default_pointer_grab; } - void seat_client_create_pointer(struct wlr_seat_client *seat_client, uint32_t version, uint32_t id) { struct wl_resource *resource = wl_resource_create(seat_client->client, diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 184c03fdd..d27cd598b 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -49,53 +49,58 @@ static void xdg_popup_grab_end(struct wlr_xdg_popup_grab *popup_grab) { wlr_seat_touch_end_grab(popup_grab->seat); } -static void xdg_pointer_grab_enter(struct wlr_seat_pointer_grab *grab, +static void xdg_pointer_grab_enter(void *data, struct wlr_surface *surface, double sx, double sy) { - struct wlr_xdg_popup_grab *popup_grab = grab->data; + struct wlr_xdg_popup_grab *popup_grab = data; if (wl_resource_get_client(surface->resource) == popup_grab->client) { - wlr_seat_pointer_enter(grab->seat, surface, sx, sy); + wlr_seat_pointer_enter(popup_grab->seat, surface, sx, sy); } else { - wlr_seat_pointer_clear_focus(grab->seat); + wlr_seat_pointer_clear_focus(popup_grab->seat); } } -static void xdg_pointer_grab_clear_focus(struct wlr_seat_pointer_grab *grab) { - wlr_seat_pointer_clear_focus(grab->seat); +static void xdg_pointer_grab_clear_focus(void *data) { + struct wlr_xdg_popup_grab *popup_grab = data; + wlr_seat_pointer_clear_focus(popup_grab->seat); } -static void xdg_pointer_grab_motion(struct wlr_seat_pointer_grab *grab, +static void xdg_pointer_grab_motion(void *data, uint32_t time, double sx, double sy) { - wlr_seat_pointer_send_motion(grab->seat, time, sx, sy); + struct wlr_xdg_popup_grab *popup_grab = data; + wlr_seat_pointer_send_motion(popup_grab->seat, time, sx, sy); } -static uint32_t xdg_pointer_grab_button(struct wlr_seat_pointer_grab *grab, +static uint32_t xdg_pointer_grab_button(void *data, uint32_t time, uint32_t button, uint32_t state) { + struct wlr_xdg_popup_grab *popup_grab = data; uint32_t serial = - wlr_seat_pointer_send_button(grab->seat, time, button, state); + wlr_seat_pointer_send_button(popup_grab->seat, time, button, state); if (serial) { return serial; } else { - xdg_popup_grab_end(grab->data); + xdg_popup_grab_end(data); return 0; } } -static void xdg_pointer_grab_axis(struct wlr_seat_pointer_grab *grab, +static void xdg_pointer_grab_axis(void *data, uint32_t time, enum wlr_axis_orientation orientation, double value, int32_t value_discrete, enum wlr_axis_source source) { - wlr_seat_pointer_send_axis(grab->seat, time, orientation, value, + struct wlr_xdg_popup_grab *popup_grab = data; + wlr_seat_pointer_send_axis(popup_grab->seat, time, orientation, value, value_discrete, source); } -static void xdg_pointer_grab_frame(struct wlr_seat_pointer_grab *grab) { - wlr_seat_pointer_send_frame(grab->seat); +static void xdg_pointer_grab_frame(void *data) { + struct wlr_xdg_popup_grab *popup_grab = data; + wlr_seat_pointer_send_frame(popup_grab->seat); } -static void xdg_pointer_grab_cancel(struct wlr_seat_pointer_grab *grab) { - xdg_popup_grab_end(grab->data); +static void xdg_pointer_grab_cancel(void *data) { + xdg_popup_grab_end(data); } -static const struct wlr_pointer_grab_interface xdg_pointer_grab_impl = { +static const struct wlr_pointer_grab xdg_pointer_grab = { .enter = xdg_pointer_grab_enter, .clear_focus = xdg_pointer_grab_clear_focus, .motion = xdg_pointer_grab_motion, @@ -219,8 +224,6 @@ static struct wlr_xdg_popup_grab *get_xdg_shell_popup_grab_from_seat( return NULL; } - xdg_grab->pointer_grab.data = xdg_grab; - xdg_grab->pointer_grab.interface = &xdg_pointer_grab_impl; xdg_grab->keyboard_grab.data = xdg_grab; xdg_grab->keyboard_grab.interface = &xdg_keyboard_grab_impl; xdg_grab->touch_grab.data = xdg_grab; @@ -297,7 +300,8 @@ static void xdg_popup_handle_grab(struct wl_client *client, wl_list_insert(&popup_grab->popups, &popup->grab_link); wlr_seat_pointer_start_grab(seat_client->seat, - &popup_grab->pointer_grab); + &xdg_pointer_grab, popup_grab); + wlr_seat_keyboard_start_grab(seat_client->seat, &popup_grab->keyboard_grab); wlr_seat_touch_start_grab(seat_client->seat, @@ -434,7 +438,7 @@ void unmap_xdg_popup(struct wlr_xdg_popup *popup) { wl_list_remove(&popup->grab_link); if (wl_list_empty(&grab->popups)) { - if (grab->seat->pointer_state.grab == &grab->pointer_grab) { + if (grab->seat->pointer_state.grab == &xdg_pointer_grab) { wlr_seat_pointer_end_grab(grab->seat); } if (grab->seat->keyboard_state.grab == &grab->keyboard_grab) {