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>
This commit is contained in:
committed by
Bryce Harrington
parent
612341f1a6
commit
6feb0f9f55
+12
-9
@@ -1668,24 +1668,27 @@ constrain_position(struct weston_move_grab *move, int *cx, int *cy)
|
|||||||
{
|
{
|
||||||
struct shell_surface *shsurf = move->base.shsurf;
|
struct shell_surface *shsurf = move->base.shsurf;
|
||||||
struct weston_pointer *pointer = move->base.grab.pointer;
|
struct weston_pointer *pointer = move->base.grab.pointer;
|
||||||
int x, y, panel_width, panel_height, bottom;
|
int x, y, bottom;
|
||||||
const int safety = 50;
|
const int safety = 50;
|
||||||
|
pixman_rectangle32_t area;
|
||||||
|
|
||||||
x = wl_fixed_to_int(pointer->x + move->dx);
|
x = wl_fixed_to_int(pointer->x + move->dx);
|
||||||
y = wl_fixed_to_int(pointer->y + move->dy);
|
y = wl_fixed_to_int(pointer->y + move->dy);
|
||||||
|
|
||||||
if (shsurf->shell->panel_position == DESKTOP_SHELL_PANEL_POSITION_TOP) {
|
if (shsurf->shell->panel_position == DESKTOP_SHELL_PANEL_POSITION_TOP) {
|
||||||
get_output_panel_size(shsurf->shell, shsurf->surface->output,
|
get_output_work_area(shsurf->shell,
|
||||||
&panel_width, &panel_height);
|
shsurf->surface->output,
|
||||||
|
&area);
|
||||||
|
|
||||||
bottom = y + shsurf->geometry.height;
|
bottom = y + shsurf->geometry.height + shsurf->geometry.y;
|
||||||
if (bottom - panel_height < safety)
|
if (bottom - safety < area.y)
|
||||||
y = panel_height + safety -
|
y = area.y + safety - shsurf->geometry.height
|
||||||
shsurf->geometry.height;
|
- shsurf->geometry.y;
|
||||||
|
|
||||||
if (move->client_initiated &&
|
if (move->client_initiated &&
|
||||||
y + shsurf->geometry.y < panel_height)
|
y + shsurf->geometry.y < area.y)
|
||||||
y = panel_height - shsurf->geometry.y;
|
y = area.y - shsurf->geometry.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*cx = x;
|
*cx = x;
|
||||||
|
|||||||
Reference in New Issue
Block a user