this makes the move, resize and rotate bindings check whenever the
focus surface is a popup, and if it is it will walk the surface
hierarchy unitil it finds a non-popup one, and will apply the
effect on that
---
 src/shell.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/src/shell.c b/src/shell.c
index de5d6f6..eaa2123 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2505,6 +2505,21 @@ get_shell_surface_type(struct weston_surface *surface)
        return shsurf->type;
 }
 
+static struct shell_surface *
+get_top_level_parent(struct shell_surface *shsurf)
+{
+       while (!wl_list_empty(&shsurf->popup.grab_link)) {
+               if (shsurf->parent)
+                       shsurf = get_shell_surface(shsurf->parent);
+               else
+                       return NULL;
+
+               if (shsurf == NULL)
+                       return NULL;
+       }
+       return shsurf;
+}
+
 static void
 move_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data)
 {
@@ -2520,6 +2535,10 @@ move_binding(struct wl_seat *seat, uint32_t time, 
uint32_t button, void *data)
            shsurf->type == SHELL_SURFACE_MAXIMIZED)
                return;
 
+       shsurf = get_top_level_parent(shsurf);
+       if (shsurf == NULL)
+               return;
+
        surface_move(shsurf, (struct weston_seat *) seat);
 }
 
@@ -2540,6 +2559,10 @@ resize_binding(struct wl_seat *seat, uint32_t time, 
uint32_t button, void *data)
            shsurf->type == SHELL_SURFACE_MAXIMIZED)
                return;
 
+       shsurf = get_top_level_parent(shsurf);
+       if (shsurf == NULL)
+               return;
+
        weston_surface_from_global(surface,
                                   wl_fixed_to_int(seat->pointer->grab_x),
                                   wl_fixed_to_int(seat->pointer->grab_y),
@@ -2800,6 +2823,10 @@ rotate_binding(struct wl_seat *seat, uint32_t time, 
uint32_t button,
            surface->type == SHELL_SURFACE_MAXIMIZED)
                return;
 
+       surface = get_top_level_parent(surface);
+       if (surface == NULL)
+               return;
+
        surface_rotate(surface, seat);
 }
 
-- 
1.8.2

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to