diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2014-06-30 10:32:27 +0200 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2014-07-16 23:06:29 +0200 |
commit | 81c558742c26b055fe333de36a3a8d6db0f94165 (patch) | |
tree | a39becde707cfc0ffd1ef20500c05d7909792986 | |
parent | b7df3da5671f20d01bb5c7f412dae56157b65c99 (diff) |
shell: constrain resize grabs so windows don't go under the panelpanel
https://bugs.freedesktop.org/show_bug.cgi?id=80228
-rw-r--r-- | desktop-shell/shell.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index e51c2999..e0f001de 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); } |