summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren gmail com>2006-04-02 23:13:23 +0000
committerElijah Newren <newren@src.gnome.org>2006-04-02 23:13:23 +0000
commitdd4261b1011c07cb752d95f8811b60505dd7ee7a (patch)
treef7002844fbd50e17b7fe2022fcb70db671e6415c
parent106ad6e10165a3ddbdfb627b71c057c18b29a39d (diff)
downloadmetacity-dd4261b1011c07cb752d95f8811b60505dd7ee7a.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--ChangeLog9
-rw-r--r--src/constraints.c4
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 57e18877..6f45cb9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
+
2006-03-29 Elijah Newren <newren gmail com>
Fix grouping in the presence of ancestors; caught by Björn.
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.