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.