From a4b620e7e76f966586f4165b811a0c33de0214ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 30 Apr 2014 16:05:49 -0700 Subject: [PATCH] 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. --- desktop-shell/shell.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 8d169aa9..a9c67fa6 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -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)