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.
This commit is contained in:
Kristian Høgsberg 2014-04-30 16:05:49 -07:00
parent e0b9d5be84
commit a4b620e7e7

View File

@ -1556,7 +1556,8 @@ surface_move(struct shell_surface *shsurf, struct weston_seat *seat,
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 @@ common_surface_move(struct wl_resource *resource,
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 @@ surface_resize(struct shell_surface *shsurf,
{
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 @@ common_surface_resize(struct wl_resource *resource,
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)