desktop-shell: Further consolidate move/resize grab checks
This moves the check for shsurf->grabbed into surface_move() and
surface_resize(), which are shared with the xwayland code. This prevents
trying to resize or move an xwayland window with multiple pointers.
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 8d169aa..a9c67fa 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1556,7 +1556,8 @@
if (!shsurf)
return -1;
- if (shsurf->state.fullscreen || shsurf->state.maximized)
+ if (shsurf->grabbed ||
+ shsurf->state.fullscreen || shsurf->state.maximized)
return 0;
move = malloc(sizeof *move);
@@ -1583,9 +1584,6 @@
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
struct weston_surface *surface;
- if (shsurf->grabbed)
- return;
-
if (seat->pointer &&
seat->pointer->focus &&
seat->pointer->button_count > 0 &&
@@ -1746,7 +1744,8 @@
{
struct weston_resize_grab *resize;
- if (shsurf->state.fullscreen || shsurf->state.maximized)
+ if (shsurf->grabbed ||
+ shsurf->state.fullscreen || shsurf->state.maximized)
return 0;
if (edges == 0 || edges > 15 ||
@@ -1777,12 +1776,6 @@
struct shell_surface *shsurf = wl_resource_get_user_data(resource);
struct weston_surface *surface;
- if (shsurf->state.fullscreen)
- return;
-
- if (shsurf->grabbed)
- return;
-
if (seat->pointer->button_count == 0 ||
seat->pointer->grab_serial != serial ||
seat->pointer->focus == NULL)