summaryrefslogtreecommitdiffstats
path: root/generic/tkGrid.c
diff options
context:
space:
mode:
authorpspjuth <peter.spjuth@gmail.com>2005-04-03 15:21:47 (GMT)
committerpspjuth <peter.spjuth@gmail.com>2005-04-03 15:21:47 (GMT)
commit5f22350bce26c673b27a3020578d27f7383e18ed (patch)
tree8a08bc26118d895204f0b23b236fbc240f9a72e2 /generic/tkGrid.c
parentd68a04d73a0f026078896a5862436d5539f63a1c (diff)
downloadtk-5f22350bce26c673b27a3020578d27f7383e18ed.zip
tk-5f22350bce26c673b27a3020578d27f7383e18ed.tar.gz
tk-5f22350bce26c673b27a3020578d27f7383e18ed.tar.bz2
Fixed bug in geometry calculations for
widgets that span multiple columns/row. Bug was introduced in 8.5a1 when fixing 792387. [Bug 1175092]
Diffstat (limited to 'generic/tkGrid.c')
-rw-r--r--generic/tkGrid.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 7cdbb80..8f8c33a 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGrid.c,v 1.35 2005/01/11 10:35:27 dkf Exp $
+ * RCS: @(#) $Id: tkGrid.c,v 1.36 2005/04/03 15:21:48 pspjuth Exp $
*/
#include "tkInt.h"
@@ -2097,7 +2097,7 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
* its range of possible values fixed at a single value.
*/
- for (start=0; start < gridCount;) {
+ for (start = 0; start < gridCount;) {
int totalWeight = 0; /* Sum of the weights for all of the
* slots in this span. */
int need = 0; /* The minimum space needed to layout
@@ -2119,7 +2119,7 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
continue;
}
- for (end=start+1; end<gridCount; end++) {
+ for (end = start + 1; end < gridCount; end++) {
if (layoutPtr[end].minOffset == layoutPtr[end].maxOffset) {
break;
}
@@ -2131,7 +2131,7 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
* use.
*/
- for (slot=start; slot<=end; slot++) {
+ for (slot = start; slot <= end; slot++) {
totalWeight += layoutPtr[slot].weight;
need += layoutPtr[slot].minSize;
}
@@ -2255,9 +2255,14 @@ ResolveConstraints(masterPtr, slotType, maxOffset)
* to propagate the new space allocation.
*/
- for (slot=end; slot > start; slot--) {
- layoutPtr[slot-1].maxOffset =
- layoutPtr[slot].maxOffset-layoutPtr[slot].minSize;
+ for (slot = end; slot > start; slot--) {
+ /* maxOffset may not go up */
+ if ((layoutPtr[slot].maxOffset-layoutPtr[slot].minSize)
+ < layoutPtr[slot-1].maxOffset)
+ {
+ layoutPtr[slot-1].maxOffset =
+ layoutPtr[slot].maxOffset-layoutPtr[slot].minSize;
+ }
}
}