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.
dev
Kristian Høgsberg 11 years ago
parent e0b9d5be84
commit a4b620e7e7
  1. 15
      desktop-shell/shell.c

@ -1556,7 +1556,8 @@ surface_move(struct shell_surface *shsurf, struct weston_seat *seat,
if (!shsurf) if (!shsurf)
return -1; return -1;
if (shsurf->state.fullscreen || shsurf->state.maximized) if (shsurf->grabbed ||
shsurf->state.fullscreen || shsurf->state.maximized)
return 0; return 0;
move = malloc(sizeof *move); 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 shell_surface *shsurf = wl_resource_get_user_data(resource);
struct weston_surface *surface; struct weston_surface *surface;
if (shsurf->grabbed)
return;
if (seat->pointer && if (seat->pointer &&
seat->pointer->focus && seat->pointer->focus &&
seat->pointer->button_count > 0 && seat->pointer->button_count > 0 &&
@ -1746,7 +1744,8 @@ surface_resize(struct shell_surface *shsurf,
{ {
struct weston_resize_grab *resize; struct weston_resize_grab *resize;
if (shsurf->state.fullscreen || shsurf->state.maximized) if (shsurf->grabbed ||
shsurf->state.fullscreen || shsurf->state.maximized)
return 0; return 0;
if (edges == 0 || edges > 15 || 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 shell_surface *shsurf = wl_resource_get_user_data(resource);
struct weston_surface *surface; struct weston_surface *surface;
if (shsurf->state.fullscreen)
return;
if (shsurf->grabbed)
return;
if (seat->pointer->button_count == 0 || if (seat->pointer->button_count == 0 ||
seat->pointer->grab_serial != serial || seat->pointer->grab_serial != serial ||
seat->pointer->focus == NULL) seat->pointer->focus == NULL)

Loading…
Cancel
Save