diff options
author | Havoc Pennington <hp@pobox.com> | 2002-09-28 03:11:04 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-09-28 03:11:04 +0000 |
commit | efc82ee1b9b792ec8e7f8c4f9a2adc5afe0fafcd (patch) | |
tree | c6daf277af69f48242993d85dbb5e2da9de55595 /src/place.c | |
parent | 5ae85e9c070f9929ecf97b7fd561952152b4d7b6 (diff) | |
download | metacity-efc82ee1b9b792ec8e7f8c4f9a2adc5afe0fafcd.tar.gz |
constrain placement to try to keep windows from going offscreen to the
2002-09-27 Havoc Pennington <hp@pobox.com>
* 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.
Diffstat (limited to 'src/place.c')
-rw-r--r-- | src/place.c | 18 |
1 files changed, 16 insertions, 2 deletions
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) |