From 5f5dec875b76abf0a55e531de9d358ba5b34485f Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Wed, 19 Jun 2019 14:08:44 +0000
Subject: Use available "ucs2-be" encoding on X11 and "utf-16" encoding on
 Win32, if provided by Tcl (TIP #547). If Tcl doesn't provide those encodings,
 proceed as usual.

---
 unix/tkUnixFont.c | 31 +++++++++----------------------
 win/tkWinX.c      |  5 ++++-
 2 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 96635b4..d00ff82 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -186,14 +186,7 @@ static EncodingAlias encodingAliases[] = {
     {"tis620",		"tis620*"},
     {"ksc5601",		"ksc5601*"},
     {"dingbats",	"*dingbats"},
-#ifdef WORDS_BIGENDIAN
-    {"unicode",		"iso10646-1"},
-#else
-    /*
-     * ucs-2be is needed if native order isn't BE.
-     */
     {"ucs-2be",		"iso10646-1"},
-#endif
     {NULL,		NULL}
 };
 
@@ -246,7 +239,6 @@ static unsigned		RankAttributes(FontAttributes *wantPtr,
 static void		ReleaseFont(UnixFont *fontPtr);
 static void		ReleaseSubFont(Display *display, SubFont *subFontPtr);
 static int		SeenName(const char *name, Tcl_DString *dsPtr);
-#ifndef WORDS_BIGENDIAN
 static int		Ucs2beToUtfProc(ClientData clientData, const char*src,
 			    int srcLen, int flags, Tcl_EncodingState*statePtr,
 			    char *dst, int dstLen, int *srcReadPtr,
@@ -255,7 +247,6 @@ static int		UtfToUcs2beProc(ClientData clientData, const char*src,
 			    int srcLen, int flags, Tcl_EncodingState*statePtr,
 			    char *dst, int dstLen, int *srcReadPtr,
 			    int *dstWrotePtr, int *dstCharsPtr);
-#endif
 
 /*
  *-------------------------------------------------------------------------
@@ -320,9 +311,9 @@ TkpFontPkgInit(
 {
     ThreadSpecificData *tsdPtr =
 	    Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
-    Tcl_EncodingType type;
     SubFont dummy;
     int i;
+    Tcl_Encoding ucs2;
 
     if (tsdPtr->controlFamily.encoding == NULL) {
 	type.encodingName = "X11ControlChars";
@@ -343,20 +334,18 @@ TkpFontPkgInit(
 	    FontMapInsert(&dummy, i + 0x80);
 	}
 
-#ifndef WORDS_BIGENDIAN
 	/*
 	 * UCS-2BE is unicode (UCS-2) in big-endian format. Define this if
-	 * native order isn't BE. It is used in iso10646 fonts.
+	 * if it doesn't exist yet. It is used in iso10646 fonts.
 	 */
 
-	type.encodingName = "ucs-2be";
-	type.toUtfProc = Ucs2beToUtfProc;
-	type.fromUtfProc = UtfToUcs2beProc;
-	type.freeProc = NULL;
-	type.clientData = NULL;
-	type.nullSize = 2;
-	Tcl_CreateEncoding(&type);
-#endif
+	ucs2 = Tcl_GetEncoding(NULL, "ucs-2be");
+	if (ucs2 == NULL) {
+	    Tcl_EncodingType type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2};
+	    Tcl_CreateEncoding(&type);
+	} else {
+	    Tcl_FreeEncoding(ucs2);
+	}
 	Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL);
     }
 }
@@ -459,7 +448,6 @@ ControlUtfProc(
     return result;
 }
 
-#ifndef WORDS_BIGENDIAN
 /*
  *-------------------------------------------------------------------------
  *
@@ -632,7 +620,6 @@ UtfToUcs2beProc(
     *dstCharsPtr = numChars;
     return result;
 }
-#endif /* WORDS_BIGENDIAN */
 
 /*
  *---------------------------------------------------------------------------
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 75064b5..e7428e5 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -1594,7 +1594,10 @@ Tcl_Encoding
 TkWinGetUnicodeEncoding(void)
 {
     if (unicodeEncoding == NULL) {
-	unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
+	unicodeEncoding = Tcl_GetEncoding(NULL, "utf-16");
+	if (unicodeEncoding == NULL) {
+	    unicodeEncoding = Tcl_GetEncoding(NULL, "unicode");
+	}
     }
     return unicodeEncoding;
 }
-- 
cgit v0.12


From 8a887d823434875d32df819ad7791504415aa15f Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Thu, 20 Jun 2019 13:52:47 +0000
Subject: Handle SVG string > 2G, when compiled with Tcl 9 headers. Make
 TCL_INDEX_NONE symbol usable in Tk, even when compiled against Tcl 8.6
 headers.

---
 generic/tkImgSVGnano.c | 32 ++++++++++++++++----------------
 generic/tkInt.h        |  4 ++++
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
index f86c45e..b8776fe 100644
--- a/generic/tkImgSVGnano.c
+++ b/generic/tkImgSVGnano.c
@@ -62,7 +62,7 @@ static int		StringReadSVG(Tcl_Interp *interp, Tcl_Obj *dataObj,
 			    int destX, int destY, int width, int height,
 			    int srcX, int srcY);
 static NSVGimage *	ParseSVGWithOptions(Tcl_Interp *interp,
-			    const char *input, int length, Tcl_Obj *format,
+			    const char *input, size_t length, Tcl_Obj *format,
 			    RastOpts *ropts);
 static int		RasterizeSVG(Tcl_Interp *interp,
 			    Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage,
@@ -118,19 +118,19 @@ FileMatchSVG(
     int *widthPtr, int *heightPtr,
     Tcl_Interp *interp)
 {
-    int length;
+    size_t length;
     Tcl_Obj *dataObj = Tcl_NewObj();
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage;
 
     CleanCache(interp);
-    if (Tcl_ReadChars(chan, dataObj, -1, 0) == -1) {
+    if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) {
 	/* in case of an error reading the file */
 	Tcl_DecrRefCount(dataObj);
 	return 0;
     }
