---
 src/shell.c | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/src/shell.c b/src/shell.c
index c8f20ec..5273bc1 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1092,10 +1092,24 @@ shell_surface_move(struct wl_client *client, struct 
wl_resource *resource,
 {
        struct weston_seat *ws = seat_resource->data;
        struct shell_surface *shsurf = resource->data;
+       int focus_is_surface;
+       struct weston_subsurface *subsurface;
 
        if (ws->seat.pointer->button_count == 0 ||
-           ws->seat.pointer->grab_serial != serial ||
-           ws->seat.pointer->focus != &shsurf->surface->surface)
+           ws->seat.pointer->grab_serial != serial)
+               return;
+
+       focus_is_surface = ws->seat.pointer->focus == &shsurf->surface->surface;
+       if (!focus_is_surface) {
+               wl_list_for_each(subsurface, &shsurf->surface->subsurface_list, 
parent_link) {
+                       if (ws->seat.pointer->focus == 
&subsurface->surface->surface) {
+                               focus_is_surface = 1;
+                               break;
+                       }
+               }
+       }
+
+       if (!focus_is_surface)
                return;
 
        if (surface_move(shsurf, ws) < 0)
@@ -1215,13 +1229,27 @@ shell_surface_resize(struct wl_client *client, struct 
wl_resource *resource,
 {
        struct weston_seat *ws = seat_resource->data;
        struct shell_surface *shsurf = resource->data;
+       int focus_is_surface;
+       struct weston_subsurface *subsurface;
 
        if (shsurf->type == SHELL_SURFACE_FULLSCREEN)
                return;
 
        if (ws->seat.pointer->button_count == 0 ||
-           ws->seat.pointer->grab_serial != serial ||
-           ws->seat.pointer->focus != &shsurf->surface->surface)
+               ws->seat.pointer->grab_serial != serial)
+               return;
+
+       focus_is_surface = ws->seat.pointer->focus == &shsurf->surface->surface;
+       if (!focus_is_surface) {
+               wl_list_for_each(subsurface, &shsurf->surface->subsurface_list, 
parent_link) {
+                       if (ws->seat.pointer->focus == 
&subsurface->surface->surface) {
+                               focus_is_surface = 1;
+                               break;
+                       }
+               }
+       }
+
+       if (!focus_is_surface)
                return;
 
        if (surface_resize(shsurf, ws, edges) < 0)
-- 
1.8.1.3

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to