Skip to content

Commit

Permalink
Merge 8.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jan.nijtmans committed Oct 9, 2024
2 parents 889aa68 + de84349 commit ab7f637
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 37 deletions.
82 changes: 61 additions & 21 deletions generic/tkGrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,9 @@ GridAnchorCommand(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}

if (objc == 3) {
gridPtr = containerPtr->containerDataPtr;
Expand Down Expand Up @@ -531,7 +533,9 @@ GridBboxCommand(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}

if (objc >= 5) {
if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) {
Expand Down Expand Up @@ -655,7 +659,9 @@ GridForgetRemoveCommand(
return TCL_ERROR;
}

contentPtr = GetGrid(content);
if (!(contentPtr = GetGrid(content))) {
continue;
}
if (contentPtr->containerPtr != NULL) {
/*
* For "forget", reset all the settings to their defaults
Expand Down Expand Up @@ -745,7 +751,9 @@ GridInfoCommand(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
contentPtr = GetGrid(content);
if (!(contentPtr = GetGrid(content))) {
return TCL_OK;
}
if (contentPtr->containerPtr == NULL) {
Tcl_ResetResult(interp);
return TCL_OK;
Expand Down Expand Up @@ -820,7 +828,9 @@ GridLocationCommand(
return TCL_ERROR;
}

containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}
if (containerPtr->containerDataPtr == NULL) {
Tcl_SetObjResult(interp, NewPairObj(-1, TCL_INDEX_NONE));
return TCL_OK;
Expand Down Expand Up @@ -901,7 +911,9 @@ GridPropagateCommand(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}
if (objc == 3) {
Tcl_SetObjResult(interp,
Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
Expand Down Expand Up @@ -1023,7 +1035,9 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}

containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}
first = 0;
last = 0;

Expand Down Expand Up @@ -1139,7 +1153,9 @@ GridRowColumnConfigureCommand(
* Is it gridded in this container?
*/

contentPtr = GetGrid(content);
if (!(contentPtr = GetGrid(content))) {
continue;
}
if (contentPtr->containerPtr != containerPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"the window \"%s\" is not managed by \"%s\"",
Expand Down Expand Up @@ -1322,7 +1338,9 @@ GridSizeCommand(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}

if (containerPtr->containerDataPtr != NULL) {
SetGridSize(containerPtr);
Expand Down Expand Up @@ -1401,7 +1419,9 @@ GridContentCommand(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
containerPtr = GetGrid(container);
if (!(containerPtr = GetGrid(container))) {
return TCL_OK;
}

res = Tcl_NewListObj(0, NULL);
for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
Expand Down Expand Up @@ -2417,11 +2437,12 @@ ResolveConstraints(
* GetGrid --
*
* This internal procedure is used to locate a Grid structure for a given
* window, creating one if one doesn't exist already.
* window, creating one if one doesn't exist already, except if the window
* is already dead.
*
* Results:
* The return value is a pointer to the Grid structure corresponding to
* tkwin.
* tkwin, or NULL when tkwin is already dead.
*
* Side effects:
* A new grid structure may be created. If so, then a callback is set up
Expand All @@ -2440,6 +2461,10 @@ GetGrid(
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;

if (((TkWindow *) tkwin)->flags & TK_ALREADY_DEAD) {
return NULL;
}

if (!dispPtr->gridInit) {
Tcl_InitHashTable(&dispPtr->gridHashTable, TCL_ONE_WORD_KEYS);
dispPtr->gridInit = 1;
Expand Down Expand Up @@ -2479,7 +2504,6 @@ GetGrid(
gridPtr->sticky = 0;
gridPtr->size = 0;
gridPtr->in = NULL;
gridPtr->containerDataPtr = NULL;
Tcl_SetHashValue(hPtr, gridPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
GridStructureProc, gridPtr);
Expand Down Expand Up @@ -3012,19 +3036,25 @@ ConfigureContent(
* If the stored container does not exist, just ignore it.
*/

contentPtr = GetGrid(content);
if (!(contentPtr = GetGrid(content))) {
continue;
}
if (contentPtr->in != NULL) {
if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent)
== TCL_OK) {
containerPtr = GetGrid(parent);
if (!(containerPtr = GetGrid(parent))) {
continue;
}
InitContainerData(containerPtr);
}
}
}
if (containerPtr == NULL) {
parent = Tk_Parent(content);
if (parent != NULL) {
containerPtr = GetGrid(parent);
if (!(containerPtr = GetGrid(parent))) {
continue;
}
InitContainerData(containerPtr);
}
}
Expand Down Expand Up @@ -3093,7 +3123,9 @@ ConfigureContent(
TCL_OK) {
return TCL_ERROR;
}
containerPtr = GetGrid(other);
if (!(containerPtr = GetGrid(other))) {
continue;
}
InitContainerData(containerPtr);
} else if (index == CONF_ROW) {
if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK
Expand Down Expand Up @@ -3170,7 +3202,9 @@ ConfigureContent(
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", (char *)NULL);
return TCL_ERROR;
}
contentPtr = GetGrid(content);
if (!(contentPtr = GetGrid(content))) {
continue;
}

/*
* The following statement is taken from tkPack.c:
Expand Down Expand Up @@ -3229,7 +3263,9 @@ ConfigureContent(
return TCL_ERROR;
}
positionGiven = 1;
containerPtr = GetGrid(other);
if (!(containerPtr = GetGrid(other))) {
continue;
}
InitContainerData(containerPtr);
break;
case CONF_STICKY: {
Expand Down Expand Up @@ -3336,7 +3372,9 @@ ConfigureContent(

parent = Tk_Parent(content);
if (containerPtr == NULL) {
containerPtr = GetGrid(parent);
if (!(containerPtr = GetGrid(parent))) {
continue;
}
InitContainerData(containerPtr);
}

Expand Down Expand Up @@ -3495,7 +3533,9 @@ ConfigureContent(
lastColumn = 0;
} else {
other = Tk_NameToWindow(interp, lastWindow, tkwin);
otherPtr = GetGrid(other);
if (!(otherPtr = GetGrid(other))) {
continue;
}
lastRow = otherPtr->row + otherPtr->numRows - 2;
lastColumn = otherPtr->column + otherPtr->numCols;
}
Expand Down
Loading

0 comments on commit ab7f637

Please sign in to comment.