-    data = Tcl_GetStringFromObj(dataObj, &length);
+    data = TkGetStringFromObj(dataObj, &length);
     nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts);
     Tcl_DecrRefCount(dataObj);
     if (nsvgImage != NULL) {
@@ -178,7 +178,7 @@ FileReadSVG(
     int width, int height,
     int srcX, int srcY)
 {
-    int length;
+    size_t length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts);
@@ -186,14 +186,14 @@ FileReadSVG(
     if (nsvgImage == NULL) {
         Tcl_Obj *dataObj = Tcl_NewObj();
 
-	if (Tcl_ReadChars(chan, dataObj, -1, 0) == -1) {
+	if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) {
 	    /* in case of an error reading the file */
 	    Tcl_DecrRefCount(dataObj);
 	    Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", -1));
 	    Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL);
 	    return TCL_ERROR;
 	}
-        data = Tcl_GetStringFromObj(dataObj, &length);
+	data = TkGetStringFromObj(dataObj, &length);
 	nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj,
 			    &ropts);
 	Tcl_DecrRefCount(dataObj);
@@ -230,13 +230,13 @@ StringMatchSVG(
     int *widthPtr, int *heightPtr,
     Tcl_Interp *interp)
 {
-    int length;
+    size_t length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage;
 
     CleanCache(interp);
-    data = Tcl_GetStringFromObj(dataObj, &length);
+    data = TkGetStringFromObj(dataObj, &length);
     nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts);
     if (nsvgImage != NULL) {
 	*widthPtr = (int) ceil(nsvgImage->width * ropts.scale);
@@ -281,13 +281,13 @@ StringReadSVG(
     int width, int height,
     int srcX, int srcY)
 {
-    int length;
+    size_t length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts);
 
     if (nsvgImage == NULL) {
-        data = Tcl_GetStringFromObj(dataObj, &length);
+        data = TkGetStringFromObj(dataObj, &length);
 	nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj,
 			    &ropts);
     }
@@ -317,7 +317,7 @@ static NSVGimage *
 ParseSVGWithOptions(
     Tcl_Interp *interp,
     const char *input,
-    int length,
+    size_t length,
     Tcl_Obj *formatObj,
     RastOpts *ropts)
 {
@@ -576,14 +576,14 @@ CacheSVG(
     NSVGimage *nsvgImage,
     RastOpts *ropts)
 {
-    int length;
+    size_t length;
     const char *data;
     NSVGcache *cachePtr = GetCachePtr(interp);
 
     if (cachePtr != NULL) {
         cachePtr->dataOrChan = dataOrChan;
 	if (formatObj != NULL) {
-	    data = Tcl_GetStringFromObj(formatObj, &length);
+	    data = TkGetStringFromObj(formatObj, &length);
 	    Tcl_DStringAppend(&cachePtr->formatString, data, length);
 	}
 	cachePtr->nsvgImage = nsvgImage;
@@ -616,7 +616,7 @@ GetCachedSVG(
     Tcl_Obj *formatObj,
     RastOpts *ropts)
 {
-    int length;
+    size_t length;
     const char *data;
     NSVGcache *cachePtr = GetCachePtr(interp);
     NSVGimage *nsvgImage = NULL;
@@ -624,7 +624,7 @@ GetCachedSVG(
     if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) &&
 	(cachePtr->dataOrChan == dataOrChan)) {
         if (formatObj != NULL) {
-	    data = Tcl_GetStringFromObj(formatObj, &length);
+	    data = TkGetStringFromObj(formatObj, &length);
 	    if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) {
 	        nsvgImage = cachePtr->nsvgImage;
 		*ropts = cachePtr->ropts;
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 199641d..77b7725 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -880,6 +880,10 @@ typedef struct {
 #ifndef TCL_IO_FAILURE
 #   define TCL_IO_FAILURE (-1)
 #endif
+/* See TIP #537 */
+#ifndef TCL_INDEX_NONE
+#   define TCL_INDEX_NONE (-1)
+#endif
 
 /*
  * The following structure is used with TkMakeEnsemble to create ensemble
-- 
cgit v0.12


From aea98214f4498a5a6aed07652911d3643f7331da Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Fri, 21 Jun 2019 11:32:58 +0000
Subject: Make better use of the full range for Menu indexes, if Tk is compiled
 with Tcl 9.0 headers.

---
 generic/tkMenu.c | 78 +++++++++++++++++++++++++++++---------------------------
 generic/tkMenu.h |  4 +--
 2 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 33b548d..1e9e958 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -346,9 +346,9 @@ static void		DestroyMenuHashTable(ClientData clientData,
 			    Tcl_Interp *interp);
 static void		DestroyMenuInstance(TkMenu *menuPtr);
 static void		DestroyMenuEntry(void *memPtr);
-static int		GetIndexFromCoords(Tcl_Interp *interp,
+static TkSizeT	GetIndexFromCoords(Tcl_Interp *interp,
 			    TkMenu *menuPtr, const char *string,
-			    int *indexPtr);
+			    TkSizeT *indexPtr);
 static int		MenuDoYPosition(Tcl_Interp *interp,
 			    TkMenu *menuPtr, Tcl_Obj *objPtr);
 static int		MenuDoXPosition(Tcl_Interp *interp,
@@ -457,7 +457,7 @@ Tk_MenuObjCmd(
     menuPtr->widgetCmd = Tcl_CreateObjCommand(interp,
 	    Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr,
 	    MenuCmdDeletedProc);
-    menuPtr->active = (TkSizeT)-1;
+    menuPtr->active = TCL_INDEX_NONE;
     menuPtr->cursorPtr = NULL;
     menuPtr->masterMenuPtr = menuPtr;
     menuPtr->menuType = UNKNOWN_TYPE;
@@ -639,7 +639,7 @@ MenuWidgetObjCmd(
 
     switch ((enum options) option) {
     case MENU_ACTIVATE: {
-	int index;
+	TkSizeT index;
 
 	if (objc != 3) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -648,12 +648,12 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if ((int)menuPtr->active == index) {
+	if (menuPtr->active == index) {
 	    goto done;
 	}
-	if ((index >= 0) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY)
+	if ((index != TCL_INDEX_NONE) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY)
 		|| (menuPtr->entries[index]->state == ENTRY_DISABLED))) {
-	    index = -1;
+	    index = TCL_INDEX_NONE;
 	}
 	result = TkActivateMenuEntry(menuPtr, index);
 	break;
@@ -723,7 +723,8 @@ MenuWidgetObjCmd(
 	break;
     }
     case MENU_DELETE: {
-	int first, last;
+	TkSizeT first, last;
+	Tcl_WideInt w;
 
 	if ((objc != 3) && (objc != 4)) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "first ?last?");
@@ -736,8 +737,9 @@ MenuWidgetObjCmd(
 	 */
 
 	if (isdigit(UCHAR(Tcl_GetString(objv[2])[0]))
-		&& Tcl_GetIntFromObj(NULL, objv[2], &first) == TCL_OK) {
-	    if (first >= (int)menuPtr->numEntries) {
+		&& Tcl_GetWideIntFromObj(NULL, objv[2], &w) == TCL_OK) {
+	    first = w;
+	    if (first >= menuPtr->numEntries) {
 		goto done;
 	    }
 	} else if (TkGetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){
@@ -764,7 +766,7 @@ MenuWidgetObjCmd(
 	break;
     }
     case MENU_ENTRYCGET: {
-	int index;
+	TkSizeT index;
 	Tcl_Obj *resultPtr;
 
 	if (objc != 4) {
@@ -774,7 +776,7 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if (index < 0) {
+	if (index == TCL_INDEX_NONE) {
 	    goto done;
 	}
 	mePtr = menuPtr->entries[index];
@@ -789,7 +791,7 @@ MenuWidgetObjCmd(
 	break;
     }
     case MENU_ENTRYCONFIGURE: {
-	int index;
+	TkSizeT index;
 	Tcl_Obj *resultPtr;
 
 	if (objc < 3) {
@@ -799,7 +801,7 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if (index < 0) {
+	if (index == TCL_INDEX_NONE) {
 	    goto done;
 	}
 	mePtr = menuPtr->entries[index];
@@ -830,7 +832,7 @@ MenuWidgetObjCmd(
 	break;
     }
     case MENU_INDEX: {
-	int index;
+	TkSizeT index;
 
 	if (objc != 3) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "string");
@@ -839,7 +841,7 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if (index == -1) {
+	if (index == TCL_INDEX_NONE) {
 	    Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1));
 	} else {
 	    Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
@@ -857,7 +859,7 @@ MenuWidgetObjCmd(
 	}
 	break;
     case MENU_INVOKE: {
-	int index;
+	TkSizeT index;
 
 	if (objc != 3) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -866,14 +868,15 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if (index < 0) {
+	if (index == TCL_INDEX_NONE) {
 	    goto done;
 	}
 	result = TkInvokeMenu(interp, menuPtr, index);
 	break;
     }
     case MENU_POST: {
-	int x, y, index = -1;
+	int x, y;
+	TkSizeT index = TCL_INDEX_NONE;
 
 	if (objc != 4 && objc != 5) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "x y ?index?");
@@ -908,7 +911,7 @@ MenuWidgetObjCmd(
 	break;
     }
     case MENU_POSTCASCADE: {
-	int index;
+	TkSizeT index;
 
 	if (objc != 3) {
 	    Tcl_WrongNumArgs(interp, 2, objv, "index");
@@ -918,7 +921,7 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if ((index < 0) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
+	if ((index == TCL_INDEX_NONE) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) {
 	    result = TkPostSubmenu(interp, menuPtr, NULL);
 	} else {
 	    result = TkPostSubmenu(interp, menuPtr, menuPtr->entries[index]);
@@ -926,7 +929,7 @@ MenuWidgetObjCmd(
 	break;
     }
     case MENU_TYPE: {
-	int index;
+	TkSizeT index;
 	const char *typeStr;
 
 	if (objc != 3) {
@@ -936,7 +939,7 @@ MenuWidgetObjCmd(
 	if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) {
 	    goto error;
 	}
-	if (index < 0) {
+	if (index == TCL_INDEX_NONE) {
 	    goto done;
 	}
 	if (menuPtr->entries[index]->type == TEAROFF_ENTRY) {
@@ -1001,13 +1004,13 @@ int
 TkInvokeMenu(
     Tcl_Interp *interp,		/* The interp that the menu lives in. */
     TkMenu *menuPtr,		/* The menu we are invoking. */
-    int index)			/* The zero based index of the item we are
+    TkSizeT index)			/* The zero based index of the item we are
     				 * invoking. */
 {
     int result = TCL_OK;
     TkMenuEntry *mePtr;
 
-    if (index < 0) {
+    if (index == TCL_INDEX_NONE) {
     	goto done;
     }
     mePtr = menuPtr->entries[index];
@@ -2117,7 +2120,7 @@ TkGetMenuIndex(
 				 * manual entry for valid .*/
     int lastOK,			/* Non-zero means its OK to return index just
 				 * *after* last entry. */
-    int *indexPtr)		/* Where to store converted index. */
+    TkSizeT *indexPtr)		/* Where to store converted index. */
 {
     int i;
     const char *string = Tcl_GetString(objPtr);
@@ -2134,7 +2137,7 @@ TkGetMenuIndex(
     }
 
     if ((string[0] == 'n') && (strcmp(string, "none") == 0)) {
-	*indexPtr = -1;
+	*indexPtr = TCL_INDEX_NONE;
 	goto success;
     }
 
@@ -2348,7 +2351,8 @@ MenuAddOrInsert(
     Tcl_Obj *const objv[])	/* Arguments to command: first arg is type of
 				 * entry, others are config options. */
 {
-    int type, index;
+    int type;
+    TkSizeT index;
     TkMenuEntry *mePtr;
     TkMenu *menuListPtr;
 
@@ -2359,7 +2363,7 @@ MenuAddOrInsert(
     } else {
 	index = menuPtr->numEntries;
     }
-    if (index < 0) {
+    if (index == TCL_INDEX_NONE) {
 	Tcl_SetObjResult(interp, Tcl_ObjPrintf(
 		"bad index \"%s\"", Tcl_GetString(indexPtr)));
 	Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
@@ -2599,7 +2603,7 @@ TkActivateMenuEntry(
     register TkMenuEntry *mePtr;
     int result = TCL_OK;
 
-    if (menuPtr->active != (TkSizeT)-1) {
+    if (menuPtr->active != TCL_INDEX_NONE) {
 	mePtr = menuPtr->entries[menuPtr->active];
 
 	/*
@@ -2613,7 +2617,7 @@ TkActivateMenuEntry(
 	TkEventuallyRedrawMenu(menuPtr, menuPtr->entries[menuPtr->active]);
     }
     menuPtr->active = index;
-    if (index != (TkSizeT)-1) {
+    if (index != TCL_INDEX_NONE) {
 	mePtr = menuPtr->entries[index];
 	mePtr->state = ENTRY_ACTIVE;
 	TkEventuallyRedrawMenu(menuPtr, mePtr);
@@ -2868,14 +2872,14 @@ MenuDoXPosition(
     TkMenu *menuPtr,
     Tcl_Obj *objPtr)
 {
-    int index;
+    TkSizeT index;
 
     TkRecomputeMenu(menuPtr);
     if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
 	return TCL_ERROR;
     }
     Tcl_ResetResult(interp);
-    if (index == -1) {
+    if (index == TCL_INDEX_NONE) {
 	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
     } else {
 	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->x));
@@ -2905,14 +2909,14 @@ MenuDoYPosition(
     TkMenu *menuPtr,
     Tcl_Obj *objPtr)
 {
-    int index;
+    TkSizeT index;
 
     TkRecomputeMenu(menuPtr);
     if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) {
 	goto error;
     }
     Tcl_ResetResult(interp);
-    if (index == -1) {
+    if (index == TCL_INDEX_NONE) {
 	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0));
     } else {
 	Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->y));
@@ -2943,12 +2947,12 @@ MenuDoYPosition(
  *----------------------------------------------------------------------
  */
 
-static int
+static TkSizeT
 GetIndexFromCoords(
     Tcl_Interp *interp,		/* Interpreter of menu. */
     TkMenu *menuPtr,		/* The menu we are searching. */
     const char *string,		/* The @string we are parsing. */
-    int *indexPtr)		/* The index of the item that matches. */
+    TkSizeT *indexPtr)		/* The index of the item that matches. */
 {
     int x, y, i;
     const char *p;
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 5449879..6843861 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -496,11 +496,11 @@ MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp,
 MODULE_SCOPE int	TkFreeMenuReferences(TkMenuReferences *menuRefPtr);
 MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp);
 MODULE_SCOPE int	TkGetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr,
-			    Tcl_Obj *objPtr, int lastOK, int *indexPtr);
+			    Tcl_Obj *objPtr, int lastOK, TkSizeT *indexPtr);
 MODULE_SCOPE void	TkMenuInitializeDrawingFields(TkMenu *menuPtr);
 MODULE_SCOPE void	TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr);
 MODULE_SCOPE int	TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr,
-			    int index);
+			    TkSizeT index);
 MODULE_SCOPE void	TkMenuConfigureDrawOptions(TkMenu *menuPtr);
 MODULE_SCOPE int	TkMenuConfigureEntryDrawOptions(
 			    TkMenuEntry *mePtr, TkSizeT index);
-- 
cgit v0.12


From fa95af8befdf1f0cbeb26ca20e96a10c91af5e6f Mon Sep 17 00:00:00 2001
From: Kevin Walzer <kw@codebykevin.com>
Date: Fri, 21 Jun 2019 12:01:41 +0000
Subject: Documentation cleanup and removal of redundant constants; thanks to
 Christopher Chavez for reports and patch

---
 macosx/README              | 10 +++++-----
 macosx/tkMacOSXConstants.h | 14 --------------
 2 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/macosx/README b/macosx/README
index bed8d22..f35c128 100644
--- a/macosx/README
+++ b/macosx/README
@@ -26,7 +26,7 @@ before asking on the list, many questions have already been answered).
 ---------------------------
 
 - There are two versions of Tk available on macOS: TkAqua using the native
-aqua widgets and look&feel, and TkX11 using the traditional unix X11 wigets.
+aqua widgets and look&feel, and TkX11 using the traditional unix X11 widgets.
 TkX11 requires an X11 server to be installed, such as Apple's X11 (which is
 available as an optional or default install on recent macOS).
 TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem].
@@ -490,7 +490,7 @@ The macOS Tk application does not call the [NSApp run] method at
 all.  Instead it uses the event loop built in to Tk.  So the
 application must take care to replicate the important features of the
 method ourselves.  The way that autorelease pools are handled is
-discussed in 4.2 below.  Here we discuss the event handling itself.
+discussed in 5.2 below.  Here we discuss the event handling itself.
 
 The Tcl event loop simply consists of repeated calls to TclDoOneEvent.
 Each call to TclDoOneEvent begins by collecting all pending events from
@@ -523,7 +523,7 @@ event to the Tcl queue.
 
 In order to carry out the job of managing autorelease pools, which
 would normally be handled by the [NSApp run] method, a private
-NSAUtoreleasePool* property is added to the TkApplication subclass of
+NSAutoreleasePool* property is added to the TkApplication subclass of
 NSApplication. The TkpInit function calls [NSApp _setup] which
 initializes this property by creating an NSAutoreleasePool prior to
 calling [NSApp finishLaunching].  This mimics the behavior of the
@@ -548,7 +548,7 @@ in nested calls to CheckProc.
 One additional minor caveat for developers is that there are several
 steps of the Tk initialization which precede the call to TkpInit.
 Notably, the font package is initialized first.  Since there is no
-NSAUtoreleasePool in scope prior to calling TkpInit, the functions
+NSAutoreleasePool in scope prior to calling TkpInit, the functions
 called in these preliminary stages need to create and drain their own
 NSAutoreleasePools whenever they call methods of Appkit objects
 (e.g. NSFont).
@@ -568,7 +568,7 @@ window. (Normally, the clipping rectangle is the same as the bounding
 rectangle, but drawing can be clipped to a smaller rectangle by
 calling TkpClipDrawableToRect.) The aboveVisRgn is the intersection of
 the window's bounding rectangle with the bounding rectangle of the
-parent window.  Much of the code in tkMacOSXSubindows.c is devoted to
+parent window.  Much of the code in tkMacOSXSubwindows.c is devoted to
 rebuilding these clipping regions whenever something changes in the
 layout of the windows.  This turns out to be a tricky thing to do and
 it is extremely prone to errors which can be difficult to trace.
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h
index 0badf1a..8ef535c 100644
--- a/macosx/tkMacOSXConstants.h
+++ b/macosx/tkMacOSXConstants.h
@@ -79,22 +79,8 @@
 #define NSInformationalAlertStyle NSAlertStyleInformational
 #define NSCriticalAlertStyle NSAlertStyleCritical
 #define NSCenterTextAlignment NSTextAlignmentCenter
-#define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask
-#define NSCommandKeyMask NSEventModifierFlagCommand
-#define NSShiftKeyMask NSEventModifierFlagShift
-#define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock
-#define NSAlternateKeyMask NSEventModifierFlagOption
-#define NSControlKeyMask NSEventModifierFlagControl
-#define NSNumericPadKeyMask NSEventModifierFlagNumericPad
-#define NSFunctionKeyMask NSEventModifierFlagFunction
-#define NSKeyUp NSEventTypeKeyUp
-#define NSKeyDown NSEventTypeKeyDown
-#define NSFlagsChanged NSEventTypeFlagsChanged
-#define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock
-#define NSShiftKeyMask NSEventModifierFlagShift
 #define NSAnyEventMask NSEventMaskAny
 #define NSApplicationDefinedMask NSEventMaskApplicationDefined
-#define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground
 #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow
 #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel
 #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow
-- 
cgit v0.12


From 29eb13819fbe92822a05cd43e696c81b77ce1ac4 Mon Sep 17 00:00:00 2001
From: Kevin Walzer <kw@codebykevin.com>
Date: Fri, 21 Jun 2019 12:03:28 +0000
Subject: Documentation cleanup and removal of redundant constants; thanks to
 Christopher Chavez for reports and patch

---
 macosx/README              | 29 ++++++++++++++---------------
 macosx/tkMacOSXConstants.h | 14 --------------
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/macosx/README b/macosx/README
index c2fa040..3e8b031 100644
--- a/macosx/README
+++ b/macosx/README
@@ -1,4 +1,4 @@
-Tcl/Tk macOS README
+Tcl/Tk macOS README 
 ----------------------
 
 This is the README file for the macOS/Darwin version of Tcl/Tk.
@@ -26,7 +26,7 @@ before asking on the list, many questions have already been answered).
 ---------------------------
 
 - There are two versions of Tk available on macOS: TkAqua using the native
-aqua widgets and look&feel, and TkX11 using the traditional unix X11 wigets.
+aqua widgets and look&feel, and TkX11 using the traditional unix X11 widgets.
 TkX11 requires an X11 server to be installed, such as Apple's X11 (which is
 available as an optional or default install on recent macOS).
 TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem].
@@ -490,7 +490,7 @@ The macOS Tk application does not call the [NSApp run] method at
 all.  Instead it uses the event loop built in to Tk.  So the
 application must take care to replicate the important features of the
 method ourselves.  The way that autorelease pools are handled is
-discussed in 4.2 below.  Here we discuss the event handling itself.
+discussed in 5.2 below.  Here we discuss the event handling itself.
 
 The Tcl event loop simply consists of repeated calls to TclDoOneEvent.
 Each call to TclDoOneEvent begins by collecting all pending events from
@@ -523,7 +523,7 @@ event to the Tcl queue.
 
 In order to carry out the job of managing autorelease pools, which
 would normally be handled by the [NSApp run] method, a private
-NSAUtoreleasePool* property is added to the TkApplication subclass of
+NSAutoreleasePool* property is added to the TkApplication subclass of
 NSApplication. The TkpInit function calls [NSApp _setup] which
 initializes this property by creating an NSAutoreleasePool prior to
 calling [NSApp finishLaunching].  This mimics the behavior of the
@@ -548,7 +548,7 @@ in nested calls to CheckProc.
 One additional minor caveat for developers is that there are several
 steps of the Tk initialization which precede the call to TkpInit.
 Notably, the font package is initialized first.  Since there is no
-NSAUtoreleasePool in scope prior to calling TkpInit, the functions
+NSAutoreleasePool in scope prior to calling TkpInit, the functions
 called in these preliminary stages need to create and drain their own
 NSAutoreleasePools whenever they call methods of Appkit objects
 (e.g. NSFont).
@@ -568,7 +568,7 @@ window. (Normally, the clipping rectangle is the same as the bounding
 rectangle, but drawing can be clipped to a smaller rectangle by
 calling TkpClipDrawableToRect.) The aboveVisRgn is the intersection of
 the window's bounding rectangle with the bounding rectangle of the
-parent window.  Much of the code in tkMacOSXSubindows.c is devoted to
+parent window.  Much of the code in tkMacOSXSubwindows.c is devoted to
 rebuilding these clipping regions whenever something changes in the
 layout of the windows.  This turns out to be a tricky thing to do and
 it is extremely prone to errors which can be difficult to trace.
@@ -663,16 +663,15 @@ source and destination rectangles for the scrolling.  The embedded
 windows are redrawn within the DisplayText function by some
 conditional code which is only used for macOS.
 
-6. Virtual events on 10.14
----------------------------
+6.0 Virtual events on 10.14
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 10.14 supports system appearance changes, and has added a "Dark Mode"
-that casts all window frames and menus as black. Tk 8.6.9 supports Dark
-Mode by having the window decorations, menus, and dialogs automatically
-take on the appropriate appearance when the system appearance is changed.
-Because the window content itself is drawn by Tk, it will not change when
-the system mode changes.
-
+that casts all window frames and menus as black. Tk 8.6.9 has added two
+virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update
+your Tk app's appearance when the system appearance changes. Just bind
+your appearance-updating code to these virtual events and you will see
+it triggered when the system appearance toggles between dark and light.
 
 7.0 Mac Services
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -703,7 +702,7 @@ that LaunchServices is launching the correct Wish.app.  Instructions
 for doing this are provided below.
 
 The command line tool which manages the LaunchServices database has
-an amazingly unwieldy path name.  So, first, run this command:
+an amazingly unwieldy path name.  So, first, run this command: 
 
 alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
 
diff --git a/macosx/tkMacOSXConstants.h b/macosx/tkMacOSXConstants.h
index 0badf1a..8ef535c 100644
--- a/macosx/tkMacOSXConstants.h
+++ b/macosx/tkMacOSXConstants.h
@@ -79,22 +79,8 @@
 #define NSInformationalAlertStyle NSAlertStyleInformational
 #define NSCriticalAlertStyle NSAlertStyleCritical
 #define NSCenterTextAlignment NSTextAlignmentCenter
-#define NSDeviceIndependentModifierFlagsMask NSEventModifierFlagDeviceIndependentFlagsMask
-#define NSCommandKeyMask NSEventModifierFlagCommand
-#define NSShiftKeyMask NSEventModifierFlagShift
-#define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock
-#define NSAlternateKeyMask NSEventModifierFlagOption
-#define NSControlKeyMask NSEventModifierFlagControl
-#define NSNumericPadKeyMask NSEventModifierFlagNumericPad
-#define NSFunctionKeyMask NSEventModifierFlagFunction
-#define NSKeyUp NSEventTypeKeyUp
-#define NSKeyDown NSEventTypeKeyDown
-#define NSFlagsChanged NSEventTypeFlagsChanged
-#define NSAlphaShiftKeyMask NSEventModifierFlagCapsLock
-#define NSShiftKeyMask NSEventModifierFlagShift
 #define NSAnyEventMask NSEventMaskAny
 #define NSApplicationDefinedMask NSEventMaskApplicationDefined
-#define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground
 #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow
 #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel
 #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow
-- 
cgit v0.12


From 8fb0a9c7c1a87f04f3a5ef5da5d68630709a23b4 Mon Sep 17 00:00:00 2001
From: dgp <dgp@users.sourceforge.net>
Date: Fri, 21 Jun 2019 12:34:20 +0000
Subject: Resolve compiler warnings and segfault in imgListFormat tests.

---
 generic/tkImgSVGnano.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
index b8776fe..32391ef 100644
--- a/generic/tkImgSVGnano.c
+++ b/generic/tkImgSVGnano.c
@@ -118,7 +118,7 @@ FileMatchSVG(
     int *widthPtr, int *heightPtr,
     Tcl_Interp *interp)
 {
-    size_t length;
+    int length;
     Tcl_Obj *dataObj = Tcl_NewObj();
     const char *data;
     RastOpts ropts;
@@ -178,7 +178,7 @@ FileReadSVG(
     int width, int height,
     int srcX, int srcY)
 {
-    size_t length;
+    int length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts);
@@ -230,7 +230,7 @@ StringMatchSVG(
     int *widthPtr, int *heightPtr,
     Tcl_Interp *interp)
 {
-    size_t length;
+    int length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage;
@@ -281,7 +281,7 @@ StringReadSVG(
     int width, int height,
     int srcX, int srcY)
 {
-    size_t length;
+    int length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts);
@@ -576,7 +576,7 @@ CacheSVG(
     NSVGimage *nsvgImage,
     RastOpts *ropts)
 {
-    size_t length;
+    int length;
     const char *data;
     NSVGcache *cachePtr = GetCachePtr(interp);
 
@@ -616,7 +616,7 @@ GetCachedSVG(
     Tcl_Obj *formatObj,
     RastOpts *ropts)
 {
-    size_t length;
+    int length;
     const char *data;
     NSVGcache *cachePtr = GetCachePtr(interp);
     NSVGimage *nsvgImage = NULL;
-- 
cgit v0.12


From f8f745fe34d10d25ff1fe4e0935e042b5347004c Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Fri, 21 Jun 2019 12:40:03 +0000
Subject: Eliminate some redundant type-casts

---
 generic/tkCanvText.c |  8 ++++----
 generic/tkFrame.c    | 12 ++++++------
 generic/tkSelect.c   |  2 +-
 generic/tkText.c     |  2 +-
 generic/tkTextMark.c |  4 ++--
 unix/tkUnixSelect.c  |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index b9607a5..d358fb3 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -1388,13 +1388,13 @@ GetTextIndex(
 
     c = string[0];
 
-    if ((c == 'e') && (strncmp(string, "end", (unsigned) length) == 0)) {
+    if ((c == 'e') && (strncmp(string, "end", length) == 0)) {
 	*indexPtr = textPtr->numChars;
     } else if ((c == 'i')
-	    && (strncmp(string, "insert", (unsigned) length) == 0)) {
+	    && (strncmp(string, "insert", length) == 0)) {
 	*indexPtr = textPtr->insertPos;
     } else if ((c == 's') && (length >= 5)
-	    && (strncmp(string, "sel.first", (unsigned) length) == 0)) {
+	    && (strncmp(string, "sel.first", length) == 0)) {
 	if (textInfoPtr->selItemPtr != itemPtr) {
 	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
 		    "selection isn't in item", -1));
@@ -1403,7 +1403,7 @@ GetTextIndex(
 	}
 	*indexPtr = textInfoPtr->selectFirst;
     } else if ((c == 's') && (length >= 5)
-	    && (strncmp(string, "sel.last", (unsigned) length) == 0)) {
+	    && (strncmp(string, "sel.last", length) == 0)) {
 	if (textInfoPtr->selItemPtr != itemPtr) {
 	    Tcl_SetObjResult(interp, Tcl_NewStringObj(
 		    "selection isn't in item", -1));
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index 0edd4c2..746f3eb 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -826,17 +826,17 @@ FrameWidgetObjCmd(
 		}
 		c = arg[1];
 		if (((c == 'c') && (length >= 2)
-			&& (strncmp(arg, "-class", (unsigned)length) == 0))
+			&& (strncmp(arg, "-class", length) == 0))
 		    || ((c == 'c') && (length >= 3)
-			&& (strncmp(arg, "-colormap", (unsigned)length) == 0))
+			&& (strncmp(arg, "-colormap", length) == 0))
 		    || ((c == 'c') && (length >= 3)
-			&& (strncmp(arg, "-container", (unsigned)length) == 0))
+			&& (strncmp(arg, "-container", length) == 0))
 		    || ((c == 's') && (framePtr->type == TYPE_TOPLEVEL)
-			&& (strncmp(arg, "-screen", (unsigned)length) == 0))
+			&& (strncmp(arg, "-screen", length) == 0))
 		    || ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL)
-			&& (strncmp(arg, "-use", (unsigned)length) == 0))
+			&& (strncmp(arg, "-use", length) == 0))
 		    || ((c == 'v')
-			&& (strncmp(arg, "-visual", (unsigned)length) == 0))) {
+			&& (strncmp(arg, "-visual", length) == 0))) {
 
 #ifdef SUPPORT_CONFIG_EMBEDDED
 		    if (c == 'u') {
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 85865de..b2dd0d9 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -1508,7 +1508,7 @@ TkSelDefaultSelection(
 	    Tcl_DStringFree(&ds);
 	    return -1;
 	}
-	memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) (1+length));
+	memcpy(buffer, Tcl_DStringValue(&ds), length + 1);
 	Tcl_DStringFree(&ds);
 	*typePtr = XA_ATOM;
 	return length;
diff --git a/generic/tkText.c b/generic/tkText.c
index 7e09bfd..a738c57 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -6031,7 +6031,7 @@ SearchCore(
 		     */
 
 		    p = startOfLine + lastOffset - firstNewLine - 1;
-		    if (strncmp(p, pattern, (unsigned) firstNewLine + 1)) {
+		    if (strncmp(p, pattern, firstNewLine + 1)) {
 			/*
 			 * No match.
 			 */
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index aca08fb..c516697 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -162,10 +162,10 @@ TkTextMarkCmd(
 	}
 	str = TkGetStringFromObj(objv[4],&length);
 	c = str[0];
-	if ((c == 'l') && (strncmp(str, "left", (unsigned) length) == 0)) {
+	if ((c == 'l') && (strncmp(str, "left", length) == 0)) {
 	    newTypePtr = &tkTextLeftMarkType;
 	} else if ((c == 'r') &&
-		(strncmp(str, "right", (unsigned) length) == 0)) {
+		(strncmp(str, "right", length) == 0)) {
 	    newTypePtr = &tkTextRightMarkType;
 	} else {
 	    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 5b450f4..3009873 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -919,7 +919,7 @@ ConvertSelection(
 	    /*
 	     * Nobody seems to know about this kind of request. If it's of a
 	     * sort that we can handle without any help, do it. Otherwise mark
-	     * the request as an errror.
+	     * the request as an error.
 	     */
 
 	    numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer,
-- 
cgit v0.12


From 779f43bf68b8ce10b9356a7ac83916707c4a780b Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Fri, 21 Jun 2019 13:23:24 +0000
Subject: Make better use of full range for string lengths, if Tk is compiled
 with Tcl 9.0 headers.

---
 generic/tkImgSVGnano.c | 16 ++++++++--------
 generic/tkObj.c        |  2 +-
 win/tkWinDialog.c      |  5 ++---
 win/tkWinWm.c          | 38 +++++++++++++++-----------------------
 4 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
index 32391ef..d64ae5b 100644
--- a/generic/tkImgSVGnano.c
+++ b/generic/tkImgSVGnano.c
@@ -62,7 +62,7 @@ static int		StringReadSVG(Tcl_Interp *interp, Tcl_Obj *dataObj,
 			    int destX, int destY, int width, int height,
 			    int srcX, int srcY);
 static NSVGimage *	ParseSVGWithOptions(Tcl_Interp *interp,
-			    const char *input, size_t length, Tcl_Obj *format,
+			    const char *input, TkSizeT length, Tcl_Obj *format,
 			    RastOpts *ropts);
 static int		RasterizeSVG(Tcl_Interp *interp,
 			    Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage,
@@ -118,7 +118,7 @@ FileMatchSVG(
     int *widthPtr, int *heightPtr,
     Tcl_Interp *interp)
 {
-    int length;
+    TkSizeT length;
     Tcl_Obj *dataObj = Tcl_NewObj();
     const char *data;
     RastOpts ropts;
@@ -178,7 +178,7 @@ FileReadSVG(
     int width, int height,
     int srcX, int srcY)
 {
-    int length;
+    TkSizeT length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts);
@@ -230,7 +230,7 @@ StringMatchSVG(
     int *widthPtr, int *heightPtr,
     Tcl_Interp *interp)
 {
-    int length;
+    TkSizeT length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage;
@@ -281,7 +281,7 @@ StringReadSVG(
     int width, int height,
     int srcX, int srcY)
 {
-    int length;
+    TkSizeT length;
     const char *data;
     RastOpts ropts;
     NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts);
@@ -317,7 +317,7 @@ static NSVGimage *
 ParseSVGWithOptions(
     Tcl_Interp *interp,
     const char *input,
-    size_t length,
+    TkSizeT length,
     Tcl_Obj *formatObj,
     RastOpts *ropts)
 {
@@ -576,7 +576,7 @@ CacheSVG(
     NSVGimage *nsvgImage,
     RastOpts *ropts)
 {
-    int length;
+    TkSizeT length;
     const char *data;
     NSVGcache *cachePtr = GetCachePtr(interp);
 
@@ -616,7 +616,7 @@ GetCachedSVG(
     Tcl_Obj *formatObj,
     RastOpts *ropts)
 {
-    int length;
+    TkSizeT length;
     const char *data;
     NSVGcache *cachePtr = GetCachePtr(interp);
     NSVGimage *nsvgImage = NULL;
diff --git a/generic/tkObj.c b/generic/tkObj.c
index b857d98..419a144 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -672,7 +672,7 @@ UpdateStringOfMM(
 {
     MMRep *mmPtr;
     char buffer[TCL_DOUBLE_SPACE];
-    size_t len;
+    TkSizeT len;
 
     mmPtr = objPtr->internalRep.twoPtrValue.ptr1;
     /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index dfcc744..a3b6e34 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -2107,13 +2107,12 @@ MakeFilter(
 	*p = '\0';
 
     } else {
-	size_t len;
+	TkSizeT len;
 
 	if (valuePtr == NULL) {
 	    len = 0;
 	} else {
-	    (void) Tcl_GetString(valuePtr);
-	    len = valuePtr->length;
+	    (void) TkGetStringFromObj(valuePtr, &len);
 	}
 
 	/*
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index bd57ceb..69f5d7b 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2801,7 +2801,7 @@ Tk_WmObjCmd(
 	WMOPT_WITHDRAW
     };
     int index;
-    size_t length;
+    TkSizeT length;
     const char *argv1;
     TkWindow *winPtr, **winPtrPtr = &winPtr;
     TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -2812,8 +2812,7 @@ Tk_WmObjCmd(
 	return TCL_ERROR;
     }
 
-    argv1 = Tcl_GetString(objv[1]);
-    length = objv[1]->length;
+    argv1 = TkGetStringFromObj(objv[1], &length);
     if ((argv1[0] == 't') && !strncmp(argv1, "tracing", length)
 	    && (length >= 3)) {
 	int wmTracing;
@@ -3030,7 +3029,7 @@ WmAttributesCmd(
     LONG style, exStyle, styleBit, *stylePtr = NULL;
     const char *string;
     int i, boolean;
-    size_t length;
+    TkSizeT length;
     int config_fullscreen = 0, updatewrapper = 0;
     int fullscreen_attr_changed = 0, fullscreen_attr = 0;
 
@@ -3077,8 +3076,7 @@ WmAttributesCmd(
 	return TCL_OK;
     }
     for (i = 3; i < objc; i += 2) {
-	string = Tcl_GetString(objv[i]);
-	length = objv[i]->length;
+	string = TkGetStringFromObj(objv[i], &length);
 	if ((length < 2) || (string[0] != '-')) {
 	    goto configArgs;
 	}
@@ -3146,9 +3144,8 @@ WmAttributesCmd(
 		    }
 		    wmPtr->alpha = dval;
 		} else {			/* -transparentcolor */
-		    const char *crefstr = Tcl_GetString(objv[i+1]);
+		    const char *crefstr = TkGetStringFromObj(objv[i+1], &length);
 
-		    length = objv[i+1]->length;
 		    if (length == 0) {
 			/* reset to no transparent color */
 			if (wmPtr->crefObj) {
@@ -3326,7 +3323,7 @@ WmClientCmd(
 {
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     const char *argv3;
-    size_t length;
+    TkSizeT length;
 
     if ((objc != 3) && (objc != 4)) {
 	Tcl_WrongNumArgs(interp, 2, objv, "window ?name?");
@@ -3339,8 +3336,7 @@ WmClientCmd(
 	}
 	return TCL_OK;
     }
-    argv3 = Tcl_GetString(objv[3]);
-    length = objv[3]->length;
+    argv3 = TkGetStringFromObj(objv[3], &length);
     if (argv3[0] == 0) {
 	if (wmPtr->clientMachine != NULL) {
 	    ckfree(wmPtr->clientMachine);
@@ -3926,7 +3922,7 @@ WmGroupCmd(
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     Tk_Window tkwin2;
     const char *argv3;
-    size_t length;
+    TkSizeT length;
 
     if ((objc != 3) && (objc != 4)) {
 	Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?");
@@ -3938,8 +3934,7 @@ WmGroupCmd(
 	}
 	return TCL_OK;
     }
-    argv3 = Tcl_GetString(objv[3]);
-    length = objv[3]->length;
+    argv3 = TkGetStringFromObj(objv[3], &length);
     if (*argv3 == '\0') {
 	wmPtr->hints.flags &= ~WindowGroupHint;
 	if (wmPtr->leaderName != NULL) {
@@ -4248,7 +4243,7 @@ WmIconnameCmd(
 {
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     const char *argv3;
-    size_t length;
+    TkSizeT length;
 
     if (objc > 4) {
 	Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?");
@@ -4262,8 +4257,7 @@ WmIconnameCmd(
 	if (wmPtr->iconName != NULL) {
 	    ckfree(wmPtr->iconName);
 	}
-	argv3 = Tcl_GetString(objv[3]);
-	length = objv[3]->length;
+	argv3 = Tcl_GetStringFromObj(objv[3], &length);
 	wmPtr->iconName = ckalloc(length + 1);
 	memcpy(wmPtr->iconName, argv3, length + 1);
 	if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -4957,7 +4951,7 @@ WmProtocolCmd(
     register ProtocolHandler *protPtr, *prevPtr;
     Atom protocol;
     const char *cmd;
-    size_t cmdLength;
+    TkSizeT cmdLength;
     Tcl_Obj *resultObj;
 
     if ((objc < 3) || (objc > 5)) {
@@ -5012,8 +5006,7 @@ WmProtocolCmd(
 	    break;
 	}
     }
-    cmd = Tcl_GetString(objv[4]);
-    cmdLength = objv[4]->length;
+    cmd = TkGetStringFromObj(objv[4], &cmdLength);
     if (cmdLength > 0) {
 	protPtr = ckalloc(HANDLER_SIZE(cmdLength));
 	protPtr->protocol = protocol;
@@ -5451,7 +5444,7 @@ WmTitleCmd(
 {
     register WmInfo *wmPtr = winPtr->wmInfoPtr;
     const char *argv3;
-    size_t length;
+    TkSizeT length;
     HWND wrapper;
 
     if (objc > 4) {
@@ -5484,8 +5477,7 @@ WmTitleCmd(
 	if (wmPtr->title != NULL) {
 	    ckfree(wmPtr->title);
 	}
-	argv3 = Tcl_GetString(objv[3]);
-	length = objv[3]->length;
+	argv3 = TkGetStringFromObj(objv[3], &length);
 	wmPtr->title = ckalloc(length + 1);
 	memcpy(wmPtr->title, argv3, length + 1);
 
-- 
cgit v0.12


From 8bfb3ee2869841799b88a03b53ca7e2b99c5b10c Mon Sep 17 00:00:00 2001
From: dkf <donal.k.fellows@manchester.ac.uk>
Date: Sat, 22 Jun 2019 06:25:36 +0000
Subject: CONST to const; make code compile

---
 macosx/tkMacOSXInit.c     | 71 +++++++++++++++++++++++++----------------------
 macosx/tkMacOSXPrivate.h  |  9 +++---
 macosx/tkMacOSXServices.c | 10 +++----
 3 files changed, 47 insertions(+), 43 deletions(-)

diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 946bf30..cc7c23a 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -28,6 +28,13 @@ static char tkLibPath[PATH_MAX + 1] = "";
 
 static char scriptPath[PATH_MAX + 1] = "";
 
+/*
+ * Forward declarations...
+ */
+
+static int		TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
+			    int objc, Tcl_Obj *const objv[]);
+
 #pragma mark TKApplication(TKInit)
 
 @implementation TKApplication
@@ -388,7 +395,8 @@ TkpInit(
 	    TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL);
     Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
 	    TkMacOSXIconBitmapObjCmd, NULL, NULL);
-    Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
+    Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
+	    TkMacOSXGetAppPathCmd, NULL, NULL);
 
     /*
      * Initialize the NSServices object here. Apple's docs say to do this
@@ -437,11 +445,11 @@ TkpGetAppName(
     }
     Tcl_DStringAppend(namePtr, name, -1);
 }
-
+
 /*
  *----------------------------------------------------------------------
  *
- * TkMacOSXGetAppPath --
+ * TkMacOSXGetAppPathCmd --
  *
  *	Returns the path of the Wish application bundle.
  *
@@ -453,42 +461,39 @@ TkpGetAppName(
  *
  *----------------------------------------------------------------------
  */
-int TkMacOSXGetAppPath(
-		       ClientData cd,
-		       Tcl_Interp *ip,
-		       int objc,
-		       Tcl_Obj *CONST objv[])
-{
-
-  CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
-
-
-  /*
-   * Convert the URL reference into a string reference.
-   */
-
-  CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
 
-  /*
-   * Get the system encoding method.
-   */
-
-  CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
+static int
+TkMacOSXGetAppPathCmd(
+    ClientData ignored,
+    Tcl_Interp *interp,
+    int objc,
+    Tcl_Obj *const objv[])
+{
+    if (objc != 1) {
+	Tcl_WrongNumArgs(interp, 1, objv, NULL);
+	return TCL_ERROR;
+    }
 
-  /*
-   * Convert the string reference into a C string.
-   */
+    /*
+     * Get the application path URL and convert it to a string path reference.
+     */
 
-  char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod);
+    CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+    CFStringRef appPath =
+	    CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
 
-  Tcl_SetResult(ip, path, NULL);
+    /*
+     * Convert (and copy) the string reference into a Tcl result.
+     */
 
-  CFRelease(mainBundleURL);
-  CFRelease(appPath);
-  return TCL_OK;
+    Tcl_SetObjResult(interp, Tcl_NewStringObj(
+	    CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1));
 
+    CFRelease(mainBundleURL);
+    CFRelease(appPath);
+    return TCL_OK;
 }
-
+
 /*
  *----------------------------------------------------------------------
  *
@@ -555,7 +560,7 @@ TkMacOSXDefaultStartupScript(void)
 	    CFURLRef scriptFldrURL;
 	    char startupScript[PATH_MAX + 1];
 
-	    if (CFURLGetFileSystemRepresentation (appMainURL, true,
+	    if (CFURLGetFileSystemRepresentation(appMainURL, true,
 		    (unsigned char *) startupScript, PATH_MAX)) {
 		Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL);
 		scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL,
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index a67f894..4dbf536 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -115,9 +115,10 @@
  * Macro abstracting use of TkMacOSXGetNamedSymbol to init named symbols.
  */
 
+#define UNINITIALISED_SYMBOL	((void*)(-1L))
 #define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \
-    static ret (* symbol)(__VA_ARGS__) = (void*)(-1L); \
-    if (symbol == (void*)(-1L)) { \
+    static ret (* symbol)(__VA_ARGS__) = UNINITIALISED_SYMBOL; \
+    if (symbol == UNINITIALISED_SYMBOL) { \
 	symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), \
 		STRINGIFY(symbol)); \
     }
@@ -430,9 +431,7 @@ VISIBILITY_HIDDEN
 @end
 
 #endif /* _TKMACPRIV */
-
-int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]);
-
+
 /*
  * Local Variables:
  * mode: objc
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index af40a91..9bc22ea 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -157,16 +157,16 @@ ServicesEventProc(
 int
 TkMacOSXRegisterServiceWidgetObjCmd(
     ClientData cd,
-    Tcl_Interp *ip,
+    Tcl_Interp *interp,
     int objc,
-    Tcl_Obj *CONST objv[])
+    Tcl_Obj *const objv[])
 {
     /*
      * Need proper number of args.
      */
 
     if (objc != 2) {
-	Tcl_WrongNumArgs(ip, 1, objv, "path?");
+	Tcl_WrongNumArgs(interp, 1, objv, "path?");
 	return TCL_ERROR;
     }
 
@@ -176,8 +176,8 @@ TkMacOSXRegisterServiceWidgetObjCmd(
 
     Rect bounds;
     NSRect frame;
-    Tk_Window path =
-	    Tk_NameToWindow(ip, Tcl_GetString(objv[1]), Tk_MainWindow(ip));
+    Tk_Window path = Tk_NameToWindow(interp,
+	    Tcl_GetString(objv[1]), Tk_MainWindow(interp));
 
     if (path == NULL) {
 	return TCL_ERROR;
-- 
cgit v0.12


From f959b3aa341686dd18b2e81d19d8b0d13c308702 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Mon, 24 Jun 2019 08:02:39 +0000
Subject: Tk_DoOneEvent -> Tcl_DoOneEvent, since the Tk variant is deprecated.
 See: [505fe5a0e2]

---
 generic/tkGrab.c    | 2 +-
 macosx/tkMacOSXWm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 21c06a9..dc0e8fc 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -1382,7 +1382,7 @@ QueueGrabWindowChange(
 static int
 GrabWinEventProc(
     Tcl_Event *evPtr,		/* Event of type NewGrabWinEvent. */
-    int flags)			/* Flags argument to Tk_DoOneEvent: indicates
+    int flags)			/* Flags argument to Tcl_DoOneEvent: indicates
 				 * what kinds of events are being processed
 				 * right now. */
 {
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index e7bcbdf..c58dd5a 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1015,7 +1015,7 @@ TkWmDeadWindow(
 	 */
 
 	if (winPtr->parentPtr) {
-	    while (Tk_DoOneEvent(TK_WINDOW_EVENTS|TK_DONT_WAIT)) {}
+	    while (Tcl_DoOneEvent(TK_WINDOW_EVENTS|TK_DONT_WAIT)) {}
 	}
 	[NSApp _resetAutoreleasePool];
 #if DEBUG_ZOMBIES > 0
-- 
cgit v0.12


From a3129322d24fa7319ca3ad4ec44b37a5ab4f4ec0 Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Mon, 24 Jun 2019 18:52:29 +0000
Subject: Remove unnecessary call to NSUpdateDynamicServices() which can cause
 crashes.

---
 macosx/tkMacOSXServices.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index af40a91..6ecb12d 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -1,6 +1,6 @@
 /*
  * tkMacOSXServices.c --
- *
+ *\
  *	This file allows the integration of Tk and the Cocoa NSServices API.
  *
  * Copyright (c) 2010-2019 Kevin Walzer/WordTech Communications LLC.
@@ -54,7 +54,6 @@ ServicesEventProc(
     NSArray *sendTypes = [NSArray arrayWithObjects:@"NSStringPboardType",
 				  @"NSPasteboardTypeString", nil];
     [NSApp registerServicesMenuSendTypes:sendTypes returnTypes:sendTypes];
-    NSUpdateDynamicServices();
     return;
 }
 
-- 
cgit v0.12


From 343bf6c92b634857d5ae6a025f3d9e88077f5283 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Tue, 25 Jun 2019 15:25:54 +0000
Subject: Eliminate warning, when compiling with 9.0 Tcl headers on Windows

---
 win/tkWinWm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 69f5d7b..7fae383 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -4257,7 +4257,7 @@ WmIconnameCmd(
 	if (wmPtr->iconName != NULL) {
 	    ckfree(wmPtr->iconName);
 	}
-	argv3 = Tcl_GetStringFromObj(objv[3], &length);
+	argv3 = TkGetStringFromObj(objv[3], &length);
 	wmPtr->iconName = ckalloc(length + 1);
 	memcpy(wmPtr->iconName, argv3, length + 1);
 	if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
-- 
cgit v0.12


From fdf8a62f8c24e498f5444a5a110fb51c3b01b8c8 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Tue, 25 Jun 2019 21:27:04 +0000
Subject: CONST -> const.  Eliminate unnecessary type-casts and end-of-line
 spacing

---
 generic/tkCanvPs.c        |  2 +-
 generic/tkCanvas.c        |  4 ++--
 generic/tkPlace.c         |  2 +-
 generic/tkStyle.c         |  2 +-
 generic/tkText.c          |  2 +-
 generic/tkTextDisp.c      |  4 ++--
 generic/tkTextIndex.c     | 18 +++++++++---------
 generic/tkWindow.c        |  2 +-
 library/text.tcl          |  2 +-
 macosx/README             |  2 +-
 macosx/tkMacOSXHLEvents.c |  8 ++++----
 macosx/tkMacOSXInit.c     | 34 +++++++++++++++++-----------------
 macosx/tkMacOSXPrivate.h  |  2 +-
 macosx/tkMacOSXServices.c |  2 +-
 macosx/tkMacOSXTest.c     |  3 +--
 unix/tkUnix3d.c           |  2 +-
 unix/tkUnixColor.c        |  2 +-
 17 files changed, 46 insertions(+), 47 deletions(-)

diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 2bfdcc5..4e41a2a 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -381,7 +381,7 @@ TkCanvPostscriptCmd(
 	 */
 
 	psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode);
-	if (psInfo.chan == (Tcl_Channel) NULL) {
+	if (psInfo.chan == NULL) {
 	    result = TCL_ERROR;
 	    goto cleanup;
 	}
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 414c6fb..4d260dc 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -698,7 +698,7 @@ Tk_CanvasObjCmd(
     canvasPtr->textInfo.cursorOn = 0;
     canvasPtr->insertOnTime = 0;
     canvasPtr->insertOffTime = 0;
-    canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
+    canvasPtr->insertBlinkHandler = NULL;
     canvasPtr->xOrigin = canvasPtr->yOrigin = 0;
     canvasPtr->drawableXOrigin = canvasPtr->drawableYOrigin = 0;
     canvasPtr->bindingTable = NULL;
@@ -5307,7 +5307,7 @@ CanvasFocusProc(
     } else {
 	canvasPtr->textInfo.gotFocus = 0;
 	canvasPtr->textInfo.cursorOn = 0;
-	canvasPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
+	canvasPtr->insertBlinkHandler = NULL;
     }
     EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr);
     if (canvasPtr->highlightWidth > 0) {
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 7aa9b04..59b8a2b 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -616,7 +616,7 @@ ConfigureSlave(
     Tk_SavedOptions savedOptions;
     int mask;
     Slave *slavePtr;
-    Tk_Window masterWin = (Tk_Window) NULL;
+    Tk_Window masterWin = NULL;
     TkWindow *master;
 
     if (Tk_TopWinHierarchy(tkwin)) {
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index e7401df..d9299d1 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -1360,7 +1360,7 @@ Tk_GetStyle(
 		    "style \"%s\" doesn't exist", name));
 	    Tcl_SetErrorCode(interp, "TK", "LOOKUP", "STYLE", name, NULL);
 	}
-	return (Tk_Style) NULL;
+	return NULL;
     }
     stylePtr = Tcl_GetHashValue(entryPtr);
 
diff --git a/generic/tkText.c b/generic/tkText.c
index ab06089..7c62621 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -4927,7 +4927,7 @@ DumpLine(
 		TkTextEmbWindow *ewPtr = &segPtr->body.ew;
 		const char *pathname;
 
-		if (ewPtr->tkwin == (Tk_Window) NULL) {
+		if (ewPtr->tkwin == NULL) {
 		    pathname = "";
 		} else {
 		    pathname = Tk_PathName(ewPtr->tkwin);
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index fcefb9a..c848fd2 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -626,7 +626,7 @@ static void		AsyncUpdateLineMetrics(ClientData clientData);
 static void		GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync);
 static void		AsyncUpdateYScrollbar(ClientData clientData);
 static int              IsStartOfNotMergedLine(TkText *textPtr,
-                            CONST TkTextIndex *indexPtr);
+                            const TkTextIndex *indexPtr);
 
 /*
  * Result values returned by TextGetScrollInfoObj:
@@ -6988,7 +6988,7 @@ FindDLine(
 static int
 IsStartOfNotMergedLine(
       TkText *textPtr,              /* Widget record for text widget. */
-      CONST TkTextIndex *indexPtr)  /* Index to check. */
+      const TkTextIndex *indexPtr)  /* Index to check. */
 {
     TkTextIndex indexPtr2;
 
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 582e1a8..7430197 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -40,9 +40,9 @@ static const char *	StartEnd(TkText *textPtr, const char *string,
 static int		GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr,
 			    TkText *textPtr, const char *string,
 			    TkTextIndex *indexPtr, int *canCachePtr);
-static int              IndexCountBytesOrdered(CONST TkText *textPtr,
-                            CONST TkTextIndex *indexPtr1,
-                            CONST TkTextIndex *indexPtr2);
+static int              IndexCountBytesOrdered(const TkText *textPtr,
+                            const TkTextIndex *indexPtr1,
+                            const TkTextIndex *indexPtr2);
 
 /*
  * The "textindex" Tcl_Obj definition:
@@ -1636,9 +1636,9 @@ TkTextIndexForwChars(
 
 int
 TkTextIndexCountBytes(
-    CONST TkText *textPtr,
-    CONST TkTextIndex *indexPtr1, /* Index describing one location. */
-    CONST TkTextIndex *indexPtr2) /* Index describing second location. */
+    const TkText *textPtr,
+    const TkTextIndex *indexPtr1, /* Index describing one location. */
+    const TkTextIndex *indexPtr2) /* Index describing second location. */
 {
     int compare = TkTextIndexCmp(indexPtr1, indexPtr2);
 
@@ -1653,11 +1653,11 @@ TkTextIndexCountBytes(
 
 static int
 IndexCountBytesOrdered(
-    CONST TkText *textPtr,
-    CONST TkTextIndex *indexPtr1,
+    const TkText *textPtr,
+    const TkTextIndex *indexPtr1,
 				/* Index describing location of character from
 				 * which to count. */
-    CONST TkTextIndex *indexPtr2)
+    const TkTextIndex *indexPtr2)
 				/* Index describing location of last character
 				 * at which to stop the count. */
 {
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 917d3bd..ee8e1a9 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -852,7 +852,7 @@ TkCreateMainWindow(
      * Create the basic TkWindow structure.
      */
 
-    tkwin = CreateTopLevelWindow(interp, (Tk_Window) NULL, baseName,
+    tkwin = CreateTopLevelWindow(interp, NULL, baseName,
 	    screenName, /* flags */ 0);
     if (tkwin == NULL) {
 	return NULL;
diff --git a/library/text.tcl b/library/text.tcl
index d53aa32..7d12e18 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -1212,6 +1212,6 @@ proc ::tk::TextScanDrag {w x y} {
     }
     if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} {
 	$w scan dragto $x $y
-    }  
+    }
 }
 
diff --git a/macosx/README b/macosx/README
index f35c128..7df4893 100644
--- a/macosx/README
+++ b/macosx/README
@@ -702,7 +702,7 @@ that LaunchServices is launching the correct Wish.app.  Instructions
 for doing this are provided below.
 
 The command line tool which manages the LaunchServices database has
-an amazingly unwieldy path name.  So, first, run this command: 
+an amazingly unwieldy path name.  So, first, run this command:
 
 alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister'
 
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index d2843a8..0f63ea6 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -126,7 +126,7 @@ static int  ReallyKillMe(Tcl_Event *eventPtr, int flags);
 - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event
     withReplyEvent: (NSAppleEventDescriptor *)replyEvent
 {
-    
+
     NSString* file = [[event paramDescriptorForKeyword:keyDirectObject]
 			 stringValue];
     const char *printFile=[file UTF8String];
@@ -134,7 +134,7 @@ static int  ReallyKillMe(Tcl_Event *eventPtr, int flags);
     Tcl_DStringInit(&print);
     if (Tcl_FindCommand(_eventInterp, "::tk::mac::PrintDocument", NULL, 0)) {
 	Tcl_DStringAppend(&print, "::tk::mac::PrintDocument", -1);
-    } 
+    }
     Tcl_DStringAppendElement(&print, printFile);
     int  tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&print),
 			     Tcl_DStringLength(&print), TCL_EVAL_GLOBAL);
@@ -272,7 +272,7 @@ static int  ReallyKillMe(Tcl_Event *eventPtr, int flags);
     Tcl_DStringInit(&launch);
     if (Tcl_FindCommand(_eventInterp, "::tk::mac::LaunchURL", NULL, 0)) {
 	Tcl_DStringAppend(&launch, "::tk::mac::LaunchURL", -1);
-    } 
+    }
     Tcl_DStringAppendElement(&launch, cURL);
     int  tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&launch),
 			     Tcl_DStringLength(&launch), TCL_EVAL_GLOBAL);
@@ -454,7 +454,7 @@ TkMacOSXInitAppleEvents(
 	[aeManager setEventHandler:NSApp
 	    andSelector:@selector(handleURLEvent:withReplyEvent:)
 	    forEventClass:kInternetEventClass andEventID:kAEGetURL];
-	
+
     }
 }
 
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 3efe0c6..bf0b9f2 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -388,14 +388,14 @@ TkpInit(
 	    TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL);
     Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap",
 	    TkMacOSXIconBitmapObjCmd, NULL, NULL);
-    Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath,(ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
+    Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPath, NULL, NULL);
 
     /*
      * Initialize the NSServices object here. Apple's docs say to do this
-     * in applicationDidFinishLaunching, but the Tcl interpreter is not 
-     * initialized until this function call. 
+     * in applicationDidFinishLaunching, but the Tcl interpreter is not
+     * initialized until this function call.
      */
-    
+
     TkMacOSXServices_Init(interp);
 
     return TCL_OK;
@@ -457,28 +457,28 @@ int TkMacOSXGetAppPath(
 		       ClientData cd,
 		       Tcl_Interp *ip,
 		       int objc,
-		       Tcl_Obj *CONST objv[])
+		       Tcl_Obj *const objv[])
 {
 
   CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle());
 
-  
-  /* 
-   * Convert the URL reference into a string reference. 
+
+  /*
+   * Convert the URL reference into a string reference.
    */
-  
+
   CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle);
- 
-  /* 
-   * Get the system encoding method. 
+
+  /*
+   * Get the system encoding method.
    */
-  
+
   CFStringEncoding encodingMethod = CFStringGetSystemEncoding();
- 
-  /* 
-   * Convert the string reference into a C string. 
+
+  /*
+   * Convert the string reference into a C string.
    */
-  
+
   char *path = (char *) CFStringGetCStringPtr(appPath, encodingMethod);
 
   Tcl_SetResult(ip, path, NULL);
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index a67f894..98ee54f 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -431,7 +431,7 @@ VISIBILITY_HIDDEN
 
 #endif /* _TKMACPRIV */
 
-int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *CONST objv[]);
+int TkMacOSXGetAppPath(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]);
 
 /*
  * Local Variables:
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 6ecb12d..809c708 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -158,7 +158,7 @@ TkMacOSXRegisterServiceWidgetObjCmd(
     ClientData cd,
     Tcl_Interp *ip,
     int objc,
-    Tcl_Obj *CONST objv[])
+    Tcl_Obj *const objv[])
 {
     /*
      * Need proper number of args.
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index eabc14e..f109b7a 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -50,8 +50,7 @@ TkplatformtestInit(
      */
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1080
-    Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd,
-	    (ClientData) 0, (Tcl_CmdDeleteProc *) NULL);
+    Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd, NULL, NULL);
 #endif
 
     return TCL_OK;
diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c
index 2969de1..7ea67a1 100644
--- a/unix/tkUnix3d.c
+++ b/unix/tkUnix3d.c
@@ -443,7 +443,7 @@ TkpGetShadows(
     }
 
     if (borderPtr->shadow == None) {
-	borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin,
+	borderPtr->shadow = Tk_GetBitmap(NULL, tkwin,
 		Tk_GetUid("gray50"));
 	if (borderPtr->shadow == None) {
 	    Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border");
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index 43500ad..ccc6f33 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -157,7 +157,7 @@ TkpGetColor(
 	}
 	if (strlen(name) > 99) {
 	/* Don't bother to parse this. [Bug 2809525]*/
-	return (TkColor *) NULL;
+	return NULL;
     } else if (XAllocNamedColor(display, colormap, name, &screen, &color) != 0) {
 	    DeleteStressedCmap(display, colormap);
 	} else {
-- 
cgit v0.12


From 3efbb66596ac4683c9f362a19e3e6c4bf979d2b5 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Wed, 26 Jun 2019 07:34:12 +0000
Subject: Remove use of/documentation regarding deprecated symbols/macro's,
 which moved to Tcl headers long ago.

---
 doc/CrtCmHdlr.3              | 2 +-
 doc/CrtGenHdlr.3             | 2 +-
 doc/EventHndlr.3             | 2 +-
 doc/MoveToplev.3             | 2 +-
 doc/RestrictEv.3             | 6 +++---
 generic/tkGrab.c             | 2 +-
 macosx/tkMacOSXWindowEvent.c | 4 ++--
 tests/bind.test              | 4 ++--
 8 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/doc/CrtCmHdlr.3 b/doc/CrtCmHdlr.3
index 54cee95..92d6865 100644
--- a/doc/CrtCmHdlr.3
+++ b/doc/CrtCmHdlr.3
@@ -33,7 +33,7 @@ drop applications.
 The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
 this mechanism only works in programs that dispatch events
 through \fBTk_HandleEvent\fR (or through other Tk procedures that
-call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
+call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
 \fBTk_MainLoop\fR).
 .PP
 \fIProc\fR should have arguments and result that match the
diff --git a/doc/CrtGenHdlr.3 b/doc/CrtGenHdlr.3
index 1e4f10c..bcf324e 100644
--- a/doc/CrtGenHdlr.3
+++ b/doc/CrtGenHdlr.3
@@ -39,7 +39,7 @@ use with Tk, and so on.
 The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
 this mechanism only works in programs that dispatch events
 through \fBTk_HandleEvent\fR (or through other Tk procedures that
-call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
+call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
 \fBTk_MainLoop\fR).
 .PP
 \fIProc\fR should have arguments and result that match the
diff --git a/doc/EventHndlr.3 b/doc/EventHndlr.3
index 80003d8..3a402e8 100644
--- a/doc/EventHndlr.3
+++ b/doc/EventHndlr.3
@@ -39,7 +39,7 @@ by \fImask\fR occurs in the window specified by \fItkwin\fR.
 The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR;
 this mechanism only works in programs that dispatch events
 through \fBTk_HandleEvent\fR (or through other Tk procedures that
-call \fBTk_HandleEvent\fR, such as \fBTk_DoOneEvent\fR or
+call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or
 \fBTk_MainLoop\fR).
 .PP
 \fIProc\fR should have arguments and result that match the
diff --git a/doc/MoveToplev.3 b/doc/MoveToplev.3
index 18436a3..12f353b 100644
--- a/doc/MoveToplev.3
+++ b/doc/MoveToplev.3
@@ -47,7 +47,7 @@ menus that want to appear at a particular place on the screen.
 When \fBTk_MoveToplevelWindow\fR is called it does not immediately
 pass on the new desired location to the window manager;  it defers
 this action until all other outstanding work has been completed,
-using the \fBTk_DoWhenIdle\fR mechanism.
+using the \fBTcl_DoWhenIdle\fR mechanism.
 
 .SH KEYWORDS
 position, top-level window, window manager
diff --git a/doc/RestrictEv.3 b/doc/RestrictEv.3
index 0d17806..b5cc907 100644
--- a/doc/RestrictEv.3
+++ b/doc/RestrictEv.3
@@ -31,7 +31,7 @@ Pointer to place to save argument to previous restrict procedure.
 .PP
 This procedure is useful in certain situations where applications
 are only prepared to receive certain X events.  After
-\fBTk_RestrictEvents\fR is called, \fBTk_DoOneEvent\fR (and
+\fBTk_RestrictEvents\fR is called, \fBTcl_DoOneEvent\fR (and
 hence \fBTk_MainLoop\fR) will filter X input events through
 \fIproc\fR.  \fIProc\fR indicates whether a
 given event is to be processed immediately, deferred until some
@@ -49,7 +49,7 @@ to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with
 information it needs to filter events.  The \fIeventPtr\fR points to
 an event under consideration.  \fIProc\fR returns a restrict action
 (enumerated type \fBTk_RestrictAction\fR) that indicates what
-\fBTk_DoOneEvent\fR should do with the event.  If the return value is
+\fBTcl_DoOneEvent\fR should do with the event.  If the return value is
 \fBTK_PROCESS_EVENT\fR, then the event will be handled immediately.
 If the return value is \fBTK_DEFER_EVENT\fR, then the event will be
 left on the event queue for later processing.  If the return value is
@@ -75,6 +75,6 @@ solution in these situations is to call \fBXNextEvent\fR or
 \fBXWindowEvent\fR, but these procedures cannot be used because
 Tk keeps its own event queue that is separate from the X event
 queue.  Instead, call \fBTk_RestrictEvents\fR to set up a filter,
-then call \fBTk_DoOneEvent\fR to retrieve the desired event(s).
+then call \fBTcl_DoOneEvent\fR to retrieve the desired event(s).
 .SH KEYWORDS
 delay, event, filter, restriction
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 44a4f8c..04a1d84 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -1369,7 +1369,7 @@ QueueGrabWindowChange(
 static int
 GrabWinEventProc(
     Tcl_Event *evPtr,		/* Event of type NewGrabWinEvent. */
-    int flags)			/* Flags argument to Tk_DoOneEvent: indicates
+    int flags)			/* Flags argument to Tcl_DoOneEvent: indicates
 				 * what kinds of events are being processed
 				 * right now. */
 {
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 75949ba..6d7649c 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -877,7 +877,7 @@ ConfigureRestrictProc(
 	TkGenWMConfigureEvent(tkwin, Tk_X(tkwin), Tk_Y(tkwin), width, height,
 			      TK_SIZE_CHANGED | TK_MACOSX_HANDLE_EVENT_IMMEDIATELY);
     	oldProc = Tk_RestrictEvents(ConfigureRestrictProc, NULL, &oldArg);
-	while (Tk_DoOneEvent(TK_X_EVENTS|TK_DONT_WAIT)) {}
+	while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
     	Tk_RestrictEvents(oldProc, oldArg, &oldArg);
 
 	/* Now that Tk has configured all subwindows we can create the clip regions. */
@@ -889,7 +889,7 @@ ConfigureRestrictProc(
 	HIRect bounds = NSRectToCGRect([self bounds]);
 	HIShapeRef shape = HIShapeCreateWithRect(&bounds);
 	[self generateExposeEvents: shape];
-	while (Tk_DoOneEvent(TK_ALL_EVENTS|TK_DONT_WAIT)) {}
+	while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT)) {}
 	[w enableFlushWindow];
 	[w flushWindowIfNeeded];
 	NSEnableScreenUpdates();
diff --git a/tests/bind.test b/tests/bind.test
index 3abb615..96449d1 100644
--- a/tests/bind.test
+++ b/tests/bind.test
@@ -2682,7 +2682,7 @@ proc bgerror msg {
     global x errorInfo
     set x [list $msg $errorInfo]
 }
-test bind-30.1 {Tk_BackgroundError procedure} {
+test bind-30.1 {Tcl_BackgroundError procedure} {
     setup
     bind .b.f <Button> {error "This is a test"}
     set x none
@@ -2694,7 +2694,7 @@ test bind-30.1 {Tk_BackgroundError procedure} {
     while executing
 "error "This is a test""
     (command bound to event)}}
-test bind-30.2 {Tk_BackgroundError procedure} {
+test bind-30.2 {Tcl_BackgroundError procedure} {
     proc do {} {
 	event gen .b.f <Button>
 	event gen .b.f <ButtonRelease>
-- 
cgit v0.12


From fde1c03942e4b7b565abc9532cf439bbe42643f7 Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Wed, 26 Jun 2019 18:59:19 +0000
Subject: Fix bug [8476b75781]: Aqua scrollbar behavior

---
 macosx/ttkMacOSXTheme.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index c33e8c9..05a5539 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -2346,11 +2346,7 @@ static void ThumbElementSize(
     int orientation = TTK_ORIENT_HORIZONTAL;
 
     Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
-    if (orientation == TTK_ORIENT_HORIZONTAL) {
-	*minHeight = 8;
-    } else {
-	*minWidth = 8;
-    }
+    *minHeight = *minWidth = 8;
 }
 
 static void ThumbElementDraw(
-- 
cgit v0.12


From 0369d980d85531d5bb56e84ee83dce6eaff0b580 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Wed, 26 Jun 2019 20:03:11 +0000
Subject: fix indenting

---
 tests/menu.test | 532 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 266 insertions(+), 266 deletions(-)

diff --git a/tests/menu.test b/tests/menu.test
index e428e5e..4fde53e 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -29,7 +29,7 @@ test menu-1.4 {Tk_MenuCmd procedure} -body {
     destroy .m1
     menu .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m1}
 test menu-1.5 {Tk_MenuCmd - creating menubar} -setup {
     destroy .m1
@@ -38,19 +38,19 @@ test menu-1.5 {Tk_MenuCmd - creating menubar} -setup {
     .m1 add cascade -label Test -menu ""
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-1.6 {Tk_MenuCmd procedure menu ref no cascade} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
     menu .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m1}
 test menu-1.7 {Tk_MenuCmd procedure one clone cascade} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
@@ -58,10 +58,10 @@ test menu-1.7 {Tk_MenuCmd procedure one clone cascade} -setup {
     .m1 add cascade -menu .m2
     menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m2}
 test menu-1.8 {Tk_MenuCmd procedure two clone cascades} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m2
@@ -71,10 +71,10 @@ test menu-1.8 {Tk_MenuCmd procedure two clone cascades} -setup {
     wm geometry .t3 +0+0
     menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m2}
 test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
@@ -84,10 +84,10 @@ test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} -setup {
     wm geometry .t3 +0+0
     list [menu .m2]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m2}
 test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
@@ -97,10 +97,10 @@ test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} -setup {
     .m1 add cascade -menu .m2
     list [menu .m2]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m2}
 test menu-1.11 {Tk_MenuCmd procedure three clones cascades} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
@@ -112,19 +112,19 @@ test menu-1.11 {Tk_MenuCmd procedure three clones cascades} -setup {
     .m1 add cascade -menu .m2
     list [menu .m2]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m2}
 test menu-1.12 {Tk_MenuCmd procedure} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
     list [menu .m1]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m1}
 test menu-1.13 {Tk_MenuCmd procedure} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
@@ -132,10 +132,10 @@ test menu-1.13 {Tk_MenuCmd procedure} -setup {
     wm geometry .t3 +0+0
     list [menu .m1]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m1}
 test menu-1.14 {Tk_MenuCmd procedure} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .t2 -menu .m1
     wm geometry .t2 +0+0
@@ -145,7 +145,7 @@ test menu-1.14 {Tk_MenuCmd procedure} -setup {
     wm geometry .t4 +0+0
     list [menu .m1]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m1}
 
 # Used for 2.1 - 2.30 tests
@@ -1821,7 +1821,7 @@ test menu-3.67 {MenuWidgetCmd procedure, bad option} -setup {
 	destroy .m1
 } -returnCodes error -result {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition}
 test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     set t .t
     set m1 .t.m1
@@ -1839,7 +1839,7 @@ test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup {
     $t configure -menu ""
     list [winfo exists $c1] [winfo exists $c2]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {1 1}
 test menu-3.69 {MenuWidgetCmd procedure, "xposition" option} -setup {
     destroy .m1
@@ -1877,7 +1877,7 @@ test menu-4.2 {TkInvokeMenu: tearoff} -setup {
     menu .m1
 	catch {.m1 invoke 0}
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0}
 test menu-4.3 {TkInvokeMenu: checkbutton -on} -setup {
     destroy .m1
@@ -2034,7 +2034,7 @@ test menu-5.5 {DestroyMenuInstance - cascades of cloned menus} -setup {
     list [destroy .m2] [.m1 entrycget 1 -menu] [. configure -menu ""] [destroy .m1]
 } -returnCodes ok -result {{} .m2 {} {}}
 test menu-5.6 {DestroyMenuInstance - cascades of cloned menus} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m2
@@ -2130,7 +2130,7 @@ test menu-6.4 {TkDestroyMenu - reentrancy - clones} -setup {
     .m1 clone .m1.m3
     destroy .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -returnCodes ok
 test menu-6.5 {TkDestroyMenu} -setup {
     destroy .m1 .m2
@@ -2271,7 +2271,7 @@ test menu-7.4 {UnhookCascadeEntry} -setup {
     list [destroy .m1] [destroy .m2]
 } -returnCodes ok -result {{} {}}
 test menu-7.5 {UnhookCascadeEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -2282,7 +2282,7 @@ test menu-7.5 {UnhookCascadeEntry} -setup {
     list [destroy .m1] [destroy .m2 .m3]
 } -returnCodes ok -result {{} {}}
 test menu-7.6 {UnhookCascadeEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -2293,7 +2293,7 @@ test menu-7.6 {UnhookCascadeEntry} -setup {
     list [destroy .m2] [destroy .m1 .m3]
 } -returnCodes ok -result {{} {}}
 test menu-7.7 {UnhookCascadeEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -2304,7 +2304,7 @@ test menu-7.7 {UnhookCascadeEntry} -setup {
     list [destroy .m3] [destroy .m1 .m2]
 } -returnCodes ok -result {{} {}}
 test menu-7.8 {UnhookCascadeEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -2375,7 +2375,7 @@ test menu-8.6 {DestroyMenuEntry} -setup {
     list [.m1 delete 1] [.m1 entrycget 1 -label] [destroy .m1]
 } -result {{} two {}}
 test menu-8.7 {DestroyMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "one"
@@ -2392,7 +2392,7 @@ test menu-9.1 {ConfigureMenu} -setup {
     menu .m1
     list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} beep}
 test menu-9.2 {ConfigureMenu}  -setup {
     destroy .m1
@@ -2401,7 +2401,7 @@ test menu-9.2 {ConfigureMenu}  -setup {
     .m1 add command -label "test"
     list [.m1 configure -tearoff 0] [.m1 entrycget 1 -label]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test}
 test menu-9.3 {ConfigureMenu}  -setup {
     destroy .m1
@@ -2409,7 +2409,7 @@ test menu-9.3 {ConfigureMenu}  -setup {
     menu .m1
     list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} beep}
 test menu-9.4 {ConfigureMenu}  -setup {
     destroy .m1
@@ -2418,7 +2418,7 @@ test menu-9.4 {ConfigureMenu}  -setup {
     .m1 add command -label "test"
     .m1 configure -fg red
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-9.5 {ConfigureMenu}  -setup {
     destroy .m1
@@ -2428,7 +2428,7 @@ test menu-9.5 {ConfigureMenu}  -setup {
     .m1 add command -label "two"
     .m1 configure -fg red
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-9.6 {ConfigureMenu}  -setup {
     destroy .m1
@@ -2439,25 +2439,25 @@ test menu-9.6 {ConfigureMenu}  -setup {
     .m1 add command -label "three"
     .m1 configure -fg red
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-9.7 {ConfigureMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2 tearoff
     list [.m1 configure -fg red] [.m2 cget -fg]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} red}
 test menu-9.8 {ConfigureMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2 tearoff
     list [.m2 configure -fg red] [.m1 cget -fg]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} red}
 test menu-9.9 {ConfigureMenu}  -setup {
     destroy .m1
@@ -2465,7 +2465,7 @@ test menu-9.9 {ConfigureMenu}  -setup {
     menu .m1
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 
 
@@ -2478,7 +2478,7 @@ test menu-10.1 {PostProcessEntry: array variable} -setup {
     .m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
     set foo(1)
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {on}
 test menu-10.2 {PostProcessEntry: array variable} -setup {
     destroy .m1
@@ -2488,7 +2488,7 @@ test menu-10.2 {PostProcessEntry: array variable} -setup {
     .m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
     set foo(1)
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {off}
 
 
@@ -2500,7 +2500,7 @@ test menu-11.1 {ConfigureMenuEntry} -setup {
     .m1 add checkbutton -variable foo -onvalue on -offvalue off -label "Nonsense"
     list [.m1 entryconfigure 1 -variable bar] [.m1 entrycget 1 -variable]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} bar}
 test menu-11.2 {ConfigureMenuEntry} -setup {
     destroy .m1
@@ -2509,7 +2509,7 @@ test menu-11.2 {ConfigureMenuEntry} -setup {
     .m1 add command -label "test"
     list [.m1 entryconfigure 1 -label ""] [.m1 entrycget 1 -label]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-11.3 {ConfigureMenuEntry} -setup {
     destroy .m1
@@ -2518,83 +2518,83 @@ test menu-11.3 {ConfigureMenuEntry} -setup {
     .m1 add command
     list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test}
 test menu-11.4 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command
     list [.m1 entryconfigure 1 -accel "S"] [.m1 entrycget 1 -accel]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} S}
 test menu-11.5 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command
     list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test}
 test menu-11.6 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command
     .m1 entryconfigure 1 -label "test"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.7 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m2
     menu .m1
     .m1 add cascade
     .m1 entryconfigure 1 -label "test" -menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.8 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade
     .m1 entryconfigure 1 -label "test" -menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.9 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m3
     .m1 entryconfigure 1 -label "test" -menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.10 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade
     .m1 entryconfigure 1 -label "test" -menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.11 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m2
     .m1 entryconfigure 1 -label "test" -menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.12 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -2607,10 +2607,10 @@ test menu-11.12 {ConfigureMenuEntry} -setup {
     .m5 add cascade
     .m5 entryconfigure 1 -label "test" -menu .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.13 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -2621,32 +2621,32 @@ test menu-11.13 {ConfigureMenuEntry} -setup {
     .m4 add cascade -menu .m1
     .m3 entryconfigure 1 -label "test" -menu .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.14 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add checkbutton
     list [.m1 entryconfigure 1 -variable "test"] [.m1 entrycget 1 -variable]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test}
 test menu-11.15 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     list [.m1 add checkbutton -label "test"] [.m1 entrycget 1 -variable]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test}
 test menu-11.16 {ConfigureMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add radiobutton -label "test"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-11.17 {ConfigureMenuEntry} -setup {
     deleteWindows
@@ -2852,35 +2852,35 @@ test menu-13.8 {TkGetMenuIndex} -setup {
     .m1 entrycget -1 -label
 } -returnCodes error -result {bad menu entry index "-1"}
 test menu-13.9 {TkGetMenuIndex} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 add command -label "test2"
     .m1 entrycget 999 -label
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {test2}
 test menu-13.10 {TkGetMenuIndex} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 insert 999 command -label "test"
     .m1 entrycget 1 -label
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {test}
 test menu-13.11 {TkGetMenuIndex} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "1test"
     .m1 entrycget 1test -label
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {1test}
 test menu-13.12 {TkGetMenuIndex} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
@@ -2888,176 +2888,176 @@ test menu-13.12 {TkGetMenuIndex} -setup {
     .m1 add command -label "test3"
     .m1 entrycget test2 -command
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {beep}
 
 test menu-14.1 {MenuCmdDeletedProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     destroy .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -returnCodes ok
 test menu-14.2 {MenuCmdDeletedProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2
     destroy .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -returnCodes ok
 
 test menu-15.1 {MenuNewEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-15.2 {MenuNewEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 add command -label "test3"
     .m1 insert 2 command -label "test2"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-15.3 {MenuNewEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 add command -label "test2"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-15.4 {MenuNewEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 
 test menu-16.1 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 insert foo command -label "test"
 } -returnCodes error -result {bad menu entry index "foo"}
 test menu-16.2 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 insert test command -label "foo"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.3 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 insert -1 command -label "test"
 } -returnCodes error -result {bad menu entry index "-1"}
 test menu-16.4 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1 -tearoff 1
     .m1 add command -label "test"
     .m1 insert 0 command -label "test2"
     .m1 entrycget 1 -label
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {test2}
 test menu-16.5 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.6 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add checkbutton
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.7 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.8 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add radiobutton
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.9 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add separator
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.10 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add blork
 } -returnCodes error -result {bad menu entry type "blork": must be cascade, checkbutton, command, radiobutton, or separator}
 test menu-16.11 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-16.12 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2
     .m2 clone .m3
     list [.m2 add command -label "test"] [.m1 entrycget 1 -label] [.m3 entrycget 1 -label]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test test}
 test menu-16.13 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2
     .m2 clone .m3
     list [.m3 add command -label "test"] [.m1 entrycget 1 -label] [.m2 entrycget 1 -label]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} test test}
 test menu-16.14 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -blork
 } -returnCodes error -result {unknown option "-blork"}
 test menu-16.15 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "File"
@@ -3065,20 +3065,20 @@ test menu-16.15 {MenuAddOrInsert} -setup {
     . configure -menu .container
     list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-16.16 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
     set tearoff [tk::TearOffMenu .m2]
     list [.m2 add cascade -menu .m1] [$tearoff unpost]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-16.17 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .container
@@ -3086,10 +3086,10 @@ test menu-16.17 {MenuAddOrInsert} -setup {
     set tearoff [tk::TearOffMenu .container]
     list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-16.18 {MenuAddOrInsert} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .container
@@ -3097,10 +3097,10 @@ test menu-16.18 {MenuAddOrInsert} -setup {
     . configure -menu .container
     list [.container add cascade -label "File" -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .menubar
     menu .menubar.test -tearoff 0
@@ -3113,12 +3113,12 @@ test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup {
 		[info commands .\#menubar.\#menubar\#test.\#menubar\#test\#cascade] \
 		[. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0 .#menubar.#menubar#test.#menubar#test#cascade {}}
 
 
 test menu-17.1 {MenuVarProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     catch {unset foo}
     menu .m1
@@ -3126,21 +3126,21 @@ test menu-17.1 {MenuVarProc} -setup {
     list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
 		[unset foo]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 # menu-17.2 - Don't know how to generate the flags in the if
 test menu-17.2 {MenuVarProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     catch {unset foo}
     menu .m1
     list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
 		[set foo ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-17.3 {MenuVarProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     catch {unset foo}
     menu .m1
@@ -3148,30 +3148,30 @@ test menu-17.3 {MenuVarProc} -setup {
     list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
 		[set foo "hello"] [unset foo]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} hello {}}
 test menu-17.4 {MenuVarProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     set foo "goodbye"
     list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
 		[set foo "hello"] [unset foo]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} hello {}}
 test menu-17.5 {MenuVarProc} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     set foo "hello"
     list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \
 		[set foo "goodbye"] [unset foo]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} goodbye {}}
 test menu-17.6 {MenuVarProc [5d991b822e]} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     # Want this not to crash
     menu .b
@@ -3182,10 +3182,10 @@ test menu-17.6 {MenuVarProc [5d991b822e]} -setup {
     }}}
     unset var
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-17.7 {MenuVarProc [5d991b822e]} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     # Want this not to duplicate traces
     menu .b
@@ -3196,30 +3196,30 @@ test menu-17.7 {MenuVarProc [5d991b822e]} -setup {
     }}}
     unset var
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 
 
 test menu-18.1 {TkActivateMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 activate 1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-18.2 {TkActivateMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 activate 0
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-18.3 {TkActivateMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
@@ -3227,10 +3227,10 @@ test menu-18.3 {TkActivateMenuEntry} -setup {
     .m1 activate 1
     .m1 activate 2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-18.4 {TkActivateMenuEntry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
@@ -3238,112 +3238,112 @@ test menu-18.4 {TkActivateMenuEntry} -setup {
     .m1 activate 1
     .m1 activate 1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 
 
 test menu-19.1 {TkPostCommand} -constraints nonUnixUserInteraction -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1 -postcommand "set menu_test menu-19.1"
     .m1 add command -label "menu-19.1 - hit Escape"
     list [.m1 post 40 40] [.m1 unpost] [set menu_test]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {menu-19.1 {} menu-19.1}
 test menu-19.2 {TkPostCommand} -constraints nonUnixUserInteraction -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "menu-19.2 - hit Escape"
     list [.m1 post 40 40] [.m1 unpost]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 
 test menu-20.1 {CloneMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.2 {CloneMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2 normal
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.3 {CloneMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2 tearoff
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.4 {CloneMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2 menubar
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.5 {CloneMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2 foo
 } -returnCodes error -result {bad menu type "foo": must be normal, tearoff, or menubar}
 test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 clone .m2
     .m1 clone .m3
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.8 {CloneMenu - cascade entries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m2
     .m1 clone .foo
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.9 {CloneMenu - cascades entries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m2
     menu .m2
     .m1 clone .foo
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-20.10 {CloneMenu - tearoff fields} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1 -tearoff 1
     list [.m1 clone .m2 normal] [.m2 cget -tearoff]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} 1}
 test menu-20.11 {CloneMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m2
@@ -3351,43 +3351,43 @@ test menu-20.11 {CloneMenu} -setup {
 } -returnCodes error -result {window name "m2" already exists in parent}
 
 test menu-21.1 {MenuDoYPosition} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 yposition glorp
 } -returnCodes error -result {bad menu entry index "glorp"}
 test menu-21.2 {MenuDoYPosition} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "Test"
     .m1 yposition 1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -returnCodes ok -match glob -result {*}
 
 test menu-22.1 {GetIndexFromCoords} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 configure -tearoff 0
     .m1 index @5
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0}
 test menu-22.2 {GetIndexFromCoords} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label "test"
     .m1 configure -tearoff 0
     .m1 index @5,5
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0}
 test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
-	deleteWindows
+    deleteWindows
 } -constraints {x11} -body {
     menu .m1
     .m1 add command -label "test"
@@ -3396,10 +3396,10 @@ test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup {
     tkwait visibility .m1
     .m1 index @5
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0}
 test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
-	deleteWindows
+    deleteWindows
 } -constraints {x11} -body {
     menu .m1
     .m1 add command -label "test"
@@ -3410,10 +3410,10 @@ test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup {
     set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
     .m1 index @$x,5
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0}
 test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
-	deleteWindows
+    deleteWindows
 } -constraints {x11} -body {
     menu .m1
     .m1 add command -label "test"
@@ -3425,20 +3425,20 @@ test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup {
     set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}]
     .m1 index @$x,5
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0}
 
 test menu-23.1 {RecursivelyDeleteMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     . configure -menu .m1
     . configure -menu ""
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-23.2 {RecursivelyDeleteMenu} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m2
     .m2 add command -label "test2"
@@ -3447,28 +3447,28 @@ test menu-23.2 {RecursivelyDeleteMenu} -setup {
     . configure -menu .m1
     . configure -menu ""
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 
 test menu-24.1 {TkNewMenuName} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-24.2 {TkNewMenuName} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     menu .m1\#0
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-24.3 {TkNewMenuName} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .#m
     rename .#m hideme
@@ -3478,33 +3478,33 @@ test menu-24.3 {TkNewMenuName} -setup {
 
 
 test menu-25.1 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.2 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.3 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     destroy .m1
     menu .m1
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.4 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3512,10 +3512,10 @@ test menu-25.4 {TkSetWindowMenuBar} -setup {
     menu .m2
     list [. configure -menu .m2] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.5 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3524,10 +3524,10 @@ test menu-25.5 {TkSetWindowMenuBar} -setup {
     menu .m3
     list [. configure -menu .m3] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.6 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3536,10 +3536,10 @@ test menu-25.6 {TkSetWindowMenuBar} -setup {
     menu .m3
     list [. configure -menu .m3] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.7 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3549,10 +3549,10 @@ test menu-25.7 {TkSetWindowMenuBar} -setup {
     .t2 configure -menu .m1
     list [.t2 configure -menu .m2] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.8 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3563,10 +3563,10 @@ test menu-25.8 {TkSetWindowMenuBar} -setup {
     .t2 configure -menu .m1
     list [. configure -menu .m2] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.9 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3578,10 +3578,10 @@ test menu-25.9 {TkSetWindowMenuBar} -setup {
     wm geometry .t3 +0+0
     list [.t3 configure -menu .m2] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.10 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3593,10 +3593,10 @@ test menu-25.10 {TkSetWindowMenuBar} -setup {
     wm geometry .t3 +0+0
     list [.t2 configure -menu .m2] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.11 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3608,57 +3608,57 @@ test menu-25.11 {TkSetWindowMenuBar} -setup {
     wm geometry .t3 +0+0
     list [. configure -menu .m2] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.12 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.13 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.14 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.15 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 test menu-25.16 {TkSetWindowMenuBar} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
     . configure -menu .m1
     list [toplevel .t2 -menu m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.t2 {}}
 
 
 test menu-26.1 {DestroyMenuHashTable} -setup {
     catch {interp delete testinterp}
-	deleteWindows
+    deleteWindows
 } -body {
     interp create testinterp
     load {} Tk testinterp
@@ -3669,48 +3669,48 @@ test menu-26.1 {DestroyMenuHashTable} -setup {
 
 test menu-27.1 {GetMenuHashTable} -setup {
     catch {interp delete testinterp}
-	deleteWindows
+    deleteWindows
 } -body {
     interp create testinterp
     load {} Tk testinterp
     list [catch {interp eval testinterp {menu .m1}} msg] $msg [interp delete testinterp]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {0 .m1 {}}
 
 
 test menu-28.1 {TkCreateMenuReferences - not there before} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m1}
 test menu-28.2 {TkCreateMenuReferences - there already} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m2
     menu .m2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.m2}
 
 
 test menu-29.1 {TkFindMenuReferences - not there} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
     .m1 add cascade -menu .m2
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 
 
 test menu-30.1 {TkFindMenuReferences - there already} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
@@ -3718,38 +3718,38 @@ test menu-30.1 {TkFindMenuReferences - there already} -setup {
     .m1 add cascade -menu .m2
     list [. configure -menu .m1] [. configure -menu ""]
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {{} {}}
 
 
 test menu-31.1 {TkFreeMenuReferences - menuPtr} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     destroy .m1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-31.2 {TkFreeMenuReferences - cascadePtr} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu ""
     menu .m1
     .m1 add cascade -menu .m2
     .m1 entryconfigure 1 -menu .m3
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-31.3 {TkFreeMenuReferences - topLevelListPtr} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     . configure -menu .m1
     . configure -menu ""
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -returnCodes ok -result {}
 test menu-31.4 {TkFreeMenuReferences - not empty} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add cascade -menu .m3
@@ -3757,22 +3757,22 @@ test menu-31.4 {TkFreeMenuReferences - not empty} -setup {
     .m2 add cascade -menu .m3
     .m2 entryconfigure 1 -menu ".foo"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 
 
 test menu-32.1 {DeleteMenuCloneEntries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label foo
     .m1 clone .m2
     .m1 delete 1
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.2 {DeleteMenuCloneEntries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
 
     menu .m1
@@ -3783,10 +3783,10 @@ test menu-32.2 {DeleteMenuCloneEntries} -setup {
     .m1 clone .m2
     .m1 delete 2 3
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.3 {DeleteMenuCloneEntries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1 -tearoff 0
     .m1 add command -label one
@@ -3797,10 +3797,10 @@ test menu-32.3 {DeleteMenuCloneEntries} -setup {
     .m2 configure -tearoff 1
     .m1 delete 1 2
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.4 {DeleteMenuCloneEntries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label one
@@ -3811,10 +3811,10 @@ test menu-32.4 {DeleteMenuCloneEntries} -setup {
     .m2 configure -tearoff 0
     .m1 delete 2 3
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.5 {DeleteMenuCloneEntries} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label one
@@ -3823,29 +3823,29 @@ test menu-32.5 {DeleteMenuCloneEntries} -setup {
     .m1 activate one
     .m1 delete one
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1
     .m1 add command -label test \
 		-command ".m1 delete test ; .m1 add command -label test -command \".m1 delete test\"; .m1 delete test"
     .m1 invoke test
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.7 {DeleteMenuCloneEntries - one entry} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     menu .m1 -tearoff 0
     .m1 add command -label Hello
     .m1 delete Hello
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.8 {Ensure all menu clone commands are deleted} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     # SF bug #465324
     menu .menubar
@@ -3859,11 +3859,11 @@ test menu-32.8 {Ensure all menu clone commands are deleted} -setup {
 
     info commands .#menubar*test*
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup {
     set res {}
-	deleteWindows
+    deleteWindows
 } -body {
     menu .menubar
     . configure -menu .menubar
@@ -3881,12 +3881,12 @@ test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup {
     lappend res [.#menubar.#menubar#test entrycget 1 -menu]
     return $res
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade}
 
 
 test menu-33.1 {menu vs command hiding} -setup {
-	deleteWindows
+    deleteWindows
 } -body {
 	set l [interp hidden]
     menu .m
@@ -3904,7 +3904,7 @@ test menu-33.1 {menu vs command hiding} -setup {
 test menu-34.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} -constraints {
 	altDisplay
 } -setup {
-	deleteWindows
+    deleteWindows
 } -body {
     toplevel .one
     menu .one.m
@@ -3924,7 +3924,7 @@ test menu-35.1 {menu -underline string overruns Bug 1599877} -setup {
     update
     tk::TraverseToMenu . "e"
 } -cleanup {
-	deleteWindows
+    deleteWindows
 } -result {}
 
 test menu-37.1 {menubar menues cannot be posted - bug 2160206} -setup {
-- 
cgit v0.12


From 7dd533ff48d75bd9ea042030ba8347cbd45c7150 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Thu, 27 Jun 2019 09:57:14 +0000
Subject: Add Emoji to widget demo

---
 library/demos/unicodeout.tcl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index faa9f90..9cd3661 100644
--- a/library/demos/unicodeout.tcl
+++ b/library/demos/unicodeout.tcl
@@ -22,8 +22,8 @@ label $w.msg -font $font -wraplength 4i -anchor w -justify left \
 	below depends largely on what character sets you have installed,\
 	and what you see for characters that are not present varies greatly\
 	between platforms as well.  The strings are written in Tcl using\
-	UNICODE characters using the \\uXXXX escape so as to do so in a\
-	portable fashion."
+	UNICODE characters using the \\uXXXX (or \\UXXXXXX) escape so as to\
+	do so in a portable fashion."
 pack $w.msg -side top
 
 ## See Code / Dismiss buttons
@@ -131,6 +131,8 @@ addSample $w Japanese \
 addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
 addSample $w Russian \
 	"\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
+addSample $w Emoji \
+	"\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1"
 
 ## We're done processing, so change things back to normal running...
 destroy $w.wait
-- 
cgit v0.12


From 4615f020a57405c8485b67cb178674faac4de7d7 Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Fri, 28 Jun 2019 22:41:48 +0000
Subject: Tiny adjustment.

---
 macosx/tkMacOSXScrlbr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 1928886..06fb2b7 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -181,7 +181,7 @@ static void drawMacScrollbar(
     if (scrollPtr->vertical) {
 	thumbBounds.origin.x = troughBounds.origin.x + MIN_GAP;
 	thumbBounds.origin.y = troughBounds.origin.y + scrollPtr->sliderFirst;
-	thumbBounds.size.width = troughBounds.size.width - 2*MIN_GAP;
+	thumbBounds.size.width = troughBounds.size.width - 2*MIN_GAP + 1;
 	thumbBounds.size.height = scrollPtr->sliderLast - scrollPtr->sliderFirst;
 	inner[0] = troughBounds.origin;
 	inner[1] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
-- 
cgit v0.12


From b1fa4ddec9f6c1ff76fc74fb964dd230e7c95d4d Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Sat, 29 Jun 2019 00:05:14 +0000
Subject: Fix compiler warnings on all macOS versions.

---
 macosx/tkMacOSXKeyEvent.c   | 3 ++-
 macosx/tkMacOSXMouseEvent.c | 2 +-
 macosx/tkMacOSXPrivate.h    | 3 ---
 macosx/tkMacOSXServices.c   | 2 +-
 macosx/ttkMacOSXTheme.c     | 5 +++--
 5 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 8691ce2..65b7aee 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -259,7 +259,8 @@ unsigned short releaseCode;
 @implementation TKContentView
 
 -(id)init {
-    if (self = [super init]) {
+    self = [super init];
+    if (self) {
         _needsRedisplay = NO;
     }
     return self;
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 0cf7cd6..2517769 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -51,7 +51,7 @@ enum {
 {
     NSWindow *eventWindow = [theEvent window];
     NSEventType eventType = [theEvent type];
-    TkWindow *winPtr, *grabWinPtr;
+    TkWindow *winPtr = NULL, *grabWinPtr;
     Tk_Window tkwin;
     NSPoint local, global;
 #if 0
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 98ee54f..282a000 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -341,10 +341,7 @@ VISIBILITY_HIDDEN
 {
 @private
     NSString *privateWorkingText;
-#ifdef __i386__
-    /* The Objective C runtime used on i386 requires this. */
     Bool _needsRedisplay;
-#endif
 }
 @property Bool needsRedisplay;
 @end
diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c
index 809c708..02c0fda 100644
--- a/macosx/tkMacOSXServices.c
+++ b/macosx/tkMacOSXServices.c
@@ -120,7 +120,7 @@ ServicesEventProc(
 	      userData:(NSString *)data
 		 error:(NSString **)error
 {
-    NSString *pboardString, *pboardType;
+    NSString *pboardString = nil, *pboardType = nil;
     NSArray *types = [pboard types];
     Tcl_Event *event;
 
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 05a5539..7ea9448 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -1042,7 +1042,6 @@ static void DrawDarkFocusRing(
 	{x, y + h}, {x, y + 1}, {x + w - 1, y + 1}, {x + w - 1, y + h}
     };
     CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}};
-    CGRect outerRect = CGRectInset(bounds, -3, -3);
 
     CGContextSaveGState(context);
     CGContextSetShouldAntialias(context, false);
@@ -1061,7 +1060,8 @@ static void DrawDarkFocusRing(
     CGContextStrokePath(context);
     CGContextSetShouldAntialias(context, true);
     CGContextSetFillColorWithColor(context, CGCOLOR(fillColor));
-    CGPathRef path = CGPathCreateWithRoundedRect(outerRect, 4, 4, NULL);
+    CGPathRef path = CGPathCreateWithRoundedRect(CGRectInset(bounds, -3, -3),
+						 4, 4, NULL);
     CGContextBeginPath(context);
     CGContextAddPath(context, path);
     CGContextAddRect(context, bounds);
@@ -1091,6 +1091,7 @@ static void DrawDarkFrame(
     };
     CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}};
     CGPoint accent[2] = {{x, y + 1}, {x + w, y + 1}};
+
     switch (kind) {
     case kHIThemeFrameTextFieldSquare:
 	CGContextSaveGState(context);
-- 
cgit v0.12


From fc77051b61693815b705692a1a84b09bc138c782 Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Sat, 29 Jun 2019 18:28:48 +0000
Subject: Adjust minimum thumb size

---
 macosx/tkMacOSXScrlbr.c | 16 ++++++++++------
 macosx/ttkMacOSXTheme.c |  3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 06fb2b7..c0fd704 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -25,7 +25,7 @@
  * always easy to grab with the mouse).
  */
 
-#define MIN_SLIDER_LENGTH	8
+#define MIN_SLIDER_LENGTH	18
 #define MIN_GAP			4
 
 /*
@@ -161,7 +161,14 @@ TkpCreateScrollbar(
  *--------------------------------------------------------------
  */
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED > 1080
+
+/*
+ * This stand-alone drawing function is used on macOS 10.9 and newer because
+ * the HIToolbox does not draw the scrollbar thumb at the expected size on
+ * those systems.  The thumb is drawn too large, causing a mouse click on the
+ * thumb to be interpreted as a mouse click in the trough.
+ */
 
 static void drawMacScrollbar(
     TkScrollbar *scrollPtr,
@@ -170,11 +177,8 @@ static void drawMacScrollbar(
 {
     MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
     NSView *view = TkMacOSXDrawableView(macWin);
-    NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
     CGPathRef path;
     CGPoint inner[2], outer[2];
-    NSColor *troughColor, *thumbColor;
-    CGFloat *rgba;
     CGRect troughBounds = msPtr->info.bounds, thumbBounds;
     troughBounds.origin.y = [view bounds].size.height -
 	(troughBounds.origin.y + troughBounds.size.height);
@@ -296,7 +300,7 @@ TkpDisplayScrollbar(
 	HIThemeDrawTrack(&msPtr->info, 0, dc.context,
 			 kHIThemeOrientationNormal);
     } else {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
+#if MAC_OS_X_VERSION_MAX_ALLOWED > 1080
 
 	/*
 	 * Switch back to NSView coordinates and draw a modern scrollbar.
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 7ea9448..2c2c266 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -2347,7 +2347,8 @@ static void ThumbElementSize(
     int orientation = TTK_ORIENT_HORIZONTAL;
 
     Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
-    *minHeight = *minWidth = 8;
+    *minHeight = 18;
+    *minWidth = 8;
 }
 
 static void ThumbElementDraw(
-- 
cgit v0.12


From 89357088ac798f9bc97064cfe566d05438b5e6c5 Mon Sep 17 00:00:00 2001
From: Kevin Walzer <kw@codebykevin.com>
Date: Sun, 30 Jun 2019 02:15:02 +0000
Subject: Update documentation on do script Apple Event command

---
 doc/tk_mac.n | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/doc/tk_mac.n b/doc/tk_mac.n
index 1694385..e4ca695 100644
--- a/doc/tk_mac.n
+++ b/doc/tk_mac.n
@@ -13,6 +13,8 @@
 tk::mac \- Access Mac-Specific Functionality on OS X from Tk
 .SH SYNOPSIS
 .nf
+\fB::tk::mac::DoScriptFile\fR
+\fB::tk::mac::DoScriptText\fR
 \fB::tk::mac::ShowPreferences\fR
 \fB::tk::mac::OpenApplication\fR
 \fB::tk::mac::ReopenApplication\fR
@@ -44,6 +46,20 @@ events that applications should respond to. These events are mapped by Tk to
 calls to commands in the \fB::tk::mac\fR namespace; unless otherwise noted, if
 the command is absent, no action will be taken.
 .TP
+\fB::tk::mac::DoScriptFile\fR
+.
+The default Apple Event handler for AEDoScriptHandler. This command,
+if defined, executes a Tcl file when an AppleScript sends a
+.QW "do script"
+command to Wish with a file path as a parameter. 
+.TP
+\fB::tk::mac::DoScriptText\fR
+.
+The default Apple Event handler for AEDoScriptHandler. This command,
+if defined, executes Tcl code when an AppleScript sends a
+.QW "do script"
+command to Wish with Tcl code or a Tcl procedure as a parameter.
+.TP
 \fB::tk::mac::ShowPreferences\fR
 .
 The default Apple Event handler for kAEShowPreferences,
-- 
cgit v0.12


From 007c334e52bc3b088269275f91961dbffeecf9d2 Mon Sep 17 00:00:00 2001
From: dgp <dgp@users.sourceforge.net>
Date: Sun, 30 Jun 2019 11:51:47 +0000
Subject: Fix failure to compile.

---
 unix/tkUnixFont.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index d00ff82..dc80807 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -316,6 +316,7 @@ TkpFontPkgInit(
     Tcl_Encoding ucs2;
 
     if (tsdPtr->controlFamily.encoding == NULL) {
+	Tcl_EncodingType type;
 	type.encodingName = "X11ControlChars";
 	type.toUtfProc = ControlUtfProc;
 	type.fromUtfProc = ControlUtfProc;
-- 
cgit v0.12


From d618c08d920a191a902d8270166ea76a2b17d4cb Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Sun, 30 Jun 2019 14:35:13 +0000
Subject: Fix geometry of horizontal ttk scrollbars; hide thumb when no
 scrolling is possible.

---
 macosx/tkMacOSXScrlbr.c | 68 +++++++++++++++++++++++++++----------------------
 macosx/ttkMacOSXTheme.c |  9 +++++--
 2 files changed, 45 insertions(+), 32 deletions(-)

diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index c0fd704..6c5558d 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -89,7 +89,8 @@ typedef struct ScrollbarMetrics {
 } ScrollbarMetrics;
 
 static ScrollbarMetrics metrics = {
-    15, 54, 26, 14, 14, kControlSizeNormal /* kThemeScrollBarMedium */
+    /* kThemeScrollBarMedium */
+    15, MIN_SLIDER_LENGTH, 26, 14, 14, kControlSizeNormal
 };
 
 /*
@@ -182,25 +183,6 @@ static void drawMacScrollbar(
     CGRect troughBounds = msPtr->info.bounds, thumbBounds;
     troughBounds.origin.y = [view bounds].size.height -
 	(troughBounds.origin.y + troughBounds.size.height);
-    if (scrollPtr->vertical) {
-	thumbBounds.origin.x = troughBounds.origin.x + MIN_GAP;
-	thumbBounds.origin.y = troughBounds.origin.y + scrollPtr->sliderFirst;
-	thumbBounds.size.width = troughBounds.size.width - 2*MIN_GAP + 1;
-	thumbBounds.size.height = scrollPtr->sliderLast - scrollPtr->sliderFirst;
-	inner[0] = troughBounds.origin;
-	inner[1] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
-	outer[0] = CGPointMake(inner[0].x + troughBounds.size.width - 1, inner[0].y);
-	outer[1] = CGPointMake(outer[0].x, inner[1].y);
-    } else {
-	thumbBounds.origin.x = troughBounds.origin.x + scrollPtr->sliderFirst + MIN_GAP;
-	thumbBounds.origin.y = troughBounds.origin.x + MIN_GAP;
-	thumbBounds.size.width = scrollPtr->sliderLast - scrollPtr->sliderFirst;
-	thumbBounds.size.height -= troughBounds.size.height - 2*MIN_GAP;
-	inner[0] = troughBounds.origin;
-	inner[1] = CGPointMake(inner[0].x + troughBounds.size.width, inner[0].y);
-	outer[0] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
-	outer[1] = CGPointMake(inner[1].x, outer[0].y);
-    }
     CGContextSetShouldAntialias(context, false);
     CGContextSetGrayFillColor(context, 250.0 / 255, 1.0);
     CGContextFillRect(context, troughBounds);
@@ -208,17 +190,43 @@ static void drawMacScrollbar(
     CGContextStrokeLineSegments(context, inner, 2);
     CGContextSetGrayStrokeColor(context, 238.0 / 255, 1.0);
     CGContextStrokeLineSegments(context, outer, 2);
-    path = CGPathCreateWithRoundedRect(thumbBounds, 4, 4, NULL);
-    CGContextBeginPath(context);
-    CGContextAddPath(context, path);
-    if (msPtr->info.trackInfo.scrollbar.pressState != 0) {
-	CGContextSetGrayFillColor(context, 133.0 / 255, 1.0);
-    } else {
-	CGContextSetGrayFillColor(context, 200.0 / 255, 1.0);
+
+    /*
+     * Do not display the thumb unless scrolling is possible.
+     */
+    
+    if (scrollPtr->firstFraction > 0.0 || scrollPtr->lastFraction < 1.0) {
+	if (scrollPtr->vertical) {
+	    thumbBounds.origin.x = troughBounds.origin.x + MIN_GAP;
+	    thumbBounds.origin.y = troughBounds.origin.y + scrollPtr->sliderFirst;
+	    thumbBounds.size.width = troughBounds.size.width - 2*MIN_GAP + 1;
+	    thumbBounds.size.height = scrollPtr->sliderLast - scrollPtr->sliderFirst;
+	    inner[0] = troughBounds.origin;
+	    inner[1] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
+	    outer[0] = CGPointMake(inner[0].x + troughBounds.size.width - 1, inner[0].y);
+	    outer[1] = CGPointMake(outer[0].x, inner[1].y);
+	} else {
+	    thumbBounds.origin.x = troughBounds.origin.x + scrollPtr->sliderFirst + MIN_GAP;
+	    thumbBounds.origin.y = troughBounds.origin.y + MIN_GAP;
+	    thumbBounds.size.width = scrollPtr->sliderLast - scrollPtr->sliderFirst;
+	    thumbBounds.size.height = troughBounds.size.height - 2*MIN_GAP + 1;
+	    inner[0] = troughBounds.origin;
+	    inner[1] = CGPointMake(inner[0].x + troughBounds.size.width, inner[0].y);
+	    outer[0] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
+	    outer[1] = CGPointMake(inner[1].x, outer[0].y);
+	}
+	path = CGPathCreateWithRoundedRect(thumbBounds, 4, 4, NULL);
+	CGContextBeginPath(context);
+	CGContextAddPath(context, path);
+	if (msPtr->info.trackInfo.scrollbar.pressState != 0) {
+	    CGContextSetGrayFillColor(context, 133.0 / 255, 1.0);
+	} else {
+	    CGContextSetGrayFillColor(context, 200.0 / 255, 1.0);
+	}
+	CGContextSetShouldAntialias(context, true);
+	CGContextFillPath(context);
+	CFRelease(path);
     }
-    CGContextSetShouldAntialias(context, true);
-    CGContextFillPath(context);
-    CFRelease(path);
 }
 #endif
 	       
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 2c2c266..129148f 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -2347,8 +2347,13 @@ static void ThumbElementSize(
     int orientation = TTK_ORIENT_HORIZONTAL;
 
     Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation);
-    *minHeight = 18;
-    *minWidth = 8;
+    if (orientation == TTK_ORIENT_VERTICAL) {
+	*minHeight = 18;
+	*minWidth = 8;
+    } else {
+	*minHeight = 8;
+	*minWidth = 18;
+    }	
 }
 
 static void ThumbElementDraw(
-- 
cgit v0.12


From 550866099de4398419d4c3d7d80365577b546fe8 Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Mon, 1 Jul 2019 15:09:35 +0000
Subject: Fix layout bugs.

---
 macosx/tkMacOSXScrlbr.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 6c5558d..16f6003 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -179,10 +179,34 @@ static void drawMacScrollbar(
     MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin);
     NSView *view = TkMacOSXDrawableView(macWin);
     CGPathRef path;
-    CGPoint inner[2], outer[2];
-    CGRect troughBounds = msPtr->info.bounds, thumbBounds;
+    CGPoint inner[2], outer[2], thumbOrigin;
+    CGSize thumbSize;
+    CGRect troughBounds = msPtr->info.bounds;
     troughBounds.origin.y = [view bounds].size.height -
 	(troughBounds.origin.y + troughBounds.size.height);
+    if (scrollPtr->vertical) {
+	thumbOrigin.x = troughBounds.origin.x + MIN_GAP;
+	thumbOrigin.y = troughBounds.origin.y + scrollPtr->sliderFirst;
+	thumbSize.width = troughBounds.size.width - 2*MIN_GAP + 1;
+	thumbSize.height = scrollPtr->sliderLast - scrollPtr->sliderFirst;
+	inner[0] = troughBounds.origin;
+	inner[1] = CGPointMake(inner[0].x,
+			       inner[0].y + troughBounds.size.height);
+	outer[0] = CGPointMake(inner[0].x + troughBounds.size.width - 1,
+			       inner[0].y);
+	outer[1] = CGPointMake(outer[0].x, inner[1].y);
+    } else {
+	thumbOrigin.x = troughBounds.origin.x + scrollPtr->sliderFirst;
+	thumbOrigin.y = troughBounds.origin.y + MIN_GAP;
+	thumbSize.width = scrollPtr->sliderLast - scrollPtr->sliderFirst;
+	thumbSize.height = troughBounds.size.height - 2*MIN_GAP + 1;
+	inner[0] = troughBounds.origin;
+	inner[1] = CGPointMake(inner[0].x + troughBounds.size.width,
+			       inner[0].y + 1);
+	outer[0] = CGPointMake(inner[0].x,
+			       inner[0].y + troughBounds.size.height);
+	outer[1] = CGPointMake(inner[1].x, outer[0].y);
+    }
     CGContextSetShouldAntialias(context, false);
     CGContextSetGrayFillColor(context, 250.0 / 255, 1.0);
     CGContextFillRect(context, troughBounds);
@@ -196,25 +220,7 @@ static void drawMacScrollbar(
      */
     
     if (scrollPtr->firstFraction > 0.0 || scrollPtr->lastFraction < 1.0) {
-	if (scrollPtr->vertical) {
-	    thumbBounds.origin.x = troughBounds.origin.x + MIN_GAP;
-	    thumbBounds.origin.y = troughBounds.origin.y + scrollPtr->sliderFirst;
-	    thumbBounds.size.width = troughBounds.size.width - 2*MIN_GAP + 1;
-	    thumbBounds.size.height = scrollPtr->sliderLast - scrollPtr->sliderFirst;
-	    inner[0] = troughBounds.origin;
-	    inner[1] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
-	    outer[0] = CGPointMake(inner[0].x + troughBounds.size.width - 1, inner[0].y);
-	    outer[1] = CGPointMake(outer[0].x, inner[1].y);
-	} else {
-	    thumbBounds.origin.x = troughBounds.origin.x + scrollPtr->sliderFirst + MIN_GAP;
-	    thumbBounds.origin.y = troughBounds.origin.y + MIN_GAP;
-	    thumbBounds.size.width = scrollPtr->sliderLast - scrollPtr->sliderFirst;
-	    thumbBounds.size.height = troughBounds.size.height - 2*MIN_GAP + 1;
-	    inner[0] = troughBounds.origin;
-	    inner[1] = CGPointMake(inner[0].x + troughBounds.size.width, inner[0].y);
-	    outer[0] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height);
-	    outer[1] = CGPointMake(inner[1].x, outer[0].y);
-	}
+	CGRect thumbBounds = {thumbOrigin, thumbSize};
 	path = CGPathCreateWithRoundedRect(thumbBounds, 4, 4, NULL);
 	CGContextBeginPath(context);
 	CGContextAddPath(context, path);
-- 
cgit v0.12


From 865691668477d52f751cefbf0c2c6bc5059d2ddd Mon Sep 17 00:00:00 2001
From: culler <culler>
Date: Mon, 1 Jul 2019 19:57:58 +0000
Subject: Improve scrollbar and ttk::scrollbar on OSX 10.8 and earlier.

---
 macosx/tkMacOSXScrlbr.c | 12 ++++--------
 macosx/ttkMacOSXTheme.c | 39 +++++++++++++++++++--------------------
 2 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 16f6003..0f92c70 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -18,8 +18,6 @@
 #include "tkScrollbar.h"
 #include "tkMacOSXPrivate.h"
 
-#define MIN_SCROLLBAR_VALUE		0
-
 /*
  * Minimum slider length, in pixels (designed to make sure that the slider is
  * always easy to grab with the mouse).
@@ -601,7 +599,7 @@ UpdateControlValues(
     msPtr->info.bounds = contrlRect;
 
     width = contrlRect.size.width;
-    height = contrlRect.size.height;
+    height = contrlRect.size.height - scrollPtr->arrowLength;
 
     /*
      * Ensure we set scrollbar control bounds only once all size adjustments
@@ -625,10 +623,9 @@ UpdateControlValues(
      * the view area.
      */
 
-    double maximum = 100, factor = RangeToFactor(maximum);
-
+    double factor = RangeToFactor(100.0);
     dViewSize = (scrollPtr->lastFraction - scrollPtr->firstFraction) * factor;
-    msPtr->info.max = MIN_SCROLLBAR_VALUE + factor - dViewSize;
+    msPtr->info.max = factor - dViewSize;
     msPtr->info.trackInfo.scrollbar.viewsize = dViewSize;
     if (scrollPtr->vertical) {
 	if (SNOW_LEOPARD_STYLE) {
@@ -638,8 +635,7 @@ UpdateControlValues(
 		    factor * scrollPtr->firstFraction;
 	}
     } else {
-	msPtr->info.value = MIN_SCROLLBAR_VALUE +
-		factor * scrollPtr->firstFraction;
+	msPtr->info.value = factor * scrollPtr->firstFraction;
     }
 
     if ((scrollPtr->firstFraction <= 0.0 && scrollPtr->lastFraction >= 1.0)
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index 129148f..b58a743 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -2374,15 +2374,11 @@ static void ThumbElementDraw(
      * able to display the thumb element at the size and location which the ttk
      * scrollbar widget requests.  The algorithm that HIToolbox uses to
      * determine the thumb geometry from the input values of min, max, value
-     * and viewSize is, of course, undocumented.  And this turns out to be a
-     * hard reverse engineering problem.  A seemingly natural algorithm is
-     * implemented below, but it does not correctly compute the same thumb
-     * geometry as HITools (which also apparently does not agree with
-     * NSScrollbar).  This code uses that algorithm for older OS versions,
+     * and viewSize is undocumented.  A seemingly natural algorithm is
+     * implemented below.  This code uses that algorithm for older OS versions,
      * because using HITools also handles drawing the buttons and 3D thumb used
-     * on those systems.  The incorrect geometry is annoying but not completely
-     * unusable.  For newer systems the cleanest approach is to just draw the
-     * thumb directly.
+     * on those systems.  For newer systems the cleanest approach is to just
+     * draw the thumb directly.
      */
 
     if ([NSApp macMinorVersion] > 8) {
@@ -2410,7 +2406,7 @@ static void ThumbElementDraw(
 	SolidFillRoundedRectangle(dc.context, thumbBounds, 4, thumbColor);
 	END_DRAWING
     } else {
-	double thumbSize, trackSize, visibleSize, viewSize;
+	double thumbSize, trackSize, visibleSize, factor, fraction;
 	MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin);
 	CGRect troughBounds = {{macWin->xOff, macWin->yOff},
 			       {Tk_Width(tkwin), Tk_Height(tkwin)}};
@@ -2424,7 +2420,6 @@ static void ThumbElementDraw(
          * largest int.
          */
 
-	viewSize = RangeToFactor(100.0);
 	HIThemeTrackDrawInfo info = {
 	    .version = 0,
 	    .bounds = troughBounds,
@@ -2433,19 +2428,24 @@ static void ThumbElementDraw(
 		kThemeTrackThumbRgnIsNotGhost,
 	    .enableState = kThemeTrackActive
 	};
-	info.trackInfo.scrollbar.viewsize = viewSize * .8;
+	factor = RangeToFactor(100.0);
 	if (orientation == TTK_ORIENT_HORIZONTAL) {
 	    trackSize = troughBounds.size.width;
 	    thumbSize = b.width;
-	    visibleSize = (thumbSize / trackSize) * viewSize;
-	    info.max = viewSize - visibleSize;
-	    info.value = info.max * (b.x / (trackSize - thumbSize));
+	    fraction = b.x / trackSize;
 	} else {
-	    thumbSize = b.height;
 	    trackSize = troughBounds.size.height;
-	    visibleSize = (thumbSize / trackSize) * viewSize;
-	    info.max = viewSize - visibleSize;
-	    info.value = info.max * (b.y / (trackSize - thumbSize));
+	    thumbSize = b.height;
+	    fraction = b.y / trackSize;
+	}
+	visibleSize = (thumbSize / trackSize) * factor;
+	info.max = factor - visibleSize;
+	info.trackInfo.scrollbar.viewsize = visibleSize;
+	if ([NSApp macMinorVersion] < 8 ||
+	    orientation == TTK_ORIENT_HORIZONTAL) {
+	    info.value = factor * fraction;
+	} else {
+	    info.value = info.max - factor * fraction;
 	}
 	if ((state & TTK_STATE_PRESSED) ||
 	    (state & TTK_STATE_HOVER)) {
@@ -3123,8 +3123,7 @@ static int AquaTheme_Init(
 
     /*
      * <<NOTE-TRACKS>>
-     * In some themes the Layouts for a progress bar has a trough element and
-     *a
+     * In some themes the Layouts for a progress bar has a trough element and a
      * pbar element.  But in our case the appearance manager draws both parts
      * of the progress bar, so we just have a single element called ".track".
      */
-- 
cgit v0.12


From 7b6e25bd97a76f688ed363cac924ea99a83fa5f4 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Tue, 2 Jul 2019 09:24:24 +0000
Subject: Statically initialize "X11ControlChars" pseudo-encoding.

---
 unix/tkUnixFont.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index dc80807..50033ec 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -316,14 +316,8 @@ TkpFontPkgInit(
     Tcl_Encoding ucs2;
 
     if (tsdPtr->controlFamily.encoding == NULL) {
-	Tcl_EncodingType type;
-	type.encodingName = "X11ControlChars";
-	type.toUtfProc = ControlUtfProc;
-	type.fromUtfProc = ControlUtfProc;
-	type.freeProc = NULL;
-	type.clientData = NULL;
-	type.nullSize = 0;
 
+	Tcl_EncodingType type = {"X11ControlChars", ControlUtfProc, ControlUtfProc, NULL, NULL, 0};
 	tsdPtr->controlFamily.refCount = 2;
 	tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type);
 	tsdPtr->controlFamily.isTwoByteFont = 0;
@@ -342,8 +336,8 @@ TkpFontPkgInit(
 
 	ucs2 = Tcl_GetEncoding(NULL, "ucs-2be");
 	if (ucs2 == NULL) {
-	    Tcl_EncodingType type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2};
-	    Tcl_CreateEncoding(&type);
+	    Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2};
+	    Tcl_CreateEncoding(&ucs2type);
 	} else {
 	    Tcl_FreeEncoding(ucs2);
 	}
-- 
cgit v0.12


From 8d9bcf37ddbe36e3fd50042d8dfb15bc5a6c2d12 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Tue, 2 Jul 2019 09:28:05 +0000
Subject: Don't use "struct ThreadSpecificData", while the type name
 "ThreadSpecificData" is already sufficient.

---
 generic/tkBitmap.c     | 2 +-
 generic/tkButton.c     | 2 +-
 generic/tkColor.c      | 2 +-
 generic/tkConfig.c     | 2 +-
 generic/tkEvent.c      | 2 +-
 generic/tkGet.c        | 2 +-
 generic/tkImage.c      | 2 +-
 generic/tkImgPhoto.c   | 2 +-
 generic/tkMacWinMenu.c | 2 +-
 generic/tkMenu.c       | 2 +-
 generic/tkObj.c        | 2 +-
 generic/tkOption.c     | 2 +-
 generic/tkPointer.c    | 2 +-
 generic/tkSelect.c     | 2 +-
 generic/tkStyle.c      | 2 +-
 generic/tkWindow.c     | 2 +-
 unix/tkUnixEmbed.c     | 2 +-
 unix/tkUnixEvent.c     | 2 +-
 unix/tkUnixFont.c      | 2 +-
 unix/tkUnixRFont.c     | 4 ++--
 unix/tkUnixSelect.c    | 2 +-
 unix/tkUnixSend.c      | 2 +-
 win/tkWinButton.c      | 2 +-
 win/tkWinDialog.c      | 2 +-
 win/tkWinDraw.c        | 2 +-
 win/tkWinEmbed.c       | 2 +-
 win/tkWinFont.c        | 2 +-
 win/tkWinMenu.c        | 2 +-
 win/tkWinWindow.c      | 2 +-
 win/tkWinWm.c          | 2 +-
 win/tkWinX.c           | 2 +-
 31 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 88f3e2b..54bab69 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -88,7 +88,7 @@ typedef struct {
     int width, height;		/* Dimensions of bitmap. */
 } DataKey;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int initialized;		/* 0 means table below needs initializing. */
     Tcl_HashTable predefBitmapTable;
 				/* Hash table created by Tk_DefineBitmap to
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 0d760b0..37cfcd2 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -16,7 +16,7 @@
 #include "tkButton.h"
 #include "default.h"
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int defaultsInitialized;
 } ThreadSpecificData;
 static Tcl_ThreadDataKey dataKey;
diff --git a/generic/tkColor.c b/generic/tkColor.c
index ccb9914..f6650f9 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -31,7 +31,7 @@ typedef struct {
  * The structure below is used to allocate thread-local data.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     char rgbString[20];		/* */
 } ThreadSpecificData;
 static Tcl_ThreadDataKey dataKey;
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index d3c8aad..f1a5176 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -31,7 +31,7 @@
  * the option tables that have been created for a thread.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int initialized;		/* 0 means table below needs initializing. */
     Tcl_HashTable hashTable;
 } ThreadSpecificData;
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 891f667..b36d5de 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -139,7 +139,7 @@ typedef struct ExitHandler {
  * storage for the current thread.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int handlersActive;		/* The following variable has a non-zero value
 				 * when a handler is active. */
     InProgress *pendingPtr;	/* Topmost search in progress, or NULL if
diff --git a/generic/tkGet.c b/generic/tkGet.c
index d58b4a5..6eff3a3 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -22,7 +22,7 @@
  * the current thread.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int initialized;
     Tcl_HashTable uidTable;
 } ThreadSpecificData;
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 32e09c0..dc4e8e0 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -66,7 +66,7 @@ typedef struct ImageMaster {
 				 * when the world is falling apart.) */
 } ImageMaster;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     Tk_ImageType *imageTypeList;/* First in a list of all known image
 				 * types. */
     Tk_ImageType *oldImageTypeList;
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 26f1f26..03b3731 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -125,7 +125,7 @@ Tk_ImageType tkPhotoImageType = {
     NULL
 };
 
-typedef struct ThreadSpecificData {
+typedef struct {
     Tk_PhotoImageFormat *formatList;
 				/* Pointer to the first in the list of known
 				 * photo image formats.*/
diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c
index 9449838..ab92fec 100644
--- a/generic/tkMacWinMenu.c
+++ b/generic/tkMacWinMenu.c
@@ -13,7 +13,7 @@
 #include "tkInt.h"
 #include "tkMenu.h"
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int postCommandGeneration;
 } ThreadSpecificData;
 static Tcl_ThreadDataKey dataKey;
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 3a2d987..d755096 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -77,7 +77,7 @@
 
 #define MENU_HASH_KEY "tkMenus"
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int menusInitialized;	/* Flag indicates whether thread-specific
 				 * elements of the Windows Menu module have
 				 * been initialized. */
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 46f2da5..94d9879 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -47,7 +47,7 @@ typedef struct PixelRep {
  * thread.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     const Tcl_ObjType *doubleTypePtr;
     const Tcl_ObjType *intTypePtr;
 } ThreadSpecificData;
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 545a9b9..713a6d5 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -176,7 +176,7 @@ typedef struct StackLevel {
 				 * of a level. */
 } StackLevel;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int initialized;		/* 0 means the ThreadSpecific Data structure
 				 * for the current thread needs to be
 				 * initialized. */
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index 0141b64..6e87638 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -35,7 +35,7 @@ static const unsigned int buttonMasks[] = {
 };
 #define ButtonMask(b) (buttonMasks[(b)-Button1])
 
-typedef struct ThreadSpecificData {
+typedef struct {
     TkWindow *grabWinPtr;	/* Window that defines the top of the grab
 				 * tree in a global grab. */
     int lastState;		/* Last known state flags. */
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 8ba0c5f..c64c93f 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -48,7 +48,7 @@ typedef struct LostCommand {
  * The structure below is used to keep each thread's pending list separate.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     TkSelInProgress *pendingPtr;
 				/* Topmost search in progress, or NULL if
 				 * none. */
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index d9299d1..5c0f204 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -98,7 +98,7 @@ typedef struct Element {
  * Thread-local data.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int nbInit;			/* Number of calls to the init proc. */
     Tcl_HashTable engineTable;	/* Map a name to a style engine. Keys are
 				 * strings, values are Tk_StyleEngine
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index ee8e1a9..51cbaf3 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -37,7 +37,7 @@ typedef struct TkHalfdeadWindow {
     struct TkHalfdeadWindow *nextPtr;
 } TkHalfdeadWindow;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int numMainWindows;		/* Count of numver of main windows currently
 				 * open in this thread. */
     TkMainInfo *mainWindowList;
diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c
index d9203ca..a33a623 100644
--- a/unix/tkUnixEmbed.c
+++ b/unix/tkUnixEmbed.c
@@ -42,7 +42,7 @@ typedef struct Container {
 				 * process. */
 } Container;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     Container *firstContainerPtr;
 				/* First in list of all containers managed by
 				 * this process. */
diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c
index cde3791..a92b868 100644
--- a/unix/tkUnixEvent.c
+++ b/unix/tkUnixEvent.c
@@ -23,7 +23,7 @@
  * the current thread.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int initialized;
 } ThreadSpecificData;
 static Tcl_ThreadDataKey dataKey;
diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c
index 50033ec..f43e086 100644
--- a/unix/tkUnixFont.c
+++ b/unix/tkUnixFont.c
@@ -153,7 +153,7 @@ typedef struct FontAttributes {
     TkXLFDAttributes xa;
 } FontAttributes;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     FontFamily *fontFamilyList; /* The list of font families that are
 				 * currently loaded. As screen fonts are
 				 * loaded, this list grows to hold information
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 2430134..10e5aca 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -50,7 +50,7 @@ typedef struct {
  * the information isn't retrievable from the GC.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     Region clipRegion;		/* The clipping region, or None. */
 } ThreadSpecificData;
 static Tcl_ThreadDataKey dataKey;
@@ -69,7 +69,7 @@ void
 TkpFontPkgInit(
     TkMainInfo *mainPtr)	/* The application being created. */
 {
-    static Tcl_Config cfg[] = {
+    static const Tcl_Config cfg[] = {
 	{ "fontsystem", "xft" },
 	{ 0,0 }
     };
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index 6d379ec..dfbb895 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.c
@@ -68,7 +68,7 @@ typedef struct IncrInfo {
 				 * currently pending. */
 } IncrInfo;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     IncrInfo *pendingIncrs;	/* List of all incr structures currently
 				 * active. */
 } ThreadSpecificData;
diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c
index 0b4f05d..1ee4bba 100644
--- a/unix/tkUnixSend.c
+++ b/unix/tkUnixSend.c
@@ -97,7 +97,7 @@ typedef struct PendingCommand {
 				 * NULL means end of list. */
 } PendingCommand;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     PendingCommand *pendingCommands;
 				/* List of all commands currently being waited
 				 * for. */
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index d03a391..95b4fe4 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -63,7 +63,7 @@ enum {
  * widget classes.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     BITMAPINFOHEADER *boxesPtr;	/* Information about the bitmap. */
     DWORD *boxesPalette;	/* Pointer to color palette. */
     LPSTR boxesBits;		/* Pointer to bitmap data. */
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 4ad3b9e..5116352 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -48,7 +48,7 @@
 #endif
 #endif /* BFFM_VALIDATEFAILED */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int debugFlag;		/* Flags whether we should output debugging
 				 * information while displaying a builtin
 				 * dialog. */
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index e13a5e5..4341424 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -103,7 +103,7 @@ const int tkpWinBltModes[] = {
 
 typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, const POINT *points, int npoints);
 
-typedef struct ThreadSpecificData {
+typedef struct {
     POINT *winPoints;		/* Array of points that is reused. */
     int nWinPoints;		/* Current size of point array. */
 } ThreadSpecificData;
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index 6c80964..ca293fe 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -34,7 +34,7 @@ typedef struct Container {
 				 * process. */
 } Container;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     Container *firstContainerPtr;
 				/* First in list of all containers managed by
 				 * this process. */
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 6e8d3bd..33392d3 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -168,7 +168,7 @@ static const TkStateMap systemMap[] = {
     {-1,		    NULL}
 };
 
-typedef struct ThreadSpecificData {
+typedef struct {
     FontFamily *fontFamilyList; /* The list of font families that are
 				 * currently loaded. As screen fonts are
 				 * loaded, this list grows to hold information
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 3223759..3aa8a61 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -85,7 +85,7 @@ static int indicatorDimensions[2];
 
 static BOOL showMenuAccelerators;
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int inPostMenu;		/* We cannot be re-entrant like X Windows. */
     WORD lastCommandID;		/* The last command ID we allocated. */
     HWND menuHWND;		/* A window to service popup-menu messages
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index 385e72b..445ff9c 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -13,7 +13,7 @@
 #include "tkWinInt.h"
 #include "tkBusy.h"
 
-typedef struct ThreadSpecificData {
+typedef struct {
     int initialized;		/* 0 means table below needs initializing. */
     Tcl_HashTable windowTable;  /* The windowTable maps from HWND to Tk_Window
 				 * handles. */
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 5bb23d1..37f1dec 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -367,7 +367,7 @@ static const Tk_GeomMgr wmMgrType = {
     NULL,			/* lostSlaveProc */
 };
 
-typedef struct ThreadSpecificData {
+typedef struct {
     HPALETTE systemPalette;	/* System palette; refers to the currently
 				 * installed foreground logical palette. */
     TkWindow *createWindow;	/* Window that is being constructed. This
diff --git a/win/tkWinX.c b/win/tkWinX.c
index e7428e5..fd576a4 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -86,7 +86,7 @@ static Tcl_Encoding unicodeEncoding = NULL;
  * specific date for threads.
  */
 
-typedef struct ThreadSpecificData {
+typedef struct {
     TkDisplay *winDisplay;	/* TkDisplay structure that represents Windows
 				 * screen. */
     int updatingClipboard;	/* If 1, we are updating the clipboard. */
-- 
cgit v0.12


From 8a3e8fe5694a99d5b91fb75803a6976aa259eb66 Mon Sep 17 00:00:00 2001
From: fvogel <fvogelnew1@free.fr>
Date: Tue, 2 Jul 2019 19:36:19 +0000
Subject: Fix [f3c5467f07]: various spelling fixes (from Christopher Chavez)

---
 doc/panedwindow.n     | 2 +-
 doc/tk_mac.n          | 2 +-
 generic/tk3d.c        | 2 +-
 generic/tkGrid.c      | 4 ++--
 generic/tkImgGIF.c    | 4 ++--
 generic/tkMenu.c      | 2 +-
 generic/tkMenu.h      | 2 +-
 generic/tkObj.c       | 4 ++--
 generic/tkOldTest.c   | 2 +-
 generic/tkTest.c      | 2 +-
 macosx/tkMacOSXFont.c | 2 +-
 macosx/tkMacOSXFont.h | 2 +-
 tests/menuDraw.test   | 2 +-
 win/tkWinDialog.c     | 4 ++--
 win/tkWinFont.c       | 2 +-
 win/tkWinWm.c         | 2 +-
 xlib/xgc.c            | 4 ++--
 17 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/doc/panedwindow.n b/doc/panedwindow.n
index 40997a9..9fc2b72 100644
--- a/doc/panedwindow.n
+++ b/doc/panedwindow.n
@@ -331,7 +331,7 @@ fill, and the containing toplevel is resized), space is added to the final
 (rightmost or bottommost) pane in the window.
 .PP
 Unlike slave windows managed by e.g. pack or grid, the panes managed by a
-panedwindow do not change width or height to accomodate changes in the
+panedwindow do not change width or height to accommodate changes in the
 requested widths or heights of the panes, once these have become mapped.
 Therefore it may be advisable, particularly when creating layouts
 interactively, to not add a pane to the panedwindow widget until after the
diff --git a/doc/tk_mac.n b/doc/tk_mac.n
index e4ca695..bf338b6 100644
--- a/doc/tk_mac.n
+++ b/doc/tk_mac.n
@@ -81,7 +81,7 @@ proc ::tk::mac::ShowPreferences {} {
 \fB::tk::mac::OpenApplication\fR
 .
 If a proc of this name is defined, this proc fill fire when your application
-is intially opened. It is the default Apple Event handler for
+is initially opened. It is the default Apple Event handler for
 kAEOpenApplication,
 .QW oapp .
 .TP
diff --git a/generic/tk3d.c b/generic/tk3d.c
index bcc5673..987bace8 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -1315,7 +1315,7 @@ Tk_Get3DBorderFromObj(
  *
  * Side effects:
  *	If no error occurs, a blank internal format for a border value is
- *	intialized. The final form cannot be done without a Tk_Window.
+ *	initialized. The final form cannot be done without a Tk_Window.
  *
  *----------------------------------------------------------------------
  */
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 4e0882a..be15c14 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -1913,7 +1913,7 @@ ResolveConstraints(
     GridLayout *layoutPtr;	/* Temporary layout structure. */
     int requiredSize;		/* The natural size of the grid (pixels).
 				 * This is the minimum size needed to
-				 * accomodate all of the slaves at their
+				 * accommodate all of the slaves at their
 				 * requested sizes. */
     int offset;			/* The pixel offset of the right edge of the
 				 * current slot from the beginning of the
@@ -2486,7 +2486,7 @@ GetGrid(
  * Side effects:
  *	The width and height arguments are filled in the master data
  *	structure. Additional space is allocated for the constraints to
- *	accomodate the offsets.
+ *	accommodate the offsets.
  *
  *----------------------------------------------------------------------
  */
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 0c32047..76e48d4 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -63,9 +63,9 @@ typedef struct mFile {
  * Most data in a GIF image is binary and is treated as such. However, a few
  * key bits are stashed in ASCII. If we try to compare those pieces to the
  * char they represent, it will fail on any non-ASCII (eg, EBCDIC) system. To
- * accomodate these systems, we test against the numeric value of the ASCII
+ * accommodate these systems, we test against the numeric value of the ASCII
  * characters instead of the characters themselves. This is encoding
- * independant.
+ * independent.
  */
 
 static const char GIF87a[] = {			/* ASCII GIF87a */
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index d755096..5fd8b80 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -90,7 +90,7 @@ static Tcl_ThreadDataKey dataKey;
 
 /*
  * The following flag indicates whether the process-wide state for the Menu
- * module has been intialized. The Mutex protects access to that flag.
+ * module has been initialized. The Mutex protects access to that flag.
  */
 
 static int menusInitialized;
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index 4cc3d1b..ae69d96 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -120,7 +120,7 @@ typedef struct TkMenuEntry {
 				 * always 0 for tearoff and separator
 				 * entries. */
     int hideMargin;		/* If this is 0, then the item has enough
-    				 * margin to accomodate a standard check mark
+    				 * margin to accommodate a standard check mark
     				 * and a default right margin. If this is 1,
     				 * then the item has no such margins, and
     				 * checkbuttons and radiobuttons with this set
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 94d9879..559f0e2 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -96,7 +96,7 @@ static int		SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
 /*
  * The following structure defines the implementation of the "pixel" Tcl
  * object, used for measuring distances. The pixel object remembers its
- * initial display-independant settings.
+ * initial display-independent settings.
  */
 
 static const Tcl_ObjType pixelObjType = {
@@ -110,7 +110,7 @@ static const Tcl_ObjType pixelObjType = {
 /*
  * The following structure defines the implementation of the "pixel" Tcl
  * object, used for measuring distances. The pixel object remembers its
- * initial display-independant settings.
+ * initial display-independent settings.
  */
 
 static const Tcl_ObjType mmObjType = {
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index f78ebba..948883d 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -91,7 +91,7 @@ static int              ImageObjCmd(ClientData dummy,
  *
  * TkOldTestInit --
  *
- *	This function performs intialization for the Tk test suite
+ *	This function performs initialization for the Tk test suite
  *	extensions for testing support for legacy interfaces.
  *
  * Results:
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 44fec0d..a8929b9 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -212,7 +212,7 @@ static void		TrivialEventProc(ClientData clientData,
  *
  * Tktest_Init --
  *
- *	This function performs intialization for the Tk test suite exensions.
+ *	This function performs initialization for the Tk test suite extensions.
  *
  * Results:
  *	Returns a standard Tcl completion code, and leaves an error message in
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 0e05ae5..fb71e85 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -1,7 +1,7 @@
 /*
  * tkMacOSXFont.c --
  *
- *	Contains the Macintosh implementation of the platform-independant font
+ *	Contains the Macintosh implementation of the platform-independent font
  *	package interface.
  *
  * Copyright 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
diff --git a/macosx/tkMacOSXFont.h b/macosx/tkMacOSXFont.h
index 08380c4..7fc9265 100644
--- a/macosx/tkMacOSXFont.h
+++ b/macosx/tkMacOSXFont.h
@@ -1,7 +1,7 @@
 /*
  * tkMacOSXFont.h --
  *
- *	Contains the Macintosh implementation of the platform-independant
+ *	Contains the Macintosh implementation of the platform-independent
  *	font package interface.
  *
  * Copyright (c) 1990-1994 The Regents of the University of California.
diff --git a/tests/menuDraw.test b/tests/menuDraw.test
index 1dfa5d7..0d7a049 100644
--- a/tests/menuDraw.test
+++ b/tests/menuDraw.test
@@ -20,7 +20,7 @@ test menuDraw-1.1 {TkMenuInitializeDrawingFields} -setup {
 } -result {.m1}
 
 
-test menuDraw-2.1 {TkIntializeMenuEntryDrawingFields} -setup {
+test menuDraw-2.1 {TkInitializeMenuEntryDrawingFields} -setup {
     deleteWindows
 } -body {
     menu .m1
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 5116352..743720d 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1714,7 +1714,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
     /*
      * We now allow FNERR_BUFFERTOOSMALL when multiselection is enabled. The
      * filename buffer has been dynamically allocated by the OFN dialog
-     * procedure to accomodate all selected files.
+     * procedure to accommodate all selected files.
      */
 
     if ((winCode != 0)
@@ -2716,7 +2716,7 @@ ChooseDirectoryValidateProc(
 
     case BFFM_INITIALIZED: {
 	/*
-	 * Directory browser intializing - tell it where to start from, user
+	 * Directory browser initializing - tell it where to start from, user
 	 * specified parameter.
 	 */
 
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 33392d3..63ddff4 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -1,7 +1,7 @@
 /*
  * tkWinFont.c --
  *
- *	Contains the Windows implementation of the platform-independant font
+ *	Contains the Windows implementation of the platform-independent font
  *	package interface.
  *
  * Copyright (c) 1994 Software Research Associates, Inc.
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 37f1dec..5bcf1ad 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -4371,7 +4371,7 @@ WmIconphotoCmd(
 	iconInfo.fIcon = TRUE;
 
 	/*
-	 * Create device-independant color bitmap.
+	 * Create device-independent color bitmap.
 	 */
 
 	ZeroMemory(&bmInfo, sizeof bmInfo);
diff --git a/xlib/xgc.c b/xlib/xgc.c
index b85fe39..9eaf7ae 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -117,7 +117,7 @@ XCreateGC(
     /*
      * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars
      * are defined, which is invisible from the outside. The list is assumed
-     * to end with a 0-char, so this must be set explicitely during
+     * to end with a 0-char, so this must be set explicitly during
      * initialization.
      */
 
@@ -453,7 +453,7 @@ XSetClipOrigin(
  *	None.
  *
  * Side effects:
- *	Allocates or dealloates a TkpClipMask.
+ *	Allocates or deallocates a TkpClipMask.
  *
  *----------------------------------------------------------------------
  */
-- 
cgit v0.12


From 6777d1361550e20a8dfef9e3e42532de02899fdb Mon Sep 17 00:00:00 2001
From: fvogel <fvogelnew1@free.fr>
Date: Tue, 2 Jul 2019 20:15:40 +0000
Subject: Fix [bc6a495949]: Documentation bug for upper case %X an %Y binding
 script substitutions

---
 doc/bind.n | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/bind.n b/doc/bind.n
index 2191369..7b22e90 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -567,7 +567,7 @@ If a virtual-root window manager is being used then the substituted
 values are the corresponding x-coordinate and y-coordinate in the virtual root.
 Valid only for
 \fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
-and \fBMotion\fR events.
+\fBMotion\fR, \fBEnter\fR and \fBLeave\fR events.
 Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root
 window.
 .LP
-- 
cgit v0.12


From f82e600a88c7ead35683026cac2caaa6f24f32e2 Mon Sep 17 00:00:00 2001
From: fvogel <fvogelnew1@free.fr>
Date: Wed, 3 Jul 2019 19:39:28 +0000
Subject: Change for alphabetical order of events concerned by %X,%Y

---
 doc/bind.n | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/bind.n b/doc/bind.n
index 7b22e90..0f7e26b 100644
--- a/doc/bind.n
+++ b/doc/bind.n
@@ -566,8 +566,8 @@ The \fIx_root\fR and  \fIy_root\fR fields from the event.
 If a virtual-root window manager is being used then the substituted
 values are the corresponding x-coordinate and y-coordinate in the virtual root.
 Valid only for
-\fBButtonPress\fR, \fBButtonRelease\fR, \fBKeyPress\fR, \fBKeyRelease\fR,
-\fBMotion\fR, \fBEnter\fR and \fBLeave\fR events.
+\fBButtonPress\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBKeyPress\fR,
+\fBKeyRelease\fR, \fBLeave\fR and \fBMotion\fR events.
 Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root
 window.
 .LP
-- 
cgit v0.12


From 1c3c5d6089f03b70a840c3496df70ad70cf66b7f Mon Sep 17 00:00:00 2001
From: fvogel <fvogelnew1@free.fr>
Date: Sun, 7 Jul 2019 19:01:30 +0000
Subject: Fix [e6d58de4b6]: ctext.tcl: remove duplicate word

---
 library/demos/ctext.tcl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index 4b8c644..a3b4e8a 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -40,7 +40,7 @@ $c create rectangle 245 195 255 205 -outline black -fill red
 
 # First, create the text item and give it bindings so it can be edited.
 
-$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
+$c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left]
 $c bind text <1> "textB1Press $c %x %y"
 $c bind text <B1-Motion> "textB1Move $c %x %y"
 $c bind text <Shift-1> "$c select adjust current @%x,%y"
-- 
cgit v0.12