From efc82ee1b9b792ec8e7f8c4f9a2adc5afe0fafcd Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 28 Sep 2002 03:11:04 +0000 Subject: constrain placement to try to keep windows from going offscreen to the 2002-09-27 Havoc Pennington * src/place.c (constrain_placement): constrain placement to try to keep windows from going offscreen to the right/bottom * src/stack.c (compute_layer): rearrange the logic here to say that a window must always be in at least as high a layer as any of its transient parents or group members, rather than special-casing fullscreen. Also, group_member_is_fullscreen was leaking the list of group members every time, a fairly major memory leak. --- src/place.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/place.c') diff --git a/src/place.c b/src/place.c index 3331409a..7c9a2a60 100644 --- a/src/place.c +++ b/src/place.c @@ -576,7 +576,11 @@ constrain_placement (MetaWindow *window, */ MetaRectangle work_area; int nw_x, nw_y; - + int offscreen_w, offscreen_h; + MetaRectangle outer_rect; + + meta_window_get_outer_rect (window, &outer_rect); + /* FIXME this is bogus because we get the current xinerama * for the window based on its position, but we haven't * placed it yet. @@ -591,7 +595,17 @@ constrain_placement (MetaWindow *window, nw_y += fgeom->top_height; } - /* Keep window from going off left edge, though we don't have + /* Keep window from going off the bottom right, though we don't have + * this constraint once the window has been placed + */ + offscreen_w = (outer_rect.x + outer_rect.width) - (work_area.x + work_area.width); + if (offscreen_w > 0) + nw_x -= offscreen_w; + offscreen_h = (outer_rect.y + outer_rect.height) - (work_area.y + work_area.height); + if (offscreen_h > 0) + nw_y -= offscreen_h; + + /* Keep window from going off left edge, though again we don't have * this constraint once the window has been placed. */ if (x < nw_x) -- cgit v1.2.1