Tk Source Code

Changes On Branch tip-698
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch tip-698 Excluding Merge-Ins

This is equivalent to a diff from 7af6ab73 to c88d91ab

2025-05-15
09:23
TIP #698: Handle negative screen distances check-in: 8c61b856 user: jan.nijtmans tags: trunk, main
2025-05-04
15:31
Fix [c04e2aafd2]: Useless element in result for test winDialog-10.3 check-in: 3202b552 user: fvogel tags: trunk, main
2025-05-02
11:55
Merge trunk check-in: 5393901d user: kevin_walzer tags: tka11y
2025-05-01
22:19
Fix two problems printing text on windows: [_gdi characters] creates an array variable in the global scope, so move it to the ::tk::print namespace; also, provide a default width for those characters not in the array. No more 'can't read "charwidths(‾)": no such element in array' errors. check-in: 8514a4fc user: emiliano tags: tk-print-fixes
06:57
Merge trunk check-in: 1e599672 user: jan.nijtmans tags: revised_text, tip-466
2025-04-30
12:07
Rebase to trunk Closed-Leaf check-in: c88d91ab user: jan.nijtmans tags: tip-698, core-tip-698
12:05
Merge-mark check-in: 7af6ab73 user: jan.nijtmans tags: trunk, main
12:01
Accept [718cbc3016]: Collect utility procs for the Tk test suite check-in: 0318c8ea user: jan.nijtmans tags: core-9-0-branch
2025-04-29
20:54
Fix [9b23b6ca23]: [tk print] canvas with smooth lines crashes on windows. Patch by Emiliano Gavilan. check-in: 442b8957 user: fvogel tags: trunk, main
2025-02-21
15:06
Merge 9.0 check-in: 3f5f54b6 user: jan.nijtmans tags: tip-698

Changes to generic/tk.h.
224
225
226
227
228
229
230

231
232
233
234
235
236
237
/*
 * Flag values for Tk_OptionSpec structures. These flags are shared by
 * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully.
 */

#define TK_OPTION_DONT_SET_DEFAULT	(1 << 3)
#define TK_OPTION_NULL_OK		TCL_NULL_OK

#define TK_OPTION_VAR(type)		((sizeof(type) < 2 * sizeof(int)) ? ((int)(sizeof(type)&(sizeof(int)-1))<<6) : (3<<6))
#define TK_OPTION_ENUM_VAR		TK_OPTION_VAR(Tk_OptionType)

/*
 * The following structure and function types are used by TK_OPTION_CUSTOM
 * options; the structure holds pointers to the functions needed by the Tk
 * option config code to handle a custom option.







>







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
/*
 * Flag values for Tk_OptionSpec structures. These flags are shared by
 * Tk_ConfigSpec structures, so be sure to coordinate any changes carefully.
 */

#define TK_OPTION_DONT_SET_DEFAULT	(1 << 3)
#define TK_OPTION_NULL_OK		TCL_NULL_OK
#define TK_OPTION_NEG_OK		(1 << 6) /* For TK_OPTION_PIXELS only, so no conflict with TK_OPTION_VAR */
#define TK_OPTION_VAR(type)		((sizeof(type) < 2 * sizeof(int)) ? ((int)(sizeof(type)&(sizeof(int)-1))<<6) : (3<<6))
#define TK_OPTION_ENUM_VAR		TK_OPTION_VAR(Tk_OptionType)

