Previously we can resize windows into panel in weston. This patch puts a constraint in position when resizing just like what was done in moving to avoid resizing window into the panel.
https://bugs.freedesktop.org/show_bug.cgi?id=80228 Signed-off-by: Boyan Ding <stu_...@126.com> --- desktop-shell/shell.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index d267cde..eccfa1e 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -1689,6 +1689,35 @@ struct weston_resize_grab { }; static void +constrain_resize_position(struct weston_resize_grab *resize, + wl_fixed_t *from_x, wl_fixed_t *from_y, + wl_fixed_t *to_x, wl_fixed_t *to_y) +{ + struct shell_surface *shsurf = resize->base.shsurf; + struct weston_pointer *pointer = resize->base.grab.pointer; + int panel_height; + wl_fixed_t grab_x, grab_y, x, y, panel_height_fixed; + + grab_x = pointer->grab_x; + grab_y = pointer->grab_y; + x = pointer->x; + y = pointer->y; + + panel_height = get_output_panel_height(shsurf->shell, + shsurf->surface->output); + panel_height_fixed = wl_fixed_from_int(panel_height); + + if (grab_y < panel_height_fixed) + grab_y = panel_height_fixed; + if (y < panel_height_fixed) + y = panel_height_fixed; + + weston_view_from_global_fixed(shsurf->view, grab_x, grab_y, + from_x, from_y); + weston_view_from_global_fixed(shsurf->view, x, y, to_x, to_y); +} + +static void resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time, wl_fixed_t x, wl_fixed_t y) { @@ -1704,11 +1733,7 @@ resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time, if (!shsurf) return; - weston_view_from_global_fixed(shsurf->view, - pointer->grab_x, pointer->grab_y, - &from_x, &from_y); - weston_view_from_global_fixed(shsurf->view, - pointer->x, pointer->y, &to_x, &to_y); + constrain_resize_position(resize, &from_x, &from_y, &to_x, &to_y); width = resize->width; if (resize->edges & WL_SHELL_SURFACE_RESIZE_LEFT) { -- 2.0.0 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel