summaryrefslogtreecommitdiff
path: root/desktop-shell
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-04-15 12:23:56 -0500
committerBryce Harrington <bryce@osg.samsung.com>2015-07-17 17:46:58 -0700
commit6feb0f9f55a8bb02b48fc185775cc1cba3db2510 (patch)
tree6fb948c7cc6d9723a435db46f9788f829adefcd4 /desktop-shell
parent612341f1a62b8c5cd2975343b7d607beb397fa57 (diff)
desktop-shell: use work area instead of panel size to constrain moves
This fixes the case where an output isn't at y = 0, where the panel height isn't correct for constraints. It also kills a bug - moving a window with a mod-drag off the top of the screen clamped earlier than it should. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'desktop-shell')
-rw-r--r--desktop-shell/shell.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 35f719b6..0137ca31 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1668,24 +1668,27 @@ constrain_position(struct weston_move_grab *move, int *cx, int *cy)
{
struct shell_surface *shsurf = move->base.shsurf;
struct weston_pointer *pointer = move->base.grab.pointer;
- int x, y, panel_width, panel_height, bottom;
+ int x, y, bottom;
const int safety = 50;
+ pixman_rectangle32_t area;
x = wl_fixed_to_int(pointer->x + move->dx);
y = wl_fixed_to_int(pointer->y + move->dy);
if (shsurf->shell->panel_position == DESKTOP_SHELL_PANEL_POSITION_TOP) {
- get_output_panel_size(shsurf->shell, shsurf->surface->output,
- &panel_width, &panel_height);
+ get_output_work_area(shsurf->shell,
+ shsurf->surface->output,
+ &area);
- bottom = y + shsurf->geometry.height;
- if (bottom - panel_height < safety)
- y = panel_height + safety -
- shsurf->geometry.height;
+ bottom = y + shsurf->geometry.height + shsurf->geometry.y;
+ if (bottom - safety < area.y)
+ y = area.y + safety - shsurf->geometry.height
+ - shsurf->geometry.y;
if (move->client_initiated &&
- y + shsurf->geometry.y < panel_height)
- y = panel_height - shsurf->geometry.y;
+ y + shsurf->geometry.y < area.y)
+ y = area.y - shsurf->geometry.y;
+
}
*cx = x;