[PATCH weston] shell: the move, resize, rotate bindings work on the parent of popups
Giulio Camuffo
giuliocamuffo at gmail.com
Wed Apr 3 08:20:41 PDT 2013
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
More information about the wayland-devel
mailing list