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.
This commit is contained in:
Elijah Newren 2006-04-02 23:11:25 +00:00 committed by Elijah Newren
parent cb109b9637
commit 8674051c58
2 changed files with 12 additions and 1 deletions

View File

@ -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> Fri Mar 31 16:44:56 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-screen.c (meta_screen_info_unredirect): Release the GL * src/c-screen.c (meta_screen_info_unredirect): Release the GL

View File

@ -1080,7 +1080,7 @@ constrain_partially_onscreen (MetaWindow *window,
* window width/height but clamp to the range of (10,75) pixels. This is * 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. * 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 * 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; horiz_amount_onscreen = info->current.width / 4;
vert_amount_onscreen = info->current.height / 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); vert_amount_onscreen = CLAMP (vert_amount_onscreen, 10, 75);
horiz_amount_offscreen = info->current.width - horiz_amount_onscreen; horiz_amount_offscreen = info->current.width - horiz_amount_onscreen;
vert_amount_offscreen = info->current.height - vert_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; top_amount = vert_amount_offscreen;
/* Allow the titlebar to touch the bottom panel; If there is no titlebar, /* Allow the titlebar to touch the bottom panel; If there is no titlebar,
* require vert_amount to remain on the screen. * require vert_amount to remain on the screen.