diff options
author | Elijah Newren <newren gmail com> | 2006-04-02 23:11:25 +0000 |
---|---|---|
committer | Elijah Newren <newren@src.gnome.org> | 2006-04-02 23:11:25 +0000 |
commit | 8674051c583a5d43bd0864d795ec4f011b065f84 (patch) | |
tree | 47b64e632599a9c4681d9781703ee00a8d3b0b97 | |
parent | cb109b9637a4ac1e920091d4902a216904ef38ca (diff) | |
download | metacity-8674051c583a5d43bd0864d795ec4f011b065f84.tar.gz |
Fix constraints bug causing negative width windows and crashes. #336651
2006-04-02 Elijah Newren <newren gmail com>
Fix constraints bug causing negative width windows and crashes.
#336651
* src/constraints.c (constrain_partially_onscreen): Don't
accidentally shove & resize the window by requiring more pixels to
be onscreen than the size of the window.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/constraints.c | 4 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,12 @@ +2006-04-02 Elijah Newren <newren gmail com> + + Fix constraints bug causing negative width windows and crashes. + #336651 + + * src/constraints.c (constrain_partially_onscreen): Don't + accidentally shove & resize the window by requiring more pixels to + be onscreen than the size of the window. + Fri Mar 31 16:44:56 2006 Søren Sandmann <sandmann@redhat.com> * src/c-screen.c (meta_screen_info_unredirect): Release the GL diff --git a/src/constraints.c b/src/constraints.c index 15b6c46c..06d65bc8 100644 --- a/src/constraints.c +++ b/src/constraints.c @@ -1080,7 +1080,7 @@ constrain_partially_onscreen (MetaWindow *window, * window width/height but clamp to the range of (10,75) pixels. This is * somewhat of a seat of my pants random guess at what might look good. * Then, the amount that is allowed off is just the window size minus - * this amount. + * this amount (but no less than 0 for tiny windows). */ horiz_amount_onscreen = info->current.width / 4; vert_amount_onscreen = info->current.height / 4; @@ -1088,6 +1088,8 @@ constrain_partially_onscreen (MetaWindow *window, vert_amount_onscreen = CLAMP (vert_amount_onscreen, 10, 75); horiz_amount_offscreen = info->current.width - horiz_amount_onscreen; vert_amount_offscreen = info->current.height - vert_amount_onscreen; + horiz_amount_offscreen = MAX (horiz_amount_offscreen, 0); + vert_amount_offscreen = MAX (vert_amount_offscreen, 0); top_amount = vert_amount_offscreen; /* Allow the titlebar to touch the bottom panel; If there is no titlebar, * require vert_amount to remain on the screen. |