/*
 * The following structure and function types are used by TK_OPTION_CUSTOM
 * options; the structure holds pointers to the functions needed by the Tk
 * option config code to handle a custom option.
Changes to generic/tkButton.c.
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
    Tcl_Size objc,			/* Number of arguments. */
    Tcl_Obj *const objv[])	/* Argument values. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *errorResult = NULL;
    int error, haveImage;
    Tk_Image image;
    int wrapLength, borderWidth, highlightWidth, padX, padY;
    int width, height;

    /*
     * Eliminate any existing trace on variables monitored by the button.
     */

    if (butPtr->textVarNamePtr != NULL) {







<







1023
1024
1025
1026
1027
1028
1029

1030
1031
1032
1033
1034
1035
1036
    Tcl_Size objc,			/* Number of arguments. */
    Tcl_Obj *const objv[])	/* Argument values. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *errorResult = NULL;
    int error, haveImage;
    Tk_Image image;

    int width, height;

    /*
     * Eliminate any existing trace on variables monitored by the button.
     */

    if (butPtr->textVarNamePtr != NULL) {
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136

	if ((butPtr->state == STATE_ACTIVE)
		&& !Tk_StrictMotif(butPtr->tkwin)) {
	    Tk_SetBackgroundFromBorder(butPtr->tkwin, butPtr->activeBorder);
	} else {
	    Tk_SetBackgroundFromBorder(butPtr->tkwin, butPtr->normalBorder);
	}
	Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->borderWidthObj, &borderWidth);
	if (borderWidth < 0) {
	    borderWidth = 0;
	    Tcl_DecrRefCount(butPtr->borderWidthObj);
	    butPtr->borderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(butPtr->borderWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->highlightWidthObj, &highlightWidth);
	if (highlightWidth < 0) {
	    highlightWidth = 0;
	    Tcl_DecrRefCount(butPtr->highlightWidthObj);
	    butPtr->highlightWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(butPtr->highlightWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padXObj, &padX);
	if (padX < 0) {
	    padX = 0;
	    Tcl_DecrRefCount(butPtr->padXObj);
	    butPtr->padXObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(butPtr->padXObj);
	}
	Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->padYObj, &padY);
	if (padY < 0) {
	    padY = 0;
	    Tcl_DecrRefCount(butPtr->padYObj);
	    butPtr->padYObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(butPtr->padYObj);
	}
	Tk_GetPixelsFromObj(NULL, butPtr->tkwin, butPtr->wrapLengthObj, &wrapLength);
	if (wrapLength < 0) {
	    wrapLength = 0;
	    Tcl_DecrRefCount(butPtr->wrapLengthObj);
	    butPtr->wrapLengthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(butPtr->wrapLengthObj);
	}

	if (butPtr->type >= TYPE_CHECK_BUTTON) {
	    Tcl_Obj *valuePtr, *namePtr;

	    if (butPtr->selVarNamePtr == NULL) {
		butPtr->selVarNamePtr = Tcl_NewStringObj(
			Tk_Name(butPtr->tkwin), TCL_INDEX_NONE);







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1087
1088
1089
1090
1091
1092
1093



































1094
1095
1096
1097
1098
1099
1100

	if ((butPtr->state == STATE_ACTIVE)
		&& !Tk_StrictMotif(butPtr->tkwin)) {
	    Tk_SetBackgroundFromBorder(butPtr->tkwin, butPtr->activeBorder);
	} else {
	    Tk_SetBackgroundFromBorder(butPtr->tkwin, butPtr->normalBorder);
	}




































	if (butPtr->type >= TYPE_CHECK_BUTTON) {
	    Tcl_Obj *valuePtr, *namePtr;

	    if (butPtr->selVarNamePtr == NULL) {
		butPtr->selVarNamePtr = Tcl_NewStringObj(
			Tk_Name(butPtr->tkwin), TCL_INDEX_NONE);
Changes to generic/tkCanvArc.c.
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
    {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
	"0.0", offsetof(ArcItem, outline.activeWidth),
	TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(ArcItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(ArcItem, outline.offsetObj), TK_CONFIG_OBJS, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(ArcItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
	NULL, offsetof(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},







|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
    {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
	"0.0", offsetof(ArcItem, outline.activeWidth),
	TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(ArcItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(ArcItem, outline.offsetObj), TK_CONFIG_OBJS|TK_OPTION_NEG_OK, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(ArcItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
	NULL, offsetof(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
Changes to generic/tkCanvLine.c.
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
	"butt", offsetof(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
    {TK_CONFIG_COLOR, "-fill", NULL, NULL,
	DEF_CANVITEM_OUTLINE, offsetof(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(LineItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(LineItem, outline.offsetObj), TK_CONFIG_OBJS, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(LineItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
	NULL, offsetof(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},







|







183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
	"butt", offsetof(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
    {TK_CONFIG_COLOR, "-fill", NULL, NULL,
	DEF_CANVITEM_OUTLINE, offsetof(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(LineItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(LineItem, outline.offsetObj), TK_CONFIG_OBJS|TK_OPTION_NEG_OK, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(LineItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
	NULL, offsetof(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},
Changes to generic/tkCanvPoly.c.
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
	"0.0", offsetof(PolygonItem, outline.activeWidth),
	TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(PolygonItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(PolygonItem, outline.offsetObj), TK_CONFIG_OBJS, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(PolygonItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
	NULL, offsetof(PolygonItem, outline.disabledColor),







|







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
    {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
	"0.0", offsetof(PolygonItem, outline.activeWidth),
	TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(PolygonItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(PolygonItem, outline.offsetObj), TK_CONFIG_OBJS|TK_OPTION_NEG_OK, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(PolygonItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
	NULL, offsetof(PolygonItem, outline.disabledColor),
Changes to generic/tkCanvas.c.
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->highlightWidthObj, &highlightWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved1, &canvasPtr->textInfo.insertBorderWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved2, &canvasPtr->textInfo.insertWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved3, &canvasPtr->textInfo.selBorderWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->widthObj, &width);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->xScrollIncrementObj, &xScrollIncrement);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->yScrollIncrementObj, &yScrollIncrement);
    if (borderWidth < 0) {
	borderWidth = 0;
	Tcl_DecrRefCount(canvasPtr->borderWidthObj);
	canvasPtr->borderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(canvasPtr->borderWidthObj);
    }
    if (height < 0) {
	height = 0;
	Tcl_DecrRefCount(canvasPtr->heightObj);
	canvasPtr->heightObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(canvasPtr->heightObj);
    }
    if (highlightWidth < 0) {
	highlightWidth = 0;
	Tcl_DecrRefCount(canvasPtr->highlightWidthObj);
	canvasPtr->highlightWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(canvasPtr->highlightWidthObj);
    }
    if (width < 0) {
	width = 0;
	Tcl_DecrRefCount(canvasPtr->widthObj);
	canvasPtr->widthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(canvasPtr->widthObj);
    }
    if (xScrollIncrement < 0) {
	xScrollIncrement = 0;
	Tcl_DecrRefCount(canvasPtr->xScrollIncrementObj);
	canvasPtr->xScrollIncrementObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(canvasPtr->xScrollIncrementObj);
    }
    if (yScrollIncrement < 0) {
	yScrollIncrement = 0;
	Tcl_DecrRefCount(canvasPtr->yScrollIncrementObj);
	canvasPtr->yScrollIncrementObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(canvasPtr->yScrollIncrementObj);
    }
    canvasPtr->inset = borderWidth + highlightWidth;
    if (canvasPtr->textInfo.insertBorderWidth < 0) {
	canvasPtr->textInfo.insertBorderWidth = 0;
	Tcl_DecrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved1);
	canvasPtr->textInfo.reserved1 = Tcl_NewIntObj(0);
	Tcl_IncrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved1);
    }
    if (canvasPtr->textInfo.insertWidth < 0) {
	canvasPtr->textInfo.insertWidth = 0;
	Tcl_DecrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved2);
	canvasPtr->textInfo.reserved2 = Tcl_NewIntObj(0);
	Tcl_IncrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved2);
    }
    if (canvasPtr->textInfo.selBorderWidth < 0) {
	canvasPtr->textInfo.selBorderWidth = 0;
	Tcl_DecrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved3);
	canvasPtr->textInfo.reserved3 = Tcl_NewIntObj(0);
	Tcl_IncrRefCount((Tcl_Obj *)canvasPtr->textInfo.reserved3);
    }

    gcValues.function = GXcopy;
    gcValues.graphics_exposures = False;
    gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
    newGC = Tk_GetGC(canvasPtr->tkwin,
	    GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
    if (canvasPtr->pixmapGC != NULL) {







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







2285
2286
2287
2288
2289
2290
2291




































2292


















2293
2294
2295
2296
2297
2298
2299
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->highlightWidthObj, &highlightWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved1, &canvasPtr->textInfo.insertBorderWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved2, &canvasPtr->textInfo.insertWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, (Tcl_Obj *)canvasPtr->textInfo.reserved3, &canvasPtr->textInfo.selBorderWidth);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->widthObj, &width);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->xScrollIncrementObj, &xScrollIncrement);
    Tk_GetPixelsFromObj(NULL, canvasPtr->tkwin, canvasPtr->yScrollIncrementObj, &yScrollIncrement);




































    canvasPtr->inset = borderWidth + highlightWidth;



















    gcValues.function = GXcopy;
    gcValues.graphics_exposures = False;
    gcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel;
    newGC = Tk_GetGC(canvasPtr->tkwin,
	    GCFunction|GCGraphicsExposures|GCForeground, &gcValues);
    if (canvasPtr->pixmapGC != NULL) {
Changes to generic/tkConfig.c.
1016
1017
1018
1019
1020
1021
1022

1023
1024

1025
1026
1027


1028
1029
1030
1031
1032
1033
1034

	if (nullOK && TkObjIsEmpty(valuePtr)) {
	    valuePtr = NULL;
	    newPixels = INT_MIN;
	} else if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, valuePtr,
		&newPixels) != TCL_OK) {
	    if (nullOK) {

	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
		    "expected screen distance or \"\" but got \"%.50s\"", Tcl_GetString(valuePtr)));

		Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", (char *)NULL);
	    }
	    return TCL_ERROR;


	}
	if (internalPtr != NULL) {
	    *((int *)oldInternalPtr) = *((int *)internalPtr);
	    *((int *)internalPtr) = newPixels;
	}
	break;
    }







>
|
|
>



>
>







1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038

	if (nullOK && TkObjIsEmpty(valuePtr)) {
	    valuePtr = NULL;
	    newPixels = INT_MIN;
	} else if (Tk_GetPixelsFromObj(nullOK ? NULL : interp, tkwin, valuePtr,
		&newPixels) != TCL_OK) {
	    if (nullOK) {
	    wrongPixel:
		Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			"expected screen distance%s but got \"%.50s\"",
			(nullOK ? " or \"\"": ""), Tcl_GetString(valuePtr)));
		Tcl_SetErrorCode(interp, "TK", "VALUE", "PIXELS", (char *)NULL);
	    }
	    return TCL_ERROR;
	} else if (!(optionPtr->specPtr->flags & TK_OPTION_NEG_OK) && (newPixels < 0)) {
	    goto wrongPixel;
	}
	if (internalPtr != NULL) {
	    *((int *)oldInternalPtr) = *((int *)internalPtr);
	    *((int *)internalPtr) = newPixels;
	}
	break;
    }
Changes to generic/tkEntry.c.
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
	    border = entryPtr->readonlyBorder;
	} else {
	    border = entryPtr->normalBorder;
	}
	Tk_SetBackgroundFromBorder(entryPtr->tkwin, border);

	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->borderWidthObj, &borderWidth);
	if (borderWidth < 0) {
	    borderWidth = 0;
	    Tcl_DecrRefCount(entryPtr->borderWidthObj);
	    entryPtr->borderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(entryPtr->borderWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->highlightWidthObj, &highlightWidth);
	if (highlightWidth < 0) {
	    highlightWidth = 0;
	    Tcl_DecrRefCount(entryPtr->highlightWidthObj);
	    entryPtr->highlightWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(entryPtr->highlightWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->insertBorderWidthObj, &insertBorderWidth);
	if (insertBorderWidth < 0) {
	    insertBorderWidth = 0;
	    Tcl_DecrRefCount(entryPtr->insertBorderWidthObj);
	    entryPtr->insertBorderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(entryPtr->insertBorderWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->insertWidthObj, &insertWidth);
	if (insertWidth < 0) {
	    insertWidth = 0;
	    Tcl_DecrRefCount(entryPtr->insertWidthObj);
	    entryPtr->insertWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(entryPtr->insertWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->selBorderWidthObj, &selBorderWidth);
	if (selBorderWidth < 0) {
	    selBorderWidth = 0;
	    Tcl_DecrRefCount(entryPtr->selBorderWidthObj);
	    entryPtr->selBorderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(entryPtr->selBorderWidthObj);
	}

	if (entryPtr->type == TK_SPINBOX) {
	    if (sbPtr->fromValue > sbPtr->toValue) {
		/*
		 * Swap -from and -to values.
		 */








<
<
<
<
<
<

<
<
<
<
<
<

<
<
<
<
<
<

<
<
<
<
<
<

<
<
<
<
<
<







1182
1183
1184
1185
1186
1187
1188






1189






1190






1191






1192






1193
1194
1195
1196
1197
1198
1199
	    border = entryPtr->readonlyBorder;
	} else {
	    border = entryPtr->normalBorder;
	}
	Tk_SetBackgroundFromBorder(entryPtr->tkwin, border);

	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->borderWidthObj, &borderWidth);






	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->highlightWidthObj, &highlightWidth);






	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->insertBorderWidthObj, &insertBorderWidth);






	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->insertWidthObj, &insertWidth);






	Tk_GetPixelsFromObj(NULL, entryPtr->tkwin, entryPtr->selBorderWidthObj, &selBorderWidth);







	if (entryPtr->type == TK_SPINBOX) {
	    if (sbPtr->fromValue > sbPtr->toValue) {
		/*
		 * Swap -from and -to values.
		 */

Changes to generic/tkFrame.c.
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *oldMenuNameObj;
    Tk_Window oldWindow = NULL;
    Labelframe *labelframePtr = (Labelframe *) framePtr;
    Tk_Image image = NULL;
    int padX, padY, width, height;
    int borderWidth, highlightWidth;

    /*
     * Need the old menubar name for the menu code to delete it.
     */

    oldMenuNameObj = framePtr->menuNameObj;
    if (oldMenuNameObj) {







<
<







916
917
918
919
920
921
922


923
924
925
926
927
928
929
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *oldMenuNameObj;
    Tk_Window oldWindow = NULL;
    Labelframe *labelframePtr = (Labelframe *) framePtr;
    Tk_Image image = NULL;



    /*
     * Need the old menubar name for the menu code to delete it.
     */

    oldMenuNameObj = framePtr->menuNameObj;
    if (oldMenuNameObj) {
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028

    if (framePtr->border != NULL) {
	Tk_SetBackgroundFromBorder(framePtr->tkwin, framePtr->border);
    } else {
	Tk_SetWindowBackgroundPixmap(framePtr->tkwin, None);
    }

    Tk_GetPixelsFromObj(NULL, framePtr->tkwin, framePtr->borderWidthObj, &borderWidth);
    if (borderWidth < 0) {
	Tcl_DecrRefCount(framePtr->borderWidthObj);
	framePtr->borderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(framePtr->borderWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, framePtr->tkwin, framePtr->heightObj, &height);
    if (height < 0) {
	Tcl_DecrRefCount(framePtr->heightObj);
	framePtr->heightObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(framePtr->heightObj);
    }
    Tk_GetPixelsFromObj(NULL, framePtr->tkwin, framePtr->highlightWidthObj, &highlightWidth);
    if (highlightWidth < 0) {
	Tcl_DecrRefCount(framePtr->highlightWidthObj);
	framePtr->highlightWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(framePtr->highlightWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, framePtr->tkwin, framePtr->padXObj, &padX);
    if (padX < 0) {
	Tcl_DecrRefCount(framePtr->padXObj);
	framePtr->padXObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(framePtr->padXObj);
    }
    Tk_GetPixelsFromObj(NULL, framePtr->tkwin, framePtr->padYObj, &padY);
    if (padY < 0) {
	Tcl_DecrRefCount(framePtr->padYObj);
	framePtr->padYObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(framePtr->padYObj);
    }
    Tk_GetPixelsFromObj(NULL, framePtr->tkwin, framePtr->widthObj, &width);
    if (width < 0) {
	Tcl_DecrRefCount(framePtr->widthObj);
	framePtr->widthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(framePtr->widthObj);
    }

    /*
     * If a -labelwidget is specified, check that it is valid and set up
     * geometry management for it.
     */

    if (framePtr->type == TYPE_LABELFRAME) {
	if (oldWindow != labelframePtr->labelWin) {







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







976
977
978
979
980
981
982





































983
984
985
986
987
988
989

    if (framePtr->border != NULL) {
	Tk_SetBackgroundFromBorder(framePtr->tkwin, framePtr->border);
    } else {
	Tk_SetWindowBackgroundPixmap(framePtr->tkwin, None);
    }






































    /*
     * If a -labelwidget is specified, check that it is valid and set up
     * geometry management for it.
     */

    if (framePtr->type == TYPE_LABELFRAME) {
	if (oldWindow != labelframePtr->labelWin) {
Changes to generic/tkListbox.c.
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
    Tcl_Size objc,			/* Number of valid entries in argv. */
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *oldListObj = NULL;
    Tcl_Obj *errorResult = NULL;
    int oldExport, error;
    int borderWidth, selBorderWidth, highlightWidth;

    oldExport = (listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp));
    if (listPtr->listVarNameObj != NULL) {
	Tcl_UntraceVar2(interp, Tcl_GetString(listPtr->listVarNameObj), NULL,
		TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
		ListboxListVarProc, listPtr);
    }







|







1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
    Tcl_Size objc,			/* Number of valid entries in argv. */
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *oldListObj = NULL;
    Tcl_Obj *errorResult = NULL;
    int oldExport, error;
    int borderWidth, highlightWidth;

    oldExport = (listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp));
    if (listPtr->listVarNameObj != NULL) {
	Tcl_UntraceVar2(interp, Tcl_GetString(listPtr->listVarNameObj), NULL,
		TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
		ListboxListVarProc, listPtr);
    }
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
	 * A few options need special processing, such as setting the
	 * background from a 3-D border.
	 */

	Tk_SetBackgroundFromBorder(listPtr->tkwin, listPtr->normalBorder);

	Tk_GetPixelsFromObj(NULL, listPtr->tkwin, listPtr->borderWidthObj, &borderWidth);
	if (borderWidth < 0) {
	    borderWidth = 0;
	    Tcl_DecrRefCount(listPtr->borderWidthObj);
	    listPtr->borderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(listPtr->borderWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, listPtr->tkwin, listPtr->highlightWidthObj, &highlightWidth);
	if (highlightWidth < 0) {
	    highlightWidth = 0;
	    Tcl_DecrRefCount(listPtr->highlightWidthObj);
	    listPtr->highlightWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(listPtr->highlightWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, listPtr->tkwin, listPtr->selBorderWidthObj, &selBorderWidth);
	if (selBorderWidth < 0) {
	    selBorderWidth = 0;
	    Tcl_DecrRefCount(listPtr->selBorderWidthObj);
	    listPtr->selBorderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(listPtr->selBorderWidthObj);
	}
	listPtr->inset = highlightWidth + borderWidth;

	/*
	 * Claim the selection if we've suddenly started exporting it and
	 * there is a selection to export and this interp is unsafe.
	 */








<
<
<
<
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<







1592
1593
1594
1595
1596
1597
1598






1599













1600
1601
1602
1603
1604
1605
1606
	 * A few options need special processing, such as setting the
	 * background from a 3-D border.
	 */

	Tk_SetBackgroundFromBorder(listPtr->tkwin, listPtr->normalBorder);

	Tk_GetPixelsFromObj(NULL, listPtr->tkwin, listPtr->borderWidthObj, &borderWidth);






	Tk_GetPixelsFromObj(NULL, listPtr->tkwin, listPtr->highlightWidthObj, &highlightWidth);













	listPtr->inset = highlightWidth + borderWidth;

	/*
	 * Claim the selection if we've suddenly started exporting it and
	 * there is a selection to export and this interp is unsafe.
	 */

Changes to generic/tkMenubutton.c.
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
    int objc,			/* Number of valid entries in objv. */
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *errorResult = NULL;
    int error;
    Tk_Image image;
    int borderWidth, highlightWidth;
    int padX, padY;

    /*
     * Eliminate any existing trace on variables monitored by the menubutton.
     */

    if (mbPtr->textVarNameObj != NULL) {
	Tcl_UntraceVar2(interp, Tcl_GetString(mbPtr->textVarNameObj), NULL,







<
<







474
475
476
477
478
479
480


481
482
483
484
485
486
487
    int objc,			/* Number of valid entries in objv. */
    Tcl_Obj *const objv[])	/* Arguments. */
{
    Tk_SavedOptions savedOptions;
    Tcl_Obj *errorResult = NULL;
    int error;
    Tk_Image image;



    /*
     * Eliminate any existing trace on variables monitored by the menubutton.
     */

    if (mbPtr->textVarNameObj != NULL) {
	Tcl_UntraceVar2(interp, Tcl_GetString(mbPtr->textVarNameObj), NULL,
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
	if ((mbPtr->state == STATE_ACTIVE)
		&& !Tk_StrictMotif(mbPtr->tkwin)) {
	    Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->activeBorder);
	} else {
	    Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->normalBorder);
	}

	Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->borderWidthObj, &borderWidth);
	Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->highlightWidthObj, &highlightWidth);
	Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->padXObj, &padX);
	Tk_GetPixelsFromObj(NULL, mbPtr->tkwin, mbPtr->padYObj, &padY);
	if (borderWidth < 0) {
	    borderWidth = 0;
	    Tcl_DecrRefCount(mbPtr->borderWidthObj);
	    mbPtr->borderWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(mbPtr->borderWidthObj);
	}
	if (highlightWidth < 0) {
	    highlightWidth = 0;
	    Tcl_DecrRefCount(mbPtr->highlightWidthObj);
	    mbPtr->highlightWidthObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(mbPtr->highlightWidthObj);
	}
	if (padX < 0) {
	    padX = 0;
	    Tcl_DecrRefCount(mbPtr->padXObj);
	    mbPtr->padXObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(mbPtr->padXObj);
	}
	if (padY < 0) {
	    padY = 0;
	    Tcl_DecrRefCount(mbPtr->padYObj);
	    mbPtr->padYObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(mbPtr->padYObj);
	}

	/*
	 * Get the image for the widget, if there is one. Allocate the new
	 * image before freeing the old one, so that the reference count
	 * doesn't go to zero and cause image data to be discarded.
	 */

	if (mbPtr->imageObj != NULL) {







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







526
527
528
529
530
531
532





























533
534
535
536
537
538
539
	if ((mbPtr->state == STATE_ACTIVE)
		&& !Tk_StrictMotif(mbPtr->tkwin)) {
	    Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->activeBorder);
	} else {
	    Tk_SetBackgroundFromBorder(mbPtr->tkwin, mbPtr->normalBorder);
	}






























	/*
	 * Get the image for the widget, if there is one. Allocate the new
	 * image before freeing the old one, so that the reference count
	 * doesn't go to zero and cause image data to be discarded.
	 */

	if (mbPtr->imageObj != NULL) {
Changes to generic/tkMessage.c.
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
    Message *msgPtr,	/* Information about widget; may or may not
				 * already have values for some fields. */
    int objc,			/* Number of valid entries in argv. */
    Tcl_Obj *const objv[],	/* Arguments. */
    TCL_UNUSED(int))			/* Flags to pass to Tk_ConfigureWidget. */
{
    Tk_SavedOptions savedOptions;
    int width, borderWidth, highlightWidth, padX, padY;

    /*
     * Eliminate any existing trace on a variable monitored by the message.
     */

    if (msgPtr->textVarNameObj != NULL) {
	Tcl_UntraceVar2(interp, Tcl_GetString(msgPtr->textVarNameObj), NULL,







<







435
436
437
438
439
440
441

442
443
444
445
446
447
448
    Message *msgPtr,	/* Information about widget; may or may not
				 * already have values for some fields. */
    int objc,			/* Number of valid entries in argv. */
    Tcl_Obj *const objv[],	/* Arguments. */
    TCL_UNUSED(int))			/* Flags to pass to Tk_ConfigureWidget. */
{
    Tk_SavedOptions savedOptions;


    /*
     * Eliminate any existing trace on a variable monitored by the message.
     */

    if (msgPtr->textVarNameObj != NULL) {
	Tcl_UntraceVar2(interp, Tcl_GetString(msgPtr->textVarNameObj), NULL,
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
	    Tcl_IncrRefCount(msgPtr->stringObj);
	}
	Tcl_TraceVar2(interp, Tcl_GetString(msgPtr->textVarNameObj), NULL,
		TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
		MessageTextVarProc, msgPtr);
    }

    /*
     * A few other options need special processing, such as setting the
     * background from a 3-D border or handling special defaults that couldn't
     * be specified to Tk_ConfigureWidget.
     */

    Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->borderWidthObj, &borderWidth);
    if (borderWidth < 0) {
	Tcl_DecrRefCount(msgPtr->borderWidthObj);
	msgPtr->borderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(msgPtr->borderWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->highlightWidthObj, &highlightWidth);
    if (highlightWidth < 0) {
	Tcl_DecrRefCount(msgPtr->highlightWidthObj);
	msgPtr->highlightWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(msgPtr->highlightWidthObj);
    }
    if (msgPtr->padXObj) {
	Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padXObj, &padX);
	if (padX < 0) {
	    Tcl_DecrRefCount(msgPtr->padXObj);
	    msgPtr->padXObj = NULL;
	}
    }
    if (msgPtr->padYObj) {
	Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->padYObj, &padY);
	if (padY < 0) {
	    Tcl_DecrRefCount(msgPtr->padYObj);
	    msgPtr->padYObj = NULL;
	}
    }
    Tk_GetPixelsFromObj(NULL, msgPtr->tkwin, msgPtr->widthObj, &width);
    if (width < 0) {
	Tcl_DecrRefCount(msgPtr->widthObj);
	msgPtr->widthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(msgPtr->widthObj);
    }

    Tk_FreeSavedOptions(&savedOptions);
    MessageWorldChanged(msgPtr);
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







477
478
479
480
481
482
483







































484
485
486
487
488
489
490
	    Tcl_IncrRefCount(msgPtr->stringObj);
	}
	Tcl_TraceVar2(interp, Tcl_GetString(msgPtr->textVarNameObj), NULL,
		TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
		MessageTextVarProc, msgPtr);
    }








































    Tk_FreeSavedOptions(&savedOptions);
    MessageWorldChanged(msgPtr);
    return TCL_OK;
}

/*
 *---------------------------------------------------------------------------
Changes to generic/tkOldConfig.c.
532
533
534
535
536
537
538







539
540
541
542
543
544
545
			!= TCL_OK) {
		wrongPixel:
		    if (interp && nullOK) {
			Tcl_AppendResult(interp, "expected screen distance or \"\" but got \"",
				Tcl_GetString(arg), "\"", (char *)NULL);
		    }
		    return TCL_ERROR;







		} else {
		    Tcl_IncrRefCount(arg);
		    if (*(Tcl_Obj **)ptr != NULL) {
			Tcl_DecrRefCount(*(Tcl_Obj **)ptr);
		    }
		    *(Tcl_Obj **)ptr = arg;
		}







>
>
>
>
>
>
>







532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
			!= TCL_OK) {
		wrongPixel:
		    if (interp && nullOK) {
			Tcl_AppendResult(interp, "expected screen distance or \"\" but got \"",
				Tcl_GetString(arg), "\"", (char *)NULL);
		    }
		    return TCL_ERROR;
		} else if (!(specPtr->specFlags & TK_OPTION_NEG_OK) && (dummy < 0)) {
			if (interp) {
			    Tcl_AppendResult(interp, "expected screen distance ",
				    nullOK ? " or \"\"" : "",
				    "but got \"", Tcl_GetString(arg), "\"", (char *)NULL);
			}
			return TCL_ERROR;
		} else {
		    Tcl_IncrRefCount(arg);
		    if (*(Tcl_Obj **)ptr != NULL) {
			Tcl_DecrRefCount(*(Tcl_Obj **)ptr);
		    }
		    *(Tcl_Obj **)ptr = arg;
		}
Changes to generic/tkPanedWindow.c.
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
	for (j = 0; j < pwPtr->numPanes; j++) {
	    if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
		int minSize;
		Tk_SetOptions(interp, pwPtr->panes[j],
			pwPtr->paneOpts, objc - firstOptionArg,
			objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
		Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->panes[j]->minSizeObj, &minSize);
		if (minSize < 0) {
		    Tcl_DecrRefCount(pwPtr->panes[j]->minSizeObj);
		    pwPtr->panes[j]->minSizeObj = Tcl_NewIntObj(0);
		    Tcl_IncrRefCount(pwPtr->panes[j]->minSizeObj);
		}
		found = 1;

		/*
		 * If the pane is supposed to move, add it to the inserts
		 * array now; otherwise, leave it where it is.
		 */








<
<
<
<
<







915
916
917
918
919
920
921





922
923
924
925
926
927
928
	for (j = 0; j < pwPtr->numPanes; j++) {
	    if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
		int minSize;
		Tk_SetOptions(interp, pwPtr->panes[j],
			pwPtr->paneOpts, objc - firstOptionArg,
			objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
		Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->panes[j]->minSizeObj, &minSize);





		found = 1;

		/*
		 * If the pane is supposed to move, add it to the inserts
		 * array now; otherwise, leave it where it is.
		 */

981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
	}
	if (panePtr->height > 0) {
	    panePtr->paneHeight = panePtr->height;
	} else {
	    panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
	}
	Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize);
	if (minSize < 0) {
	    Tcl_DecrRefCount(panePtr->minSizeObj);
	    panePtr->minSizeObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(panePtr->minSizeObj);
	}

	/*
	 * Set up the geometry management callbacks for this pane.
	 */

	Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask,
		PaneStructureProc, panePtr);







<
<
<
<
<







976
977
978
979
980
981
982





983
984
985
986
987
988
989
	}
	if (panePtr->height > 0) {
	    panePtr->paneHeight = panePtr->height;
	} else {
	    panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
	}
	Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize);






	/*
	 * Set up the geometry management callbacks for this pane.
	 */

	Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask,
		PaneStructureProc, panePtr);
Changes to generic/tkPlace.c.
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

static const Tk_OptionSpec optionSpecs[] = {
    {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
	offsetof(Content, anchor), TK_OPTION_ENUM_VAR, 0, 0},
    {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
	offsetof(Content, borderMode), TK_OPTION_ENUM_VAR, borderModeStrings, 0},
    {TK_OPTION_PIXELS, "-height", NULL, NULL, NULL, offsetof(Content, heightObj),
	offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
	0, 0, IN_MASK},
    {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, NULL,
	offsetof(Content, relHeightObj), offsetof(Content, relHeight),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, NULL,
	offsetof(Content, relWidthObj), offsetof(Content, relWidth),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0.0", TCL_INDEX_NONE,
	offsetof(Content, relX), 0, 0, 0},
    {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0.0", TCL_INDEX_NONE,
	offsetof(Content, relY), 0, 0, 0},
    {TK_OPTION_PIXELS, "-width", NULL, NULL, NULL, offsetof(Content, widthObj),
	offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xObj),
	offsetof(Content, x), 0, 0, 0},
    {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yObj),
	offsetof(Content, y), 0, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};

/*
 * For each container window that has a content managed by the placer there is a
 * structure of the following form:
 */







|













|

|

|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

static const Tk_OptionSpec optionSpecs[] = {
    {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
	offsetof(Content, anchor), TK_OPTION_ENUM_VAR, 0, 0},
    {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
	offsetof(Content, borderMode), TK_OPTION_ENUM_VAR, borderModeStrings, 0},
    {TK_OPTION_PIXELS, "-height", NULL, NULL, NULL, offsetof(Content, heightObj),
	offsetof(Content, height), TK_OPTION_NULL_OK|TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
	0, 0, IN_MASK},
    {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, NULL,
	offsetof(Content, relHeightObj), offsetof(Content, relHeight),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, NULL,
	offsetof(Content, relWidthObj), offsetof(Content, relWidth),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0.0", TCL_INDEX_NONE,
	offsetof(Content, relX), 0, 0, 0},
    {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0.0", TCL_INDEX_NONE,
	offsetof(Content, relY), 0, 0, 0},
    {TK_OPTION_PIXELS, "-width", NULL, NULL, NULL, offsetof(Content, widthObj),
	offsetof(Content, width), TK_OPTION_NULL_OK|TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xObj),
	offsetof(Content, x), TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yObj),
	offsetof(Content, y), TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};

/*
 * For each container window that has a content managed by the placer there is a
 * structure of the following form:
 */
Changes to generic/tkRectOval.c.
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	"0.0", offsetof(RectOvalItem, outline.activeWidth),
	TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(RectOvalItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(RectOvalItem, outline.offsetObj),
	TK_CONFIG_OBJS, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(RectOvalItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
	NULL, offsetof(RectOvalItem, outline.disabledColor),







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	"0.0", offsetof(RectOvalItem, outline.activeWidth),
	TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
    {TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
	NULL, offsetof(RectOvalItem, outline.dash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
	"0", offsetof(RectOvalItem, outline.offsetObj),
	TK_CONFIG_OBJS|TK_OPTION_NEG_OK, NULL},
    {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
	NULL, offsetof(RectOvalItem, outline.disabledDash),
	TK_CONFIG_NULL_OK, &dashOption},
    {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
	NULL, offsetof(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL},
    {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL,
	NULL, offsetof(RectOvalItem, outline.disabledColor),
Changes to generic/tkScale.c.
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692

	ComputeFormat(scalePtr, 0);
	ComputeFormat(scalePtr, 1);

	Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder);

	Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->highlightWidthObj, &highlightWidth);
	if (highlightWidth < 0) {
	    highlightWidth = 0;
		if (scalePtr->highlightWidthObj) {
		    Tcl_DecrRefCount(scalePtr->highlightWidthObj);
		}
		scalePtr->highlightWidthObj = Tcl_NewIntObj(0);
		Tcl_IncrRefCount(scalePtr->highlightWidthObj);
	}
	Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth);
	scalePtr->inset = highlightWidth + borderWidth;
	break;
    }
    if (!error) {
	Tk_FreeSavedOptions(&savedOptions);
    }







<
<
<
<
<
<
<
<







671
672
673
674
675
676
677








678
679
680
681
682
683
684

	ComputeFormat(scalePtr, 0);
	ComputeFormat(scalePtr, 1);

	Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder);

	Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->highlightWidthObj, &highlightWidth);








	Tk_GetPixelsFromObj(NULL, scalePtr->tkwin, scalePtr->borderWidthObj, &borderWidth);
	scalePtr->inset = highlightWidth + borderWidth;
	break;
    }
    if (!error) {
	Tk_FreeSavedOptions(&savedOptions);
    }
Changes to generic/tkScrollbar.c.
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
    TkScrollbar *scrollPtr,
				/* Information about widget; may or may not
				 * already have values for some fields. */
    Tcl_Size objc,			/* Number of valid entries in argv. */
    Tcl_Obj *const objv[],		/* Arguments. */
    int flags)			/* Flags to pass to Tk_ConfigureWidget. */
{
    int width, borderWidth, highlightWidth, elementBorderWidth;

    if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc,
	    objv, scrollPtr, flags) != TCL_OK) {
	return TCL_ERROR;
    }

    /*
     * A few options need special processing, such as setting the background
     * from a 3-D border.
     */

    Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->borderWidthObj, &borderWidth);
    if (borderWidth < 0) {
	Tcl_DecrRefCount(scrollPtr->borderWidthObj);
	scrollPtr->borderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(scrollPtr->borderWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->highlightWidthObj, &highlightWidth);
    if (highlightWidth < 0) {
	Tcl_DecrRefCount(scrollPtr->highlightWidthObj);
	scrollPtr->highlightWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(scrollPtr->highlightWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->widthObj, &width);
    if (width < 0) {
	Tcl_DecrRefCount(scrollPtr->widthObj);
	scrollPtr->widthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(scrollPtr->widthObj);
    }
    if (scrollPtr->elementBorderWidthObj) {
	Tk_GetPixelsFromObj(NULL, scrollPtr->tkwin, scrollPtr->elementBorderWidthObj, &elementBorderWidth);
	if (elementBorderWidth < 0) {
	    Tcl_DecrRefCount(scrollPtr->elementBorderWidthObj);
	    scrollPtr->elementBorderWidthObj = NULL;
	}
    }
    /*
     * Configure platform specific options.
     */

    TkpConfigureScrollbar(scrollPtr);

    /*







<
<





<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







467
468
469
470
471
472
473


474
475
476
477
478






























479
480
481
482
483
484
485
    TkScrollbar *scrollPtr,
				/* Information about widget; may or may not
				 * already have values for some fields. */
    Tcl_Size objc,			/* Number of valid entries in argv. */
    Tcl_Obj *const objv[],		/* Arguments. */
    int flags)			/* Flags to pass to Tk_ConfigureWidget. */
{


    if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, configSpecs, objc,
	    objv, scrollPtr, flags) != TCL_OK) {
	return TCL_ERROR;
    }































    /*
     * Configure platform specific options.
     */

    TkpConfigureScrollbar(scrollPtr);

    /*
Changes to generic/tkText.c.
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
    TkText *textPtr,	/* Information about widget; may or may not
				 * already have values for some fields. */
    Tcl_Size objc,			/* Number of arguments. */
    Tcl_Obj *const objv[])	/* Argument objects. */
{
    Tk_SavedOptions savedOptions;
    int oldExport = (textPtr->exportSelection) && (!Tcl_IsSafe(textPtr->interp));
    int mask = 0, selBorderWidth = 0, height, highlightWidth;
    int borderWidth, spacing1, spacing2, spacing3;
    int insertBorderWidth, insertWidth, padX, padY;

    if (Tk_SetOptions(interp, (char *) textPtr, textPtr->optionTable,
	    objc, objv, textPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
	return TCL_ERROR;
    }

    /*







|
<
<







2057
2058
2059
2060
2061
2062
2063
2064


2065
2066
2067
2068
2069
2070
2071
    TkText *textPtr,	/* Information about widget; may or may not
				 * already have values for some fields. */
    Tcl_Size objc,			/* Number of arguments. */
    Tcl_Obj *const objv[])	/* Argument objects. */
{
    Tk_SavedOptions savedOptions;
    int oldExport = (textPtr->exportSelection) && (!Tcl_IsSafe(textPtr->interp));
    int mask = 0;



    if (Tk_SetOptions(interp, (char *) textPtr, textPtr->optionTable,
	    objc, objv, textPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
	return TCL_ERROR;
    }

    /*
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
	    textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &index1);
	}
	if (TkTextIndexCmp(&index3, &index2) > 0) {
	    textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &index2);
	}
    }

    /*
     * Don't allow negative spacings.
     */

    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->borderWidthObj, &borderWidth);
    if (borderWidth < 0) {
	borderWidth = 0;
	Tcl_DecrRefCount(textPtr->borderWidthObj);
	textPtr->borderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->borderWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->heightObj, &height);
    if (height < 0) {
	height = 0;
	Tcl_DecrRefCount(textPtr->heightObj);
	textPtr->heightObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->heightObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->highlightWidthObj, &highlightWidth);
    if (highlightWidth < 0) {
	highlightWidth = 0;
	Tcl_DecrRefCount(textPtr->highlightWidthObj);
	textPtr->highlightWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->highlightWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->insertBorderWidthObj, &insertBorderWidth);
    if (insertBorderWidth < 0) {
	insertBorderWidth = 0;
	Tcl_DecrRefCount(textPtr->insertBorderWidthObj);
	textPtr->insertBorderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->insertBorderWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->insertWidthObj, &insertWidth);
    if (insertWidth < 0) {
	insertWidth = 0;
	Tcl_DecrRefCount(textPtr->insertWidthObj);
	textPtr->insertWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->insertWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->padXObj, &padX);
    if (padX < 0) {
	Tcl_DecrRefCount(textPtr->padXObj);
	textPtr->padXObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->padXObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->padYObj, &padY);
    if (padY < 0) {
	Tcl_DecrRefCount(textPtr->padYObj);
	textPtr->padYObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->padYObj);
    }
    if (textPtr->selBorderWidthObj) {
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->selBorderWidthObj, &selBorderWidth);
    }
    if (selBorderWidth < 0) {
	selBorderWidth = 0;
	if (textPtr->selBorderWidthObj) {
	    Tcl_DecrRefCount(textPtr->selBorderWidthObj);
	}
	textPtr->selBorderWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->selBorderWidthObj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->spacing1Obj, &spacing1);
    if (spacing1 < 0) {
	spacing1 = 0;
	Tcl_DecrRefCount(textPtr->spacing1Obj);
	textPtr->spacing1Obj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->spacing1Obj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->spacing2Obj, &spacing2);
    if (spacing2 < 0) {
	spacing2 = 0;
	Tcl_DecrRefCount(textPtr->spacing2Obj);
	textPtr->spacing2Obj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->spacing2Obj);
    }
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->spacing3Obj, &spacing3);
    if (spacing3 < 0) {
	spacing3 = 0;
	Tcl_DecrRefCount(textPtr->spacing3Obj);
	textPtr->spacing3Obj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->spacing3Obj);
    }

    /*
     * Parse tab stops.
     */

    if (textPtr->tabArrayPtr != NULL) {
	ckfree(textPtr->tabArrayPtr);
	textPtr->tabArrayPtr = NULL;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







2193
2194
2195
2196
2197
2198
2199




















































































2200
2201
2202
2203
2204
2205
2206
	    textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &index1);
	}
	if (TkTextIndexCmp(&index3, &index2) > 0) {
	    textPtr->currentMarkPtr = TkTextSetMark(textPtr, "current", &index2);
	}
    }





















































































    /*
     * Parse tab stops.
     */

    if (textPtr->tabArrayPtr != NULL) {
	ckfree(textPtr->tabArrayPtr);
	textPtr->tabArrayPtr = NULL;
Changes to generic/tkTextDisp.c.
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
     * it.
     */

    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->padXObj, &padX);
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->padYObj, &padY);
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->borderWidthObj, &borderWidth);
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->highlightWidthObj, &highlightWidth);
    if (highlightWidth < 0) {
	highlightWidth = 0;
	Tcl_DecrRefCount(textPtr->highlightWidthObj);
	textPtr->highlightWidthObj = Tcl_NewIntObj(0);
	Tcl_IncrRefCount(textPtr->highlightWidthObj);
    }
    dInfoPtr->x = highlightWidth + borderWidth + padX;
    dInfoPtr->y = highlightWidth + borderWidth + padY;
    dInfoPtr->maxX = Tk_Width(textPtr->tkwin) - highlightWidth
	    - borderWidth - padX;
    if (dInfoPtr->maxX <= dInfoPtr->x) {
	dInfoPtr->maxX = dInfoPtr->x + 1;
    }







