validate grab serial for shell events
This commit is contained in:
parent
069f120b70
commit
815d71a3aa
|
@ -509,4 +509,10 @@ int wlr_seat_touch_num_points(struct wlr_seat *seat);
|
||||||
*/
|
*/
|
||||||
bool wlr_seat_touch_has_grab(struct wlr_seat *seat);
|
bool wlr_seat_touch_has_grab(struct wlr_seat *seat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this serial is valid to start a grab action such as an
|
||||||
|
* interactive move or resize.
|
||||||
|
*/
|
||||||
|
bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,7 +43,6 @@ static void handle_request_resize(struct wl_listener *listener, void *data) {
|
||||||
struct roots_input *input = view->desktop->server->input;
|
struct roots_input *input = view->desktop->server->input;
|
||||||
struct wlr_wl_shell_surface_resize_event *e = data;
|
struct wlr_wl_shell_surface_resize_event *e = data;
|
||||||
struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
|
struct roots_seat *seat = input_seat_from_wlr_seat(input, e->seat->seat);
|
||||||
// TODO verify input event
|
|
||||||
if (!seat || seat->cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
if (!seat || seat->cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1216,3 +1216,8 @@ int wlr_seat_touch_num_points(struct wlr_seat *seat) {
|
||||||
bool wlr_seat_touch_has_grab(struct wlr_seat *seat) {
|
bool wlr_seat_touch_has_grab(struct wlr_seat *seat) {
|
||||||
return seat->touch_state.grab->interface != &default_touch_grab_impl;
|
return seat->touch_state.grab->interface != &default_touch_grab_impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial) {
|
||||||
|
return serial == seat->pointer_state.grab_serial ||
|
||||||
|
serial == seat->touch_state.grab_serial;
|
||||||
|
}
|
||||||
|
|
|
@ -112,6 +112,11 @@ static void shell_surface_protocol_move(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat =
|
struct wlr_seat_client *seat =
|
||||||
wl_resource_get_user_data(seat_resource);
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
|
wlr_log(L_DEBUG, "invalid serial for grab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_wl_shell_surface_move_event event = {
|
struct wlr_wl_shell_surface_move_event event = {
|
||||||
.surface = surface,
|
.surface = surface,
|
||||||
.seat = seat,
|
.seat = seat,
|
||||||
|
@ -170,6 +175,11 @@ static void shell_surface_protocol_resize(struct wl_client *client,
|
||||||
struct wlr_seat_client *seat =
|
struct wlr_seat_client *seat =
|
||||||
wl_resource_get_user_data(seat_resource);
|
wl_resource_get_user_data(seat_resource);
|
||||||
|
|
||||||
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
|
wlr_log(L_DEBUG, "invalid serial for grab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_wl_shell_surface_resize_event event = {
|
struct wlr_wl_shell_surface_resize_event event = {
|
||||||
.surface = surface,
|
.surface = surface,
|
||||||
.seat = seat,
|
.seat = seat,
|
||||||
|
|
|
@ -565,6 +565,11 @@ static void xdg_toplevel_protocol_show_window_menu(struct wl_client *client,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
|
wlr_log(L_DEBUG, "invalid serial for grab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_xdg_toplevel_v6_show_window_menu_event event = {
|
struct wlr_xdg_toplevel_v6_show_window_menu_event event = {
|
||||||
.surface = surface,
|
.surface = surface,
|
||||||
.seat = seat,
|
.seat = seat,
|
||||||
|
@ -590,6 +595,11 @@ static void xdg_toplevel_protocol_move(struct wl_client *client,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
|
wlr_log(L_DEBUG, "invalid serial for grab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_xdg_toplevel_v6_move_event event = {
|
struct wlr_xdg_toplevel_v6_move_event event = {
|
||||||
.surface = surface,
|
.surface = surface,
|
||||||
.seat = seat,
|
.seat = seat,
|
||||||
|
@ -613,6 +623,11 @@ static void xdg_toplevel_protocol_resize(struct wl_client *client,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!wlr_seat_validate_grab_serial(seat->seat, serial)) {
|
||||||
|
wlr_log(L_DEBUG, "invalid serial for grab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct wlr_xdg_toplevel_v6_resize_event event = {
|
struct wlr_xdg_toplevel_v6_resize_event event = {
|
||||||
.surface = surface,
|
.surface = surface,
|
||||||
.seat = seat,
|
.seat = seat,
|
||||||
|
|
Loading…
Reference in New Issue