[PATCH weston 3/3] shell: constrain resize grabs so windows don't go under the panel
Jonny Lamb
jonny.lamb at collabora.co.uk
Wed Jul 16 14:34:19 PDT 2014
https://bugs.freedesktop.org/show_bug.cgi?id=80228
---
desktop-shell/shell.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index e51c299..e0f001d 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1754,6 +1754,32 @@ struct weston_resize_grab {
};
static void
+constrain_move_grab(struct weston_pointer_grab *grab,
+ int32_t *width, int32_t *height)
+{
+ struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
+ struct shell_surface *shsurf = resize->base.shsurf;
+
+ int32_t height_difference;
+
+ height_difference = *height - shsurf->surface->height;
+
+ /* this is only really necessary when the panel is at the top */
+ if (shsurf->shell->panel_position == DESKTOP_SHELL_PANEL_POSITION_TOP &&
+ resize->edges & WL_SHELL_SURFACE_RESIZE_TOP &&
+ height_difference > 0) {
+ int32_t panel_width, panel_height, top;
+
+ get_output_panel_size(shsurf->shell, shsurf->surface->output,
+ &panel_width, &panel_height);
+
+ top = (shsurf->view->geometry.y - height_difference) + shsurf->margin.top;
+ if (top < panel_height)
+ *height = shsurf->surface->height;
+ }
+}
+
+static void
resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
wl_fixed_t x, wl_fixed_t y)
{
@@ -1789,6 +1815,8 @@ resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
height += wl_fixed_to_int(to_y - from_y);
}
+ constrain_move_grab(grab, &width, &height);
+
shsurf->client->send_configure(shsurf->surface, width, height);
}
--
2.0.0
More information about the wayland-devel
mailing list