<
<
<
<
<
<







5256
5257
5258
5259
5260
5261
5262






5263
5264
5265
5266
5267
5268
5269
     * it.
     */

    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->padXObj, &padX);
    Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->padYObj, &padY);
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->borderWidthObj, &borderWidth);
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, textPtr->highlightWidthObj, &highlightWidth);






    dInfoPtr->x = highlightWidth + borderWidth + padX;
    dInfoPtr->y = highlightWidth + borderWidth + padY;
    dInfoPtr->maxX = Tk_Width(textPtr->tkwin) - highlightWidth
	    - borderWidth - padX;
    if (dInfoPtr->maxX <= dInfoPtr->x) {
	dInfoPtr->maxX = dInfoPtr->x + 1;
    }
Changes to generic/tkTextImage.c.
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561

    if (offset != 0) {
	Tcl_Panic("Non-zero offset in EmbImageLayoutProc");
    }

    if (eiPtr->body.ei.padXObj) {
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, eiPtr->body.ei.padXObj, &padX);
	if (padX < 0) {
	    Tcl_DecrRefCount(eiPtr->body.ei.padXObj);
	    eiPtr->body.ei.padXObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(eiPtr->body.ei.padXObj);
	}
    }
    if (eiPtr->body.ei.padYObj) {
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, eiPtr->body.ei.padYObj, &padY);
	if (padY < 0) {
	    Tcl_DecrRefCount(eiPtr->body.ei.padYObj);
	    eiPtr->body.ei.padYObj = Tcl_NewIntObj(0);
	    Tcl_IncrRefCount(eiPtr->body.ei.padYObj);
	}
    }
    /*
     * See if there's room for this image on this line.
     */

    if (eiPtr->body.ei.image == NULL) {
	width = 0;







<
<
<
<
<



<
<
<
<
<







535
536
537
538
539
540
541





542
543
544





545
546
547
548
549
550
551

    if (offset != 0) {
	Tcl_Panic("Non-zero offset in EmbImageLayoutProc");
    }

    if (eiPtr->body.ei.padXObj) {
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, eiPtr->body.ei.padXObj, &padX);





    }
    if (eiPtr->body.ei.padYObj) {
	Tk_GetPixelsFromObj(NULL, textPtr->tkwin, eiPtr->body.ei.padYObj, &padY);





    }
    /*
     * See if there's room for this image on this line.
     */

    if (eiPtr->body.ei.image == NULL) {
	width = 0;
Changes to generic/tkTextTag.c.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL,
	NULL, offsetof(TkTextTag, lMargin1Obj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL,
	NULL, offsetof(TkTextTag, lMargin2Obj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-offset", NULL, NULL,
	NULL, offsetof(TkTextTag, offsetObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrike),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_RELIEF, "-relief", NULL, NULL,







|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    {TK_OPTION_PIXELS, "-lmargin1", NULL, NULL,
	NULL, offsetof(TkTextTag, lMargin1Obj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_PIXELS, "-lmargin2", NULL, NULL,
	NULL, offsetof(TkTextTag, lMargin2Obj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,0},
    {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-offset", NULL, NULL,
	NULL, offsetof(TkTextTag, offsetObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK|TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_BOOLEAN, "-overstrike", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrike),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextTag, overstrikeColor),
	TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_RELIEF, "-relief", NULL, NULL,
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
	    /*
	     * Some of the configuration options, like -underline and
	     * -justify, require additional translation (this is needed
	     * because we need to distinguish a particular value of an option
	     * from "unspecified").
	     */

	    if (tagPtr->borderWidthObj) {
		int borderWidth;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->borderWidthObj, &borderWidth);
		if (borderWidth < 0) {
		    borderWidth = 0;
		    Tcl_DecrRefCount(tagPtr->borderWidthObj);
		    tagPtr->borderWidthObj = NULL;
		}
	    }
	    if (tagPtr->lMargin1Obj) {
		int lMargin1;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->lMargin1Obj, &lMargin1);
		if (lMargin1 < 0) {
		    lMargin1 = 0;
		    Tcl_DecrRefCount(tagPtr->lMargin1Obj);
		    tagPtr->lMargin1Obj = NULL;
		}
	    }
	    if (tagPtr->lMargin2Obj) {
		int lMargin2;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->lMargin2Obj, &lMargin2);
		if (lMargin2 < 0) {
		    lMargin2 = 0;
		    Tcl_DecrRefCount(tagPtr->lMargin2Obj);
		    tagPtr->lMargin2Obj = NULL;
		}
	    }
	    if (tagPtr->rMarginObj) {
		int rMargin;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->rMarginObj, &rMargin);
		if (rMargin < 0) {
		    rMargin = 0;
		    Tcl_DecrRefCount(tagPtr->rMarginObj);
		    tagPtr->rMarginObj = NULL;
		}
	    }
	    if (tagPtr->spacing1Obj) {
		int spacing1;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->spacing1Obj, &spacing1);
		if (spacing1 < 0) {
		    spacing1 = 0;
		    Tcl_DecrRefCount(tagPtr->spacing1Obj);
		    tagPtr->spacing1Obj = NULL;
		}
	    }
	    if (tagPtr->spacing2Obj) {
		int spacing2;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->spacing2Obj, &spacing2);
		if (spacing2 < 0) {
		    spacing2 = 0;
		    Tcl_DecrRefCount(tagPtr->spacing2Obj);
		    tagPtr->spacing2Obj = NULL;
		}
	    }
	    if (tagPtr->spacing3Obj) {
		int spacing3;
		Tk_GetPixelsFromObj(NULL, textPtr->tkwin, tagPtr->spacing3Obj, &spacing3);
		if (spacing3 < 0) {
		    spacing3 = 0;
		    Tcl_DecrRefCount(tagPtr->spacing3Obj);
		    tagPtr->spacing3Obj = NULL;
		}
	    }
	    if (tagPtr->tabArrayPtr != NULL) {
		ckfree(tagPtr->tabArrayPtr);
		tagPtr->tabArrayPtr = NULL;
	    }
	    if (tagPtr->tabStringPtr != NULL) {
		tagPtr->tabArrayPtr =
			TkTextGetTabs(interp, textPtr->tkwin, tagPtr->tabStringPtr);







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







359
360
361
362
363
364
365































































366
367
368
369
370
371
372
	    /*
	     * Some of the configuration options, like -underline and
	     * -justify, require additional translation (this is needed
	     * because we need to distinguish a particular value of an option
	     * from "unspecified").
	     */
































































	    if (tagPtr->tabArrayPtr != NULL) {
		ckfree(tagPtr->tabArrayPtr);
		tagPtr->tabArrayPtr = NULL;
	    }
	    if (tagPtr->tabStringPtr != NULL) {
		tagPtr->tabArrayPtr =
			TkTextGetTabs(interp, textPtr->tkwin, tagPtr->tabStringPtr);
Changes to generic/tkTextWind.c.
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
static const Tk_OptionSpec optionSpecs[] = {
    {TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
	"center", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, align),
	TK_OPTION_ENUM_VAR, alignStrings, 0},
    {TK_OPTION_STRING, "-create", NULL, NULL,
	NULL, offsetof(TkTextEmbWindow, createObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-padx", NULL, NULL,
	"0", offsetof(TkTextEmbWindow, padXObj), TCL_INDEX_NONE, 0, 0, 0},
    {TK_OPTION_PIXELS, "-pady", NULL, NULL,
	"0", offsetof(TkTextEmbWindow, padYObj), TCL_INDEX_NONE, 0, 0, 0},
    {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL,
	"0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, stretch), 0, 0, 0},
    {TK_OPTION_WINDOW, "-window", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};








|

|







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
static const Tk_OptionSpec optionSpecs[] = {
    {TK_OPTION_STRING_TABLE, "-align", NULL, NULL,
	"center", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, align),
	TK_OPTION_ENUM_VAR, alignStrings, 0},
    {TK_OPTION_STRING, "-create", NULL, NULL,
	NULL, offsetof(TkTextEmbWindow, createObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_PIXELS, "-padx", NULL, NULL,
	"0", offsetof(TkTextEmbWindow, padXObj), TCL_INDEX_NONE, TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_PIXELS, "-pady", NULL, NULL,
	"0", offsetof(TkTextEmbWindow, padYObj), TCL_INDEX_NONE, TK_OPTION_NEG_OK, 0, 0},
    {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL,
	"0", TCL_INDEX_NONE, offsetof(TkTextEmbWindow, stretch), 0, 0, 0},
    {TK_OPTION_WINDOW, "-window", NULL, NULL,
	NULL, TCL_INDEX_NONE, offsetof(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0},
    {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};

Changes to tests/button.test.
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
    checkbutton .c
    .c configure -selectcolor {}
} -cleanup {
    destroy .c
} -result {}

test button-1.271 {configuration options: fallback to default} -setup {
    checkbutton .c -borderwidth -2 -highlightthickness -2 -font {Helvetica -12 bold}
    pack .c
    update
} -body {
    .c configure -padx -2 -pady -2 -wraplength -2
    list [.c cget -padx] [.c cget -pady] [.c cget -borderwidth] [.c cget -highlightthickness] [.c cget -wraplength]
} -cleanup {
    destroy .c
} -result {0 0 0 0 0}

# ex-tests 3.*
test button-2.1 {ButtonCreate - not enough arguments} -body {







|



|







2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
    checkbutton .c
    .c configure -selectcolor {}
} -cleanup {
    destroy .c
} -result {}

test button-1.271 {configuration options: fallback to default} -setup {
    checkbutton .c -borderwidth 0 -highlightthickness 0 -font {Helvetica -12 bold}
    pack .c
    update
} -body {
    .c configure -padx 0 -pady 0 -wraplength 0
    list [.c cget -padx] [.c cget -pady] [.c cget -borderwidth] [.c cget -highlightthickness] [.c cget -wraplength]
} -cleanup {
    destroy .c
} -result {0 0 0 0 0}

# ex-tests 3.*
test button-2.1 {ButtonCreate - not enough arguments} -body {
Changes to tests/entry.test.
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
    pack .e ; update idletasks
    update
} -body {
    .e configure -highlightthickness -2
    .e cget -highlightthickness
} -cleanup {
    destroy .e
} -result 0
test entry-1.29 {configuration option: "highlightthickness" for entry} -setup {
    entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
    pack .e ; update idletasks
    update
} -body {
    .e configure -highlightthickness badValue
} -cleanup {







|







295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
    pack .e ; update idletasks
    update
} -body {
    .e configure -highlightthickness -2
    .e cget -highlightthickness
} -cleanup {
    destroy .e
} -returnCodes error -result {expected screen distance but got "-2"}
test entry-1.29 {configuration option: "highlightthickness" for entry} -setup {
    entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold}
    pack .e ; update idletasks
    update
} -body {
    .e configure -highlightthickness badValue
} -cleanup {
Changes to tests/font.test.
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
    .t.f config -text "foo" -underline {}
} -result {}
test font-27.2 {Tk_UnderlineTextLayout procedure: underline not visible} -body {
    .t.f config -text "000          00000" -wrap [expr $ax*7] -under 10
} -result {}
test font-27.3 {Tk_UnderlineTextLayout procedure: underline is visible} -body {
    .t.f config -text "000          00000" -wrap [expr $ax*7] -under 5
    .t.f config -wrap -1 -underline {}
} -result {}
destroy .t.f



# Canvas created for tests: 28.*
destroy .t.c







|







1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
    .t.f config -text "foo" -underline {}
} -result {}
test font-27.2 {Tk_UnderlineTextLayout procedure: underline not visible} -body {
    .t.f config -text "000          00000" -wrap [expr $ax*7] -under 10
} -result {}
test font-27.3 {Tk_UnderlineTextLayout procedure: underline is visible} -body {
    .t.f config -text "000          00000" -wrap [expr $ax*7] -under 5
    .t.f config -wrap 0 -underline {}
} -result {}
destroy .t.f



# Canvas created for tests: 28.*
destroy .t.c
Changes to tests/listbox.test.
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
    .l configure -highlightthickness bogus
} -returnCodes error -result {expected screen distance but got "bogus"}
test listbox-1.31 {configuration options} -body {
    .l configure -highlightthickness -2
    list [lindex [.l configure -highlightthickness] 4] [.l cget -highlightthickness]
} -cleanup {
    .l configure -highlightthickness [lindex [.l configure -highlightthickness] 3]
} -result {0 0}
test listbox-1.32.1 {configuration options} -setup {
    set res {}
} -body {
    .l configure -justify left
    set res [list [lindex [.l configure -justify] 4] [.l cget -justify]]
    .l configure -justify center
    lappend res [lindex [.l configure -justify] 4] [.l cget -justify]







|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
    .l configure -highlightthickness bogus
} -returnCodes error -result {expected screen distance but got "bogus"}
test listbox-1.31 {configuration options} -body {
    .l configure -highlightthickness -2
    list [lindex [.l configure -highlightthickness] 4] [.l cget -highlightthickness]
} -cleanup {
    .l configure -highlightthickness [lindex [.l configure -highlightthickness] 3]
} -returnCodes error -result {expected screen distance but got "-2"}
test listbox-1.32.1 {configuration options} -setup {
    set res {}
} -body {
    .l configure -justify left
    set res [list [lindex [.l configure -justify] 4] [.l cget -justify]]
    .l configure -justify center
    lappend res [lindex [.l configure -justify] 4] [.l cget -justify]
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
    pack .l
    update
} -body {
    .l configure -highlightthickness -3
    .l cget -highlightthickness
} -cleanup {
    deleteWindows
} -result 0
test listbox-4.3 {ConfigureListbox procedure} -setup {
    deleteWindows
    destroy .l
    listbox .l -setgrid 1 -width 25 -height 15
    pack .l
    update
} -body {







|







1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
    pack .l
    update
} -body {
    .l configure -highlightthickness -3
    .l cget -highlightthickness
} -cleanup {
    deleteWindows
} -returnCodes error -result {expected screen distance but got "-3"}
test listbox-4.3 {ConfigureListbox procedure} -setup {
    deleteWindows
    destroy .l
    listbox .l -setgrid 1 -width 25 -height 15
    pack .l
    update
} -body {
Changes to tests/message.test.
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
    update
} -body {
    .m configure -width badValue
} -cleanup {
    destroy .m
} -returnCodes error -result {expected screen distance but got "badValue"}
test message-1.39 {configuration options, fallback to default} -setup {
    message .m -borderwidth -2 -highlightthickness -2 -font {Helvetica -12 bold}
    pack .m
    update
} -body {
    .m configure -padx -2 -pady -2 -width -2
    list [.m cget -padx] [.m cget -pady] [.m cget -borderwidth] [.m cget -highlightthickness]  [.m cget -width]
} -cleanup {
    destroy .m
} -result {{} {} 0 0 0}


test message-2.1 {Tk_MessageObjCmd procedure} -body {
    message
} -returnCodes error -result {wrong # args: should be "message pathName ?-option value ...?"}

test message-2.2 {Tk_MessageObjCmd procedure} -body {







|







|







390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
    update
} -body {
    .m configure -width badValue
} -cleanup {
    destroy .m
} -returnCodes error -result {expected screen distance but got "badValue"}
test message-1.39 {configuration options, fallback to default} -setup {
    message .m -borderwidth 0 -highlightthickness 0 -font {Helvetica -12 bold}
    pack .m
    update
} -body {
    .m configure -padx -2 -pady -2 -width -2
    list [.m cget -padx] [.m cget -pady] [.m cget -borderwidth] [.m cget -highlightthickness]  [.m cget -width]
} -cleanup {
    destroy .m
} -returnCodes error -result {expected screen distance or "" but got "-2"}


test message-2.1 {Tk_MessageObjCmd procedure} -body {
    message
} -returnCodes error -result {wrong # args: should be "message pathName ?-option value ...?"}

test message-2.2 {Tk_MessageObjCmd procedure} -body {
Changes to tests/panedwindow.test.
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 0
} -cleanup {
    deleteWindows
} -result [list 50 0]
test panedwindow-17.10 {MoveSash, move right, negative minsize becomes 0} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2
    foreach w {.f1 .f2 .f3} c {red blue} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize -50
    }

    .p sash place 0 50 0

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]







|





|







1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 0
} -cleanup {
    deleteWindows
} -result [list 50 0]
test panedwindow-17.10 {MoveSash, move right, zero minsize} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2
    foreach w {.f1 .f2 .f3} c {red blue} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize 0
    }

    .p sash place 0 50 0

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 1
} -cleanup {
    deleteWindows
} -result [list 42 0]
test panedwindow-17.18 {MoveSash, move left, negative minsize becomes 0} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2
    foreach w {.f1 .f2 .f3} c {red blue green} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize -50
    }

    .p sash place 1 10 0

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]







