From 8674051c583a5d43bd0864d795ec4f011b065f84 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sun, 2 Apr 2006 23:11:25 +0000 Subject: [PATCH] Fix constraints bug causing negative width windows and crashes. #336651 2006-04-02 Elijah Newren 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. --- ChangeLog | 9 +++++++++ src/constraints.c | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8ffadfcb4..727a163b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-04-02 Elijah Newren + + 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 * src/c-screen.c (meta_screen_info_unredirect): Release the GL diff --git a/src/constraints.c b/src/constraints.c index 15b6c46ca..06d65bc83 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.