summaryrefslogtreecommitdiffstats
path: root/generic/tkPack.c
diff options
context:
space:
mode:
authormdejong <mdejong>2003-03-12 00:09:32 (GMT)
committermdejong <mdejong>2003-03-12 00:09:32 (GMT)
commit6be1cd95fff709a3869038db3e989865154259fb (patch)
treeecef370c50b2d02b66d81ba8deaa5e9601199442 /generic/tkPack.c
parent7be603f3c85d34e87e54b45c813ecbe337c89854 (diff)
downloadtk-6be1cd95fff709a3869038db3e989865154259fb.zip
tk-6be1cd95fff709a3869038db3e989865154259fb.tar.gz
tk-6be1cd95fff709a3869038db3e989865154259fb.tar.bz2
* generic/tkGrid.c (GridStructureProc, ConfigureSlaves):
Check for a NULL masterPtr and slavePtr in the GridStructureProc code to ensure that a Gridder created before some error condition is ignored when it comes to geometry calculations. This approach closely matches the pack implementation. Keep track of a -in argument to a grid command in order to detect the case of an already gridded widget that wants to change some options. The previous implementation could make repeated and unnecessary calls to Tk_ManageGeometry. Replace use of "parent" with "master" in comments throughout the file. * generic/tkPack.c (PackStructureProc): Check for a NULL masterPtr before other checks so that a slave created under certain error conditions is cleaned up properly. Replace use of "parent" with "master" in comments throughout the file. * generic/tkPlace.c (CreateSlave, ConfigureSlave, SlaveStructureProc): Don't call Tk_ManageGeometry in CreateSlave since this was causing incorrect results in some error cases. Rework the ConfigureSlave method so that slave setup is done in one place. The call to Tk_ManageGeometry was added to the one place where a slave is setup. When a slave is configured but the master is not changed, simply goto the scheduleLayout label. Check for a NULL master in SlaveStructureProc for the sake of readability. * tests/grid.test: * tests/pack.test: * tests/place.test: Add test to check that a winfo manager call does not return incorrect results after an error condition is hit. [Patch 693063]
Diffstat (limited to 'generic/tkPack.c')
-rw-r--r--generic/tkPack.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 607af25..cdb52be 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPack.c,v 1.16 2002/06/14 22:25:12 jenglish Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.17 2003/03/12 00:09:36 mdejong Exp $
*/
#include "tkPort.h"
@@ -37,12 +37,12 @@ typedef struct Packer {
* is packed (NULL means this window
* isn't managed by the packer). */
struct Packer *nextPtr; /* Next window packed within same
- * parent. List is priority-ordered:
+ * master. List is priority-ordered:
* first on list gets packed first. */
struct Packer *slavePtr; /* First in list of slaves packed
* inside this window (NULL means
* no packed slaves). */
- Side side; /* Side of parent against which
+ Side side; /* Side of master against which
* this window is packed. */
Tk_Anchor anchor; /* If frame allocated for window is larger
* than window needs, this indicates how
@@ -60,7 +60,7 @@ typedef struct Packer {
* each side). */
int doubleBw; /* Twice the window's last known border
* width. If this changes, the window
- * must be repacked within its parent. */
+ * must be repacked within its master. */
int *abortPtr; /* If non-NULL, it means that there is a nested
* call to ArrangePacking already working on
* this window. *abortPtr may be set to 1 to
@@ -83,7 +83,7 @@ typedef struct Packer {
* any larger than needed.
* FILLY: Same as FILLX, except for height.
* EXPAND: 1 means this window's frame will absorb any
- * extra space in the parent window.
+ * extra space in the master window.
* OLD_STYLE: 1 means this window is being managed with
* the old-style packer algorithms (before
* Tk version 3.3). The main difference is
@@ -544,7 +544,7 @@ PackLostSlaveProc(clientData, tkwin)
static void
ArrangePacking(clientData)
- ClientData clientData; /* Structure describing parent whose slaves
+ ClientData clientData; /* Structure describing master whose slaves
* are to be re-layed out. */
{
register Packer *masterPtr = (Packer *) clientData;
@@ -552,7 +552,7 @@ ArrangePacking(clientData)
int cavityX, cavityY, cavityWidth, cavityHeight;
/* These variables keep track of the
* as-yet-unallocated space remaining in
- * the middle of the parent window. */
+ * the middle of the master window. */
int frameX, frameY, frameWidth, frameHeight;
/* These variables keep track of the frame
* allocated to the current window. */
@@ -568,8 +568,8 @@ ArrangePacking(clientData)
masterPtr->flags &= ~REQUESTED_REPACK;
/*
- * If the parent has no slaves anymore, then don't do anything
- * at all: just leave the parent's size as-is.
+ * If the master has no slaves anymore, then don't do anything
+ * at all: just leave the master's size as-is.
*/
if (masterPtr->slavePtr == NULL) {
@@ -648,10 +648,10 @@ ArrangePacking(clientData)
}
/*
- * If the total amount of space needed in the parent window has
+ * If the total amount of space needed in the master window has
* changed, and if we're propagating geometry information, then
* notify the next geometry manager up and requeue ourselves to
- * start again after the parent has had a chance to
+ * start again after the master has had a chance to
* resize us.
*/
@@ -1129,7 +1129,7 @@ TkParsePadAmount(interp, tkwin, specObj, halfPtr, allPtr)
* PackAfter --
*
* This procedure does most of the real work of adding
- * one or more windows into the packing order for its parent.
+ * one or more windows into the packing order for its master.
*
* Results:
* A standard Tcl return value.
@@ -1316,7 +1316,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
}
/*
- * Add the window in the correct place in its parent's
+ * Add the window in the correct place in its master's
* packing order, then make sure that the window is
* managed by us.
*/
@@ -1334,7 +1334,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
}
/*
- * Arrange for the parent to be re-packed at the first
+ * Arrange for the master to be re-packed at the first
* idle moment.
*/
@@ -1353,13 +1353,13 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
*
* Unlink --
*
- * Remove a packer from its parent's list of slaves.
+ * Remove a packer from its master's list of slaves.
*
* Results:
* None.
*
* Side effects:
- * The parent will be scheduled for repacking.
+ * The master will be scheduled for repacking.
*
*----------------------------------------------------------------------
*/
@@ -1458,9 +1458,9 @@ PackStructureProc(clientData, eventPtr)
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr);
}
- if (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width) {
- if ((packPtr->masterPtr != NULL)
- && !(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
+ if ((packPtr->masterPtr != NULL)
+ && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
+ if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
packPtr->masterPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr->masterPtr);
@@ -1759,7 +1759,8 @@ ConfigureSlaves(interp, tkwin, objc, objv)
}
/*
- * If the slave is going to be put back after itself then
+ * If the slave is going to be put back after itself or
+ * the same -in window is passed in again, then just
* skip the whole operation, since it won't work anyway.
*/
@@ -1834,7 +1835,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
prevPtr = slavePtr;
/*
- * Arrange for the parent to be re-packed at the first
+ * Arrange for the master to be re-packed at the first
* idle moment.
*/