|





|







1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 1
} -cleanup {
    deleteWindows
} -result [list 42 0]
test panedwindow-17.18 {MoveSash, move left, zero minsize} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2
    foreach w {.f1 .f2 .f3} c {red blue green} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize 0
    }

    .p sash place 1 10 0

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 0
} -cleanup {
    deleteWindows
} -result [list 0 50]
test panedwindow-18.10 {MoveSash, move right, negative minsize becomes 0} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \
	    -orient vertical
    foreach w {.f1 .f2 .f3} c {red blue} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize -50
    }

    .p sash place 0 0 50

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]







|






|







1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 0
} -cleanup {
    deleteWindows
} -result [list 0 50]
test panedwindow-18.10 {MoveSash, move right, zero minsize} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \
	    -orient vertical
    foreach w {.f1 .f2 .f3} c {red blue} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize 0
    }

    .p sash place 0 0 50

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 1
} -cleanup {
    deleteWindows
} -result [list 0 42]
test panedwindow-18.18 {MoveSash, move up, negative minsize becomes 0} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \
	    -orient vertical
    foreach w {.f1 .f2 .f3} c {red blue green} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize -50
    }

    .p sash place 1 0 10

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]







|






|







2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    .p sash coord 1
} -cleanup {
    deleteWindows
} -result [list 0 42]
test panedwindow-18.18 {MoveSash, move up, zero minsize} -setup {
    deleteWindows
} -body {
    panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \
	    -orient vertical
    foreach w {.f1 .f2 .f3} c {red blue green} {
	.p add [frame $w -height 20 -width 20 -bg $c] \
		-sticky nsew -minsize 0
    }

    .p sash place 1 0 10

    # Get the new sash coord; it should have moved as far as possible,
    # respecting minsizes.
    list [.p sash coord 0] [.p sash coord 1]
Changes to tests/scrollbar.test.
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	    {unknown color name "non-existent"}}
    {-borderwidth 1.3 1.3 badValue {expected screen distance but got "badValue"}}
    {-command "set x" {set x} {} {}}
    {-elementborderwidth 4 4 badValue {expected screen distance or "" but got "badValue"}}
    {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
    {-highlightbackground #112233 #112233 ugly {unknown color name "ugly"}}
    {-highlightcolor #123456 #123456 bogus {unknown color name "bogus"}}
    {-highlightthickness 6 6 bogus {expected screen distance but got "bogus"}}
    {-highlightthickness -2 0 {} {}}
    {-jump true 1 silly {expected boolean value but got "silly"}}
    {-orient horizontal horizontal badValue
	    {bad orientation "badValue": must be vertical or horizontal}}
    {-orient horizontal horizontal bogus {bad orientation "bogus": must be vertical or horizontal}}
    {-relief ridge ridge badValue {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
    {-repeatdelay 140 140 129.3 {expected integer but got "129.3"}}
    {-repeatinterval 140 140 129.3 {expected integer but got "129.3"}}







<
|







75
76
77
78
79
80
81

82
83
84
85
86
87
88
89
	    {unknown color name "non-existent"}}
    {-borderwidth 1.3 1.3 badValue {expected screen distance but got "badValue"}}
    {-command "set x" {set x} {} {}}
    {-elementborderwidth 4 4 badValue {expected screen distance or "" but got "badValue"}}
    {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
    {-highlightbackground #112233 #112233 ugly {unknown color name "ugly"}}
    {-highlightcolor #123456 #123456 bogus {unknown color name "bogus"}}

    {-highlightthickness 6 6 -2 {expected screen distance but got "-2"}}
    {-jump true 1 silly {expected boolean value but got "silly"}}
    {-orient horizontal horizontal badValue
	    {bad orientation "badValue": must be vertical or horizontal}}
    {-orient horizontal horizontal bogus {bad orientation "bogus": must be vertical or horizontal}}
    {-relief ridge ridge badValue {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken}}
    {-repeatdelay 140 140 129.3 {expected integer but got "129.3"}}
    {-repeatinterval 140 140 129.3 {expected integer but got "129.3"}}
Changes to tests/spinbox.test.
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
    pack .e
    update
} -body {
    .e configure -highlightthickness -2
    .e cget -highlightthickness
} -cleanup {
    destroy .e
} -result 0

test spinbox-1.41 {configuration option: "increment"} -setup {
    spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
	-relief sunken
    pack .e
    update
} -body {







|







456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
    pack .e
    update
} -body {
    .e configure -highlightthickness -2
    .e cget -highlightthickness
} -cleanup {
    destroy .e
} -returnCodes error -result {expected screen distance but got "-2"}

test spinbox-1.41 {configuration option: "increment"} -setup {
    spinbox .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12} \
	-relief sunken
    pack .e
    update
} -body {
Changes to tests/text.test.
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    pack .t
    update
} -body {
    .t configure -highlightthickness -2
    .t cget -highlightthickness
} -cleanup {
    destroy .t
} -result 0
test text-1.30 {configuration option: "highlightthickness"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -highlightthickness bad
} -cleanup {







|







299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
    pack .t
    update
} -body {
    .t configure -highlightthickness -2
    .t cget -highlightthickness
} -cleanup {
    destroy .t
} -returnCodes error -result {expected screen distance but got "-2"}
test text-1.30 {configuration option: "highlightthickness"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -highlightthickness bad
} -cleanup {
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
    pack .t
    update
} -body {
    .t configure -spacing1 -5
    .t cget -spacing1
} -cleanup {
    destroy .t
} -result 0
test text-1.60 {configuration option: "spacing1"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -spacing1 bogus
} -cleanup {







|







593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
    pack .t
    update
} -body {
    .t configure -spacing1 -5
    .t cget -spacing1
} -cleanup {
    destroy .t
} -returnCodes error -result {expected screen distance but got "-5"}
test text-1.60 {configuration option: "spacing1"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -spacing1 bogus
} -cleanup {
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
    pack .t
    update
} -body {
    .t configure -spacing2 -1
    .t cget -spacing2
} -cleanup {
    destroy .t
} -result 0
test text-1.64 {configuration option: "spacing2"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -spacing2 bogus
} -cleanup {







|







631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
    pack .t
    update
} -body {
    .t configure -spacing2 -1
    .t cget -spacing2
} -cleanup {
    destroy .t
} -returnCodes error -result {expected screen distance but got "-1"}
test text-1.64 {configuration option: "spacing2"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -spacing2 bogus
} -cleanup {
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
    pack .t
    update
} -body {
    .t configure -spacing3 -10
    .t cget -spacing3
} -cleanup {
    destroy .t
} -result 0
test text-1.68 {configuration option: "spacing3"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -spacing3 bogus
} -cleanup {







|







669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
    pack .t
    update
} -body {
    .t configure -spacing3 -10
    .t cget -spacing3
} -cleanup {
    destroy .t
} -returnCodes error -result {expected screen distance but got "-10"}
test text-1.68 {configuration option: "spacing3"} -setup {
    text .t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold}
    pack .t
    update
} -body {
    .t configure -spacing3 bogus
} -cleanup {
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
test text-14.2 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -spacing1 -2 -spacing2 1 -spacing3 1
    list [.t cget -spacing1] [.t cget -spacing2] [.t cget -spacing3]
} -cleanup {
    destroy .t
} -result {0 1 1}
test text-14.3 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -spacing1 1 -spacing2 -1 -spacing3 1
    list [.t cget -spacing1] [.t cget -spacing2] [.t cget -spacing3]
} -cleanup {
    destroy .t
} -result {1 0 1}
test text-14.4 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -spacing1 1 -spacing2 1 -spacing3 -3
    list [.t cget -spacing1] [.t cget -spacing2] [.t cget -spacing3]
} -cleanup {
    destroy .t
} -result {1 1 0}
test text-14.5 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -tabs {30 foo}
} -cleanup {
    destroy .t
} -returnCodes error -result {bad tab alignment "foo": must be left, right, center, or numeric}







|







|







|







3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
test text-14.2 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -spacing1 -2 -spacing2 1 -spacing3 1
    list [.t cget -spacing1] [.t cget -spacing2] [.t cget -spacing3]
} -cleanup {
    destroy .t
} -returnCodes {error} -result {expected screen distance but got "-2"}
test text-14.3 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -spacing1 1 -spacing2 -1 -spacing3 1
    list [.t cget -spacing1] [.t cget -spacing2] [.t cget -spacing3]
} -cleanup {
    destroy .t
} -returnCodes {error} -result {expected screen distance but got "-1"}
test text-14.4 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -spacing1 1 -spacing2 1 -spacing3 -3
    list [.t cget -spacing1] [.t cget -spacing2] [.t cget -spacing3]
} -cleanup {
    destroy .t
} -returnCodes {error} -result {expected screen distance but got "-3"}
test text-14.5 {ConfigureText procedure} -setup {
    text .t
} -body {
    .t configure -tabs {30 foo}
} -cleanup {
    destroy .t
} -returnCodes error -result {bad tab alignment "foo": must be left, right, center, or numeric}