diff options
46 files changed, 232 insertions, 179 deletions
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob index 632e3bf..7a72cc2 100644 --- a/.fossil-settings/ignore-glob +++ b/.fossil-settings/ignore-glob @@ -20,7 +20,7 @@ */config.status */tkConfig.sh */wish* -*/tktest* +*/tktest */versions.vc */version.vc */libtk.vfs @@ -26,7 +26,7 @@ manifest.uuid _FOSSIL_ */tkConfig.sh */wish* -*/tktest* +*/tktest */versions.vc */version.vc */libtk.vfs diff --git a/doc/messageBox.n b/doc/messageBox.n index 6bcbc09..4350b22 100644 --- a/doc/messageBox.n +++ b/doc/messageBox.n @@ -66,9 +66,8 @@ box is displayed on top of its parent window. .TP \fB\-title\fR \fItitleString\fR . -Specifies a string to display as the title of the message box. This option -is ignored on Mac OS X, where platform guidelines forbid the use of a title -on this kind of dialog. +Specifies a string to display as the title of the message box. The +default value is an empty string. .TP \fB\-type\fR \fIpredefinedType\fR . diff --git a/doc/ttk_image.n b/doc/ttk_image.n index bc1dd3f..34dbabb 100644 --- a/doc/ttk_image.n +++ b/doc/ttk_image.n @@ -79,13 +79,16 @@ The \fB\-border\fR divides the image into 9 regions: four fixed corners, top and left edges (which may be tiled horizontally), left and right edges (which may be tiled vertically), and the central area (which may be tiled in both directions). +.PP +An image element that is not meant to claim any space (for example when used +as a background image) should use \fB\-width 0\fR and \fB\-height 0\fR. .SH "EXAMPLE" .PP .CS set img1 [image create photo \-file button.png] set img2 [image create photo \-file button-pressed.png] set img3 [image create photo \-file button-active.png] -style element create Button.button image \e +ttk::style element create Button.button image \e [list $img1 pressed $img2 active $img3] \e \-border {2 4} \-sticky we .CE diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 9c2fccc..a2af41b 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -1014,7 +1014,7 @@ BitmapInit( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* - * First initialize the data in the ThreadSpecificData strucuture, if + * First initialize the data in the ThreadSpecificData structure, if * needed. */ @@ -1169,7 +1169,7 @@ TkDebugBitmap( * * TkGetBitmapPredefTable -- * - * This function is used by tkMacBitmap.c to access the thread-specific + * This function is used by tkMacOSXBitmap.c to access the thread-specific * predefBitmap table that maps from the names of the predefined bitmaps * to data associated with those bitmaps. It is required because the * table is allocated in thread-local storage and is not visible outside diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 0b37119..6ed9ffb 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -2007,7 +2007,7 @@ TkDeleteThreadExitHandler( * TkFinalize -- * * Runs our private exit handlers and removes itself from Tcl. This is - * benificial should we want to protect from dangling pointers should the + * beneficial should we want to protect from dangling pointers should the * Tk shared library be unloaded prior to Tcl which can happen on windows * should the process be forcefully exiting from an exception handler. * diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index be0fb36..f288f5d 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -500,13 +500,15 @@ TkGetBitmapData( Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); return NULL; } - expandedFileName = Tcl_TranslateFileName(interp, fileName, &buffer); + expandedFileName = Tcl_TranslateFileName(NULL, fileName, &buffer); if (expandedFileName == NULL) { - return NULL; + Tcl_SetErrno(ENOENT); + goto cannotRead; } pi.chan = Tcl_OpenFileChannel(interp, expandedFileName, "r", 0); Tcl_DStringFree(&buffer); if (pi.chan == NULL) { + cannotRead: if (interp != NULL) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_ObjPrintf( diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 209de6f..b8f7796 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -3503,7 +3503,7 @@ Tk_PhotoPutBlock( if (alphaOffset) { /* * This block is grossly inefficient. For each row in the image, it - * finds each continguous string of nontransparent pixels, then marks + * finds each contiguous string of nontransparent pixels, then marks * those areas as valid in the validRegion mask. This makes drawing * very efficient, because of the way we use X: we just say, here's * your mask, and here's your data. We need not worry about the diff --git a/generic/tkInt.h b/generic/tkInt.h index 26ac342..625d6f3 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -734,6 +734,13 @@ typedef struct TkMainInfo { /* Saved Tcl [update] command, used to restore * Tcl's version of [update] after Tk is shut * down */ +#if TCL_MAJOR_VERSION > 8 + Tcl_ObjCmdProc2 *tclUpdateObjProc2; + /* Saved Tcl [update] command, used to restore + * Tcl's version of [update] after Tk is shut + * down, in case it's a Tcl_ObjCmdProc2 */ +#endif + } TkMainInfo; /* diff --git a/generic/tkObj.c b/generic/tkObj.c index 1577be9..bc9b58d 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -1055,8 +1055,8 @@ FreeWindowInternalRep( * * Tk_NewWindowObj -- * - * This function allocates a new Tcl_Obj that refers to a particular to a - * particular Tk window. + * This function allocates a new Tcl_Obj that refers to a particular + * Tk window. * * Results: * A standard Tcl object reference, with refcount 0. diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 7147ad2..f422260 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -410,7 +410,7 @@ Tk_PanedWindowObjCmd( /* * The first time this function is invoked, the option tables will be * NULL. We then create the option tables from the templates and store - * a pointer to the tables as the command's clinical so we'll have + * a pointer to the tables as the command's clientData so we'll have * easy access to it in the future. */ diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 9b38352..78680f9 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -1898,7 +1898,7 @@ TkBTreePreviousLine( * height of the given line). * * Since the last line of text (the artificial one) has zero height by - * defintion, calling this with the last line will return the total + * definition, calling this with the last line will return the total * number of pixels in the widget. * * Results: diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index c8b0722..79199d8 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -44,6 +44,14 @@ static int IndexCountBytesOrdered(const TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2); +#if defined(USE_TCL_STUBS) && (TCL_MAJOR_VERSION < 9) +# undef Tcl_UtfPrev +# define Tcl_UtfPrev (((&tclStubsPtr->tcl_PkgProvideEx)[631]) ? \ + ((const char * (*)(const char *, const char *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[656])) \ + : ((const char * (*)(const char *, const char *))(void *)((&tclStubsPtr->tcl_PkgProvideEx)[331]))) +#endif + + /* * The "textindex" Tcl_Obj definition: */ diff --git a/generic/tkWindow.c b/generic/tkWindow.c index b3c4185..3b35ae3 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -885,6 +885,9 @@ TkCreateMainWindow( mainPtr->strictMotif = 0; mainPtr->alwaysShowSelection = 0; mainPtr->tclUpdateObjProc = NULL; +#if TCL_MAJOR_VERSION > 8 + mainPtr->tclUpdateObjProc2 = NULL; +#endif if (Tcl_LinkVar(interp, "tk_strictMotif", (char *) &mainPtr->strictMotif, TCL_LINK_BOOLEAN) != TCL_OK) { Tcl_ResetResult(interp); @@ -947,8 +950,15 @@ TkCreateMainWindow( } if ((cmdPtr->flags & SAVEUPDATECMD) && Tcl_GetCommandInfo(interp, cmdPtr->name, &cmdInfo) && - cmdInfo.isNativeObjectProc && !cmdInfo.objClientData && !cmdInfo.deleteProc) { - mainPtr->tclUpdateObjProc = cmdInfo.objProc; + cmdInfo.isNativeObjectProc && !cmdInfo.deleteProc) { +#if TCL_MAJOR_VERSION > 8 + if ((cmdInfo.isNativeObjectProc == 2) && !cmdInfo.objClientData2) { + mainPtr->tclUpdateObjProc2 = cmdInfo.objProc2; + } else +#endif + if (!cmdInfo.objClientData ) { + mainPtr->tclUpdateObjProc = cmdInfo.objProc; + } } if (cmdPtr->flags & USEINITPROC) { ((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData); @@ -961,9 +971,7 @@ TkCreateMainWindow( } } if (Tcl_GetCommandInfo(interp, "::tcl::build-info", &info)) { - Tcl_CreateObjCommand(interp, "::tk::build-info", - info.objProc, (void *) - (TK_PATCH_LEVEL "+" STRINGIFY(TK_VERSION_UUID) + static const char version[] = TK_PATCH_LEVEL "+" STRINGIFY(TK_VERSION_UUID) #if defined(MAC_OSX_TK) ".aqua" #endif @@ -1033,7 +1041,18 @@ TkCreateMainWindow( ".no-xft" #endif #endif - ), NULL); + ; +#if TCL_MAJOR_VERSION > 8 + if (info.isNativeObjectProc == 2) { + Tcl_CreateObjCommand2(interp, "::tk::build-info", + info.objProc2, (void *) + version, NULL); + + } else +#endif + Tcl_CreateObjCommand(interp, "::tk::build-info", + info.objProc, (void *) + version, NULL); } /* @@ -1589,13 +1608,22 @@ Tk_DestroyWindow( if ((winPtr->mainPtr->interp != NULL) && !Tcl_InterpDeleted(winPtr->mainPtr->interp)) { for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) { - if ((cmdPtr->flags & SAVEUPDATECMD) && - winPtr->mainPtr->tclUpdateObjProc != NULL) { + if (cmdPtr->flags & SAVEUPDATECMD) { /* Restore Tcl's version of [update] */ - Tcl_CreateObjCommand(winPtr->mainPtr->interp, - cmdPtr->name, - winPtr->mainPtr->tclUpdateObjProc, - NULL, NULL); +#if TCL_MAJOR_VERSION > 8 + if (winPtr->mainPtr->tclUpdateObjProc2 != NULL) { + Tcl_CreateObjCommand2(winPtr->mainPtr->interp, + cmdPtr->name, + winPtr->mainPtr->tclUpdateObjProc2, + NULL, NULL); + } else +#endif + if (winPtr->mainPtr->tclUpdateObjProc != NULL) { + Tcl_CreateObjCommand(winPtr->mainPtr->interp, + cmdPtr->name, + winPtr->mainPtr->tclUpdateObjProc, + NULL, NULL); + } } else { Tcl_CreateObjCommand(winPtr->mainPtr->interp, cmdPtr->name, TkDeadAppObjCmd, diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 6609651..621591e 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -258,7 +258,7 @@ static void Ttk_Tile( typedef struct { /* ClientData for image elements */ Ttk_ImageSpec *imageSpec; /* Image(s) to use */ int minWidth; /* Minimum width; overrides image width */ - int minHeight; /* Minimum width; overrides image width */ + int minHeight; /* Minimum height; overrides image height */ Ttk_Sticky sticky; /* -stickiness specification */ Ttk_Padding border; /* Fixed border region */ Ttk_Padding padding; /* Internal padding */ diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index e70bf04..f41e708 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -302,8 +302,8 @@ typedef struct { static void InitColumn(TreeColumn *column) { - column->width = 200; - column->minWidth = 20; + column->width = atoi(DEF_COLWIDTH); + column->minWidth = atoi(DEF_MINWIDTH); column->stretch = 1; column->separator = 0; column->idObj = 0; diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 891c180..58ed109 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -115,6 +115,20 @@ void TtkRedisplayWidget(WidgetCore *corePtr) } } +/* + * WidgetWorldChanged -- + * Default Tk_ClassWorldChangedProc() for widgets. + * Invoked whenever fonts or other system resources are changed; + * recomputes geometry. + */ +static void WidgetWorldChanged(ClientData clientData) +{ + WidgetCore *corePtr = (WidgetCore *)clientData; + (void)UpdateLayout(corePtr->interp, corePtr); + SizeChanged(corePtr); + TtkRedisplayWidget(corePtr); +} + /* TtkResizeWidget -- * Recompute widget size, schedule geometry propagation and redisplay. */ @@ -124,8 +138,7 @@ void TtkResizeWidget(WidgetCore *corePtr) return; } - SizeChanged(corePtr); - TtkRedisplayWidget(corePtr); + WidgetWorldChanged(corePtr); } /* TtkWidgetChangeState -- @@ -308,9 +321,7 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr) case VirtualEvent: { const char *name = ((XVirtualEvent *)eventPtr)->name; if ((name != NULL) && !strcmp("ThemeChanged", name)) { - (void)UpdateLayout(corePtr->interp, corePtr); - SizeChanged(corePtr); - TtkRedisplayWidget(corePtr); + WidgetWorldChanged(corePtr); } break; } @@ -320,25 +331,11 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr) } } -/* - * WidgetWorldChanged -- - * Default Tk_ClassWorldChangedProc() for widgets. - * Invoked whenever fonts or other system resources are changed; - * recomputes geometry. - */ -static void WidgetWorldChanged(ClientData clientData) -{ - WidgetCore *corePtr = (WidgetCore *)clientData; - (void)UpdateLayout(corePtr->interp, corePtr); - SizeChanged(corePtr); - TtkRedisplayWidget(corePtr); -} - static const Tk_ClassProcs widgetClassProcs = { sizeof(Tk_ClassProcs), /* size */ - WidgetWorldChanged, /* worldChangedProc */ - NULL, /* createProc */ - NULL /* modalProc */ + WidgetWorldChanged, /* worldChangedProc */ + NULL, /* createProc */ + NULL /* modalProc */ }; /* diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl index 14ddb0b..998af41 100644 --- a/library/demos/goldberg.tcl +++ b/library/demos/goldberg.tcl @@ -77,7 +77,6 @@ set S(mode) $::MSTART # Colors for everything set C(fg) black -set C(bg) gray75 set C(bg) cornflowerblue set C(0) white; set C(1a) darkgreen; set C(1b) yellow @@ -92,6 +91,7 @@ set C(17) \#A65353; set C(18) $C(fg); set C(19) gray50 set C(20) cyan; set C(21) gray65; set C(22) $C(20) set C(23a) blue; set C(23b) red; set C(23c) yellow set C(24a) red; set C(24b) white; +set C(24c) black; set C(26) $C(0); proc DoDisplay {w} { global S C @@ -1586,6 +1586,7 @@ proc Move24 {w {step {}}} { -width 10 -smooth 1 set msg [subst $S(message)] $w.c create text [Centroid $w I24] -text $msg -tag {I24 I24t} \ + -fill $::C(24c) \ -justify center -font {{Times Roman} 18 bold} return 1 } @@ -1619,6 +1620,7 @@ proc Move26 {w {step {}}} { if {$step >= 3} { $w.c delete I24 I26 $w.c create text 430 755 -anchor s -tag I26 \ + -fill $::C(26) \ -text "click to continue" -font {{Times Roman} 24 bold} bind $w.c <Button-1> [list Reset $w] return 4 diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl index 70e8cfd..a29af4b 100644 --- a/library/demos/menu.tcl +++ b/library/demos/menu.tcl @@ -18,7 +18,6 @@ positionWindow $w label $w.msg -font $font -wraplength 4i -justify left if {[tk windowingsystem] eq "aqua"} { - catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1} $w.msg configure -text "This window has a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where \"x\" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by selecting the first item in the menu." } else { $w.msg configure -text "This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where \"x\" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu." @@ -183,5 +182,3 @@ bind Menu <<MenuSelect>> { set menustatus $label update idletasks } - -if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}} diff --git a/library/demos/menubu.tcl b/library/demos/menubu.tcl index 96e3b15..453b05c 100644 --- a/library/demos/menubu.tcl +++ b/library/demos/menubu.tcl @@ -18,7 +18,6 @@ positionWindow $w frame $w.body pack $w.body -expand 1 -fill both -if {[tk windowingsystem] eq "aqua"} {catch {set origUseCustomMDEF $::tk::mac::useCustomMDEF; set ::tk::mac::useCustomMDEF 1}} menubutton $w.body.below -text "Below" -underline 0 -direction below -menu $w.body.below.m -relief raised menu $w.body.below.m -tearoff 0 @@ -86,5 +85,3 @@ foreach i {Black gray75 gray50 White} { } pack $body.buttons.colors -side left -padx 25 -pady 25 - -if {[tk windowingsystem] eq "aqua"} {catch {set ::tk::mac::useCustomMDEF $origUseCustomMDEF}} diff --git a/library/demos/puzzle.tcl b/library/demos/puzzle.tcl index eebe87a..f06de5d 100644 --- a/library/demos/puzzle.tcl +++ b/library/demos/puzzle.tcl @@ -11,7 +11,7 @@ package require Tk # puzzleSwitch -- # This procedure is invoked when the user clicks on a particular button; -# if the button is next to the empty space, it moves the button into th +# if the button is next to the empty space, it moves the button into the # empty space. proc puzzleSwitch {w num} { diff --git a/library/tk.tcl b/library/tk.tcl index 53c71a9..75ac9c0 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -684,15 +684,6 @@ proc ::tk::mcmaxamp {args} { return $maxlen } -# For now, turn off the custom mdef proc for the Mac: - -if {[tk windowingsystem] eq "aqua"} { - namespace eval ::tk::mac { - set useCustomMDEF 0 - } -} - - if {[tk windowingsystem] eq "aqua"} { #stub procedures to respond to "do script" Apple Events proc ::tk::mac::DoScriptFile {file} { diff --git a/macosx/README b/macosx/README index 52cbb1e..49e614e 100644 --- a/macosx/README +++ b/macosx/README @@ -545,7 +545,7 @@ appropriate place to drain the main NSAutoreleasePool and replace it with a new pool. This is done by calling the method [NSApp _resetAutoreleasePool], where _resetAutoreleasePool is a method which we define for the subclass. Unfortunately, by itself this is not -sufficient for safe memory managememt because, as was made painfully +sufficient for safe memory management because, as was made painfully evident with the release of OS X 10.13, it is possible for calls to TclDoOneEvent, and hence to CheckProc, to be nested. Draining the autorelease pool in a nested call leads to crashes as objects in use diff --git a/macosx/Tk-Common.xcconfig b/macosx/Tk-Common.xcconfig index 508384f..6322430 100644 --- a/macosx/Tk-Common.xcconfig +++ b/macosx/Tk-Common.xcconfig @@ -41,5 +41,5 @@ TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION) TCL_PACKAGE_PATH = "$(LIBDIR)" TCL_DEFS = HAVE_TCL_CONFIG_H TK_LIBRARY = $(LIBDIR)/tk$(VERSION) -TK_DEFS = HAVE_TK_CONFIG_H TCL_NO_DEPRECATED +TK_DEFS = HAVE_TK_CONFIG_H VERSION = 8.7 diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index ffb520d..4732ddb 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -299,7 +299,7 @@ GetRGBA( /* * Prior to OSX 10.14, getComponents returns black when applied to - * windowBackGroundColor. + * windowBackgroundColor. */ if ([NSApp macOSVersion] < 101400) { diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 03d3cf2..4c1566b 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -461,7 +461,7 @@ Tk_ChooseColorObjCmd( [colorPanel setShowsAlpha: NO]; [colorPanel _setUseModalAppearance:YES]; if (title) { - NSString *s = [[NSString alloc] initWithUTF8String:title]; + NSString *s = [[TKNSString alloc] initWithTclUtfBytes:title length:-1]; [colorPanel setTitle:s]; [s release]; @@ -533,7 +533,7 @@ parseFileFilters( if (filterInfo.doFileTypes) { for (FileFilter *filterPtr = fl.filters; filterPtr; filterPtr = filterPtr->next) { - NSString *name = [[NSString alloc] initWithUTF8String: filterPtr->name]; + NSString *name = [[TKNSString alloc] initWithTclUtfBytes: filterPtr->name length:-1]; [filterInfo.fileTypeNames addObject:name]; [name release]; @@ -551,7 +551,7 @@ parseFileFilters( str++; } if (*str) { - NSString *extension = [[NSString alloc] initWithUTF8String:str]; + NSString *extension = [[TKNSString alloc] initWithTclUtfBytes:str length:-1]; if (![filterInfo.allowedExtensions containsObject:extension]) { [filterInfo.allowedExtensions addObject:extension]; } @@ -604,7 +604,7 @@ parseFileFilters( const char *selectedFileType = Tcl_GetString(selectedFileTypeObj); NSString *selectedFileTypeStr = - [[NSString alloc] initWithUTF8String:selectedFileType]; + [[TKNSString alloc] initWithTclUtfBytes:selectedFileType length:-1]; NSUInteger index = [filterInfo.fileTypeNames indexOfObject:selectedFileTypeStr]; @@ -695,20 +695,21 @@ Tk_GetOpenFileObjCmd( case OPEN_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { - directory = [[[NSString alloc] initWithUTF8String:str] + directory = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case OPEN_INITFILE: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { - filename = [[[NSString alloc] initWithUTF8String:str] + filename = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case OPEN_MESSAGE: - message = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetStringFromObj(objv[i + 1], &len); + message = [[TKNSString alloc] initWithTclUtfBytes: + str length:len]; break; case OPEN_MULTIPLE: if (Tcl_GetBooleanFromObj(interp, objv[i + 1], @@ -725,8 +726,9 @@ Tk_GetOpenFileObjCmd( haveParentOption = 1; break; case OPEN_TITLE: - title = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetStringFromObj(objv[i + 1], &len); + title = [[TKNSString alloc] initWithTclUtfBytes: + str length:len]; break; case OPEN_TYPEVARIABLE: typeVariablePtr = objv[i + 1]; @@ -960,10 +962,10 @@ Tk_GetSaveFileObjCmd( case SAVE_DEFAULT: str = Tcl_GetStringFromObj(objv[i + 1], &len); while (*str && (*str == '*' || *str == '.')) { - str++; + str++; len--; } if (*str) { - defaultType = [[[NSString alloc] initWithUTF8String:str] + defaultType = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; @@ -973,21 +975,22 @@ Tk_GetSaveFileObjCmd( case SAVE_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { - directory = [[[NSString alloc] initWithUTF8String:str] + directory = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case SAVE_INITFILE: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { - filename = [[[NSString alloc] initWithUTF8String:str] + filename = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; [savepanel setNameFieldStringValue:filename]; } break; case SAVE_MESSAGE: - message = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetStringFromObj(objv[i + 1], &len); + message = [[TKNSString alloc] initWithTclUtfBytes: + str length:len]; break; case SAVE_PARENT: str = Tcl_GetStringFromObj(objv[i + 1], &len); @@ -998,8 +1001,9 @@ Tk_GetSaveFileObjCmd( haveParentOption = 1; break; case SAVE_TITLE: - title = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetStringFromObj(objv[i + 1], &len); + title = [[TKNSString alloc] initWithTclUtfBytes: + str length:len]; break; case SAVE_TYPEVARIABLE: typeVariablePtr = objv[i + 1]; @@ -1198,13 +1202,14 @@ Tk_ChooseDirectoryObjCmd( case CHOOSE_INITDIR: str = Tcl_GetStringFromObj(objv[i + 1], &len); if (len) { - directory = [[[NSString alloc] initWithUTF8String:str] + directory = [[[TKNSString alloc] initWithTclUtfBytes:str length:len] autorelease]; } break; case CHOOSE_MESSAGE: - message = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetStringFromObj(objv[i + 1], &len); + message = [[TKNSString alloc] initWithTclUtfBytes: + str length:len]; [panel setMessage:message]; [message release]; break; @@ -1223,8 +1228,9 @@ Tk_ChooseDirectoryObjCmd( haveParentOption = 1; break; case CHOOSE_TITLE: - title = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetStringFromObj(objv[i + 1], &len); + title = [[TKNSString alloc] initWithTclUtfBytes: + str length:len]; [panel setTitle:title]; [title release]; break; @@ -1387,8 +1393,9 @@ Tk_MessageBoxObjCmd( break; case ALERT_DETAIL: - message = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetString(objv[i + 1]); + message = [[TKNSString alloc] initWithTclUtfBytes: + str length:-1]; [alert setInformativeText:message]; [message release]; break; @@ -1401,8 +1408,9 @@ Tk_MessageBoxObjCmd( break; case ALERT_MESSAGE: - message = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetString(objv[i + 1]); + message = [[TKNSString alloc] initWithTclUtfBytes: + str length:-1]; [alert setMessageText:message]; [message release]; break; @@ -1417,8 +1425,9 @@ Tk_MessageBoxObjCmd( break; case ALERT_TITLE: - title = [[NSString alloc] initWithUTF8String: - Tcl_GetString(objv[i + 1])]; + str = Tcl_GetString(objv[i + 1]); + title = [[TKNSString alloc] initWithTclUtfBytes: + str length:-1]; [[alert window] setTitle:title]; [title release]; break; diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 1d4de67..f0e1d15 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -244,7 +244,7 @@ FindNSFont( NSString *family; if (familyName) { - family = [[[NSString alloc] initWithUTF8String:familyName] autorelease]; + family = [[[TKNSString alloc] initWithTclUtfBytes:familyName length:-1] autorelease]; } else { family = [defaultFont familyName]; } @@ -1254,7 +1254,6 @@ TkpDrawCharsInContext( * whole (not just the range) string when * drawing. */ { - (void)display; TkpDrawAngledCharsInContext(display, drawable, gc, tkfont, source, numBytes, rangeStart, rangeLength, x, y, 0.0); } diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 9443dbe..8045483 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -424,7 +424,7 @@ TkpInit( /* * TkpInit can be called multiple times with different interpreters. But - * The application initialization should only be done onece. + * The application initialization should only be done once. */ if (!initialized) { @@ -485,7 +485,7 @@ TkpInit( * the application icon, will be delivered before the procedure meant * to to handle the AppleEvent has been defined. This is handled in * tkMacOSXHLEvents.c by scheduling a timer event to handle the - * ApplEvent later, after the required procedure has been defined. + * AppleEvent later, after the required procedure has been defined. */ [NSApp _setup:interp]; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 41496a8..f703e59 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -121,7 +121,7 @@ static int ModifierCharWidth(Tk_Font tkfont); * demo would cause the animation to stop. This was also the case for * menubuttons. * - * The TKBackground object below works around this problem, and allows a Tk + * The TKBackgroundLoop object below works around this problem, and allows a Tk * event loop to run while a menu is open. It is a subclass of NSThread which * inserts requests to call [NSApp _runBackgroundLoop] onto the queue * associated with the NSEventTrackingRunLoopMode. One of these threads gets @@ -235,8 +235,8 @@ TKBackgroundLoop *backgroundLoop = nil; - (id) initWithTkMenu: (TkMenu *) tkMenu { - NSString *title = [[NSString alloc] initWithUTF8String: - Tk_PathName(tkMenu->tkwin)]; + NSString *title = [[TKNSString alloc] initWithTclUtfBytes: + Tk_PathName(tkMenu->tkwin) length:-1]; self = [self initWithTitle:title]; [title release]; @@ -734,9 +734,9 @@ TkpConfigureMenuEntry( [menuItem setImage:image]; if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr && mePtr->labelLength) { - title = [[[NSString alloc] initWithBytes:Tcl_GetString(mePtr->labelPtr) - length:mePtr->labelLength encoding:NSUTF8StringEncoding] - autorelease]; + title = [[TKNSString alloc] + initWithTclUtfBytes:Tcl_GetString(mePtr->labelPtr) + length:mePtr->labelLength]; if ([title hasSuffix:@"..."]) { title = [NSString stringWithFormat:@"%@%C", [title substringToIndex:[title length] - 3], 0x2026]; @@ -807,7 +807,7 @@ TkpConfigureMenuEntry( if ([submenu supermenu] && [menuItem submenu] != submenu) { /* * This happens during a clone, where the parent menu is - * cloned before its children, so just ignore this temprary + * cloned before its children, so just ignore this temporary * setting, it will be changed shortly (c.f. tkMenu.c * CloneMenu()) */ @@ -1307,7 +1307,7 @@ ParseAccelerator( if (ch) { return [[[NSString alloc] initWithCharacters:&ch length:1] autorelease]; } else { - return [[[[NSString alloc] initWithUTF8String:accel] autorelease] + return [[[[TKNSString alloc] initWithTclUtfBytes:accel length:-1] autorelease] lowercaseString]; } } @@ -1317,7 +1317,7 @@ ParseAccelerator( * * ModifierCharWidth -- * - * Helper mesuring width of command char in given font. + * Helper measuring width of command char in given font. * * Results: * Width of command char. diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index 891421f..53292b3 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -143,6 +143,7 @@ enum { buttonState &= ~Tk_GetButtonMask(button); break; case NSLeftMouseDragged: + buttonState |= Tk_GetButtonMask(button); if (![NSApp tkDragTarget]) { if (isOutside) { ignoreDrags = YES; @@ -258,7 +259,7 @@ enum { } /* - * If this click will change the focus, the Tk event event should + * If this click will change the focus, the Tk event should * be sent to the toplevel which will be receiving focus rather than to * the current focus window. So reset tkEventTarget. */ @@ -414,7 +415,6 @@ enum { * not in the grabber's subtree. */ - if (grabWinPtr && /* There is a grab in effect ... */ !winPtr->dispPtr->grabFlags && /* and it is a local grab ... */ grabWinPtr->mainPtr == winPtr->mainPtr){ /* in the same application. */ @@ -510,7 +510,7 @@ enum { Tk_UpdatePointer((Tk_Window) [NSApp tkDragTarget], global.x, global.y, state); } else { - Tk_UpdatePointer(NULL, global.x, global.y, state); + Tk_UpdatePointer(NULL, global.x, global.y, state); } } else if (eventType == NSMouseMoved || eventType == NSLeftMouseDragged) { @@ -849,7 +849,6 @@ GenerateButtonEvent( tkwin = Tk_TopCoordsToWindow(tkwin, medPtr->local.h, medPtr->local.v, &dummy, &dummy); } - Tk_UpdatePointer(tkwin, medPtr->global.h, medPtr->global.v, medPtr->state); return true; } diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 293e7ea..19441c5 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -344,7 +344,7 @@ TkMacOSXNotifyExitHandler( * deQueue=NO so that it will not change anything on the AppKit event * queue, because we only want the side effect that it runs drawRect. The * only times when any NSViews have the needsDisplay property set to YES - * are during execution of this function or in the addDirtyRect method + * are during execution of this function or in the addTkDirtyRect method * of TKContentView. * * The reason for running this function as an idle task is to try to diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 5c6a746..5a16e23 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -308,9 +308,6 @@ XUnmapWindow( TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXGetNSWindowForDrawable(window); - NSPoint mouse = [NSEvent mouseLocation]; - int x = mouse.x, y = TkMacOSXZeroScreenHeight() - mouse.y; - int state = TkMacOSXButtonKeyState(); if (!window) { return BadWindow; @@ -371,7 +368,6 @@ XUnmapWindow( if (view != [NSView focusView]) { [view addTkDirtyRect:[view bounds]]; } - Tk_UpdatePointer(NULL, x, y, state); return Success; } diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index a8d770b..0578a45 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -295,8 +295,8 @@ InjectKeyEventObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "option keysym ?arg?"); return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, - &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } type = types[index]; diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 297774e..d990c81 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -457,7 +457,7 @@ static void RefocusGrabWindow(void *data) { * being run inside of the drawRect method. If not, it may be desirable * for the display procedure to simply clear the REDRAW_PENDING flag * and return. The widget can be recorded in order to schedule a - * redraw, via and Expose event, from within drawRect. + * redraw, via an Expose event, from within drawRect. * * This is also needed for some tests, especially of the Text widget, * which record data in a global Tcl variable and assume that display @@ -1014,7 +1014,7 @@ ConfigureRestrictProc( /* * Make sure that the layer uses a contentScale that matches the - * backing scale factor of the screen. This avoids blurry text whe + * backing scale factor of the screen. This avoids blurry text when * the view is on a Retina display, as well as incorrect size when * the view is on a normal display. */ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 7552bae..fcfe247 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1198,14 +1198,14 @@ Tk_WmObjCmd( return TCL_ERROR; } if (objc == 2) { - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(wmTracing != 0)); + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(wmTracing)); return TCL_OK; } return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing); } - if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, - "option", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -1542,20 +1542,20 @@ WmGetAttribute( result = Tcl_NewBooleanObj([macWindow styleMask] & NSFullScreenWindowMask); break; case WMATT_MODIFIED: - result = Tcl_NewWideIntObj([macWindow isDocumentEdited] != 0); + result = Tcl_NewBooleanObj([macWindow isDocumentEdited]); break; case WMATT_NOTIFY: - result = Tcl_NewWideIntObj(tkMacOSXWmAttrNotifyVal != 0); + result = Tcl_NewBooleanObj(tkMacOSXWmAttrNotifyVal); break; case WMATT_TITLEPATH: result = Tcl_NewStringObj([[macWindow representedFilename] UTF8String], -1); break; case WMATT_TOPMOST: - result = Tcl_NewWideIntObj((wmPtr->flags & WM_TOPMOST) != 0); + result = Tcl_NewBooleanObj(wmPtr->flags & WM_TOPMOST); break; case WMATT_TRANSPARENT: - result = Tcl_NewWideIntObj((wmPtr->flags & WM_TRANSPARENT) != 0); + result = Tcl_NewBooleanObj(wmPtr->flags & WM_TRANSPARENT); break; case WMATT_TYPE: result = Tcl_NewStringObj("unsupported", -1); @@ -1614,8 +1614,8 @@ WmAttributesCmd( } Tcl_SetObjResult(interp, result); } else if (objc == 4) { /* wm attributes $win -attribute */ - if (Tcl_GetIndexFromObj(interp, objv[3], WmAttributeNames, - "attribute", 0, &attribute) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], WmAttributeNames, + sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, (WmAttribute)attribute)); @@ -1623,8 +1623,8 @@ WmAttributesCmd( int i; for (i = 3; i < objc; i += 2) { - if (Tcl_GetIndexFromObj(interp, objv[i], WmAttributeNames, - "attribute", 0, &attribute) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[i], WmAttributeNames, + sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } if (WmSetAttribute(winPtr, macWindow, interp, (WmAttribute)attribute, objv[i+1]) @@ -1963,8 +1963,8 @@ WmFocusmodelCmd( return TCL_OK; } - if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, - "argument", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, + sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_ACTIVE) { @@ -3113,7 +3113,7 @@ WmOverrideredirectCmd( if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( - Tk_Attributes((Tk_Window) winPtr)->override_redirect)); + Tk_Attributes((Tk_Window)winPtr)->override_redirect)); return TCL_OK; } @@ -3175,8 +3175,8 @@ WmPositionfromCmd( if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USPosition|PPosition); } else { - if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, - "argument", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, + sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_USER) { @@ -3331,10 +3331,8 @@ WmResizableCmd( if (objc == 3) { Tcl_Obj *results[2]; - results[0] = Tcl_NewWideIntObj( - (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) == 0); - results[1] = Tcl_NewWideIntObj( - (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) == 0); + results[0] = Tcl_NewBooleanObj(!(wmPtr->flags & WM_WIDTH_NOT_RESIZABLE)); + results[1] = Tcl_NewBooleanObj(!(wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE)); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } @@ -3421,8 +3419,8 @@ WmSizefromCmd( if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~(USSize|PSize); } else { - if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, - "argument", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, + sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_USER) { @@ -3550,8 +3548,8 @@ WmStackorderCmd( ckfree(windows); - if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, - "argument", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, + sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == OPT_ISABOVE) { @@ -3559,7 +3557,7 @@ WmStackorderCmd( } else { /* OPT_ISBELOW */ result = index1 < index2; } - Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result != 0)); + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result)); return TCL_OK; } } @@ -3617,8 +3615,8 @@ WmStateCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[3], optionStrings, - "argument", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, + sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } @@ -5474,7 +5472,7 @@ TkSetWMName( return; } - NSString *title = [[NSString alloc] initWithUTF8String:titleUid]; + NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:-1]; [TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title]; [title release]; } @@ -5699,8 +5697,8 @@ TkUnsupported1ObjCmd( return TCL_ERROR; } - if (Tcl_GetIndexFromObj(interp, objv[1], subcmds, - "option", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[1], subcmds, + sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch((enum SubCmds) index) { @@ -6029,7 +6027,7 @@ WmWinTabbingId( * allows you to get or set the appearance for the NSWindow associated * with a Tk Window. The syntax is: * - * tk::unsupported::MacWindowStyle tabbingid window ?newAppearance? + * tk::unsupported::MacWindowStyle appearance window ?newAppearance? * * Allowed appearance names are "aqua", "darkaqua", and "auto". * @@ -6101,8 +6099,8 @@ WmWinAppearance( } if (objc == 4) { int index; - if (Tcl_GetIndexFromObj(interp, objv[3], appearanceStrings, - "appearancename", 0, &index) != TCL_OK) { + if (Tcl_GetIndexFromObjStruct(interp, objv[3], appearanceStrings, + sizeof(char *), "appearancename", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum appearances) index) { diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index fd1b995..ca3b2ad 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -285,7 +285,7 @@ static CGRect NormalizeButtonBounds( */ /* - * For systems older than 10.14, [NSColor windowBackGroundColor] generates + * For systems older than 10.14, [NSColor windowBackgroundColor] generates * garbage when called from this function. In 10.14 it works correctly, and * must be used in order to have a background color which responds to Dark * Mode. So we use this hard-wired RGBA color on the older systems which don't diff --git a/tests/canvPs.test b/tests/canvPs.test index b3c81ea..1f3e1dc 100644 --- a/tests/canvPs.test +++ b/tests/canvPs.test @@ -133,9 +133,7 @@ test canvPs-2.4 {test writing to channel and file, same output} -constraints { destroy .c -test canvPs-3.1 {test ps generation with an embedded window} -constraints { - notAqua -} -setup { +test canvPs-3.1 {test ps generation with an embedded window} -setup { set bar [makeFile {} bar.ps] file delete $bar } -body { diff --git a/tests/imgBmap.test b/tests/imgBmap.test index 1beafac..ecb098e 100644 --- a/tests/imgBmap.test +++ b/tests/imgBmap.test @@ -221,7 +221,7 @@ test imageBmap-4.1 {ImgBmapConfigureInstance procedure: check error handling} -s test imageBmap-5.1 {GetBitmapData procedure} -body { list [catch {image create bitmap -file ~bad_user/a/b} msg] \ [string tolower $msg] -} -result {1 {user "bad_user" doesn't exist}} +} -result {1 {couldn't read bitmap file "~bad_user/a/b": no such file or directory}} test imageBmap-5.2 {GetBitmapData procedure} -body { list [catch {image create bitmap -file bad_name} msg] [string tolower $msg] } -result {1 {couldn't read bitmap file "bad_name": no such file or directory}} diff --git a/tests/oldpack.test b/tests/oldpack.test index a1ba276..d8a1bfe 100644 --- a/tests/oldpack.test +++ b/tests/oldpack.test @@ -32,7 +32,7 @@ place .pack.violet.l -relwidth 1.0 -relheight 1.0 if {![catch {pack ap .pack .pack.red top}]} { -# Don't execute any of this file if Tk is compiled with -DTCL_NO_DEPRECATED +# Don't execute any of this file if Tk is compiled with -DTK_NO_DEPRECATED test oldpack-1.1 {basic positioning} -body { diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test index f32d37f..d8238a2 100644 --- a/tests/ttk/treeview.test +++ b/tests/ttk/treeview.test @@ -1342,6 +1342,29 @@ test treeview-ce470f20fd-4 "changing -stretch resizes columns" -setup { destroy .tv } -result {60 50 60 50 60 50 1} +test treeview-bc602049ab "treeview with custom background does not change size when switching themes" -setup { + image create photo tvbg -data { + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAACXBIWXMAAAnXAAAJ1wG + xbhe3AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAACJJREFUOI + 1jPLF9+38GKgImaho2auCogaMGjho4auBQMhAAyR0DXUEyypsAAAAASUVORK5CYII= + } + ttk::style theme create foo-bc602049ab -parent clam -settings { + ttk::style element create Treeview.field image tvbg -width 0 -height 0 + } + ttk::style theme use foo-bc602049ab + pack [ttk::treeview .tv] + update idletasks +} -body { + set g1 [winfo geometry .tv] + ttk::style theme use foo-bc602049ab + update idletasks + set g2 [winfo geometry .tv] + expr {$g1 eq $g2 ? 1 : "$g1 --> $g2"} +} -cleanup { + destroy .tv + image delete tvbg +} -result {1} + test treeview-column0-leak "Test for leak in tree column" -setup { destroy .ttt set heading [string range _Hej_ 1 3] diff --git a/tests/xmfbox.test b/tests/xmfbox.test index a6426ec..89eda3c 100644 --- a/tests/xmfbox.test +++ b/tests/xmfbox.test @@ -91,8 +91,8 @@ test xmfbox-2.1 {tk::MotifFDialog_InterpFilter, ~ in dir names} -constraints { set x [tk::MotifFDialog_Create foo open {}] $::tk::dialog::file::foo(fEnt) delete 0 end $::tk::dialog::file::foo(fEnt) insert 0 [pwd]/~nosuchuser1 - set kk [tk::MotifFDialog_InterpFilter $x] -} -result "$testPWD/~nosuchuser1 *" + file normalize [file join {*}[tk::MotifFDialog_InterpFilter $x]] +} -result "$testPWD/~nosuchuser1/*" test xmfbox-2.2 {tk::MotifFDialog_InterpFilter, ~ in file names} -constraints { unix @@ -102,8 +102,8 @@ test xmfbox-2.2 {tk::MotifFDialog_InterpFilter, ~ in file names} -constraints { set x [tk::MotifFDialog_Create foo open {}] $::tk::dialog::file::foo(fEnt) delete 0 end $::tk::dialog::file::foo(fEnt) insert 0 [pwd]/~nosuchuser1 - set kk [tk::MotifFDialog_InterpFilter $x] -} -result "$testPWD ./~nosuchuser1" + file normalize [file join {*}[tk::MotifFDialog_InterpFilter $x]] +} -result "$testPWD/~nosuchuser1" test xmfbox-2.3 {tk::MotifFDialog_Update, ~ in file names} -constraints { unix @@ -138,7 +138,7 @@ test xmfbox-2.5 {tk::MotifFDialog_BrowseFList, ~ in file names} -constraints { $::tk::dialog::file::foo(fList) selection clear 0 end $::tk::dialog::file::foo(fList) selection set $i tk::MotifFDialog_BrowseFList $x - $::tk::dialog::file::foo(sEnt) get + file normalize [$::tk::dialog::file::foo(sEnt) get] } -result "$testPWD/~nosuchuser1" test xmfbox-2.6 {tk::MotifFDialog_ActivateFList, ~ in file names} -constraints { @@ -153,7 +153,7 @@ test xmfbox-2.6 {tk::MotifFDialog_ActivateFList, ~ in file names} -constraints { tk::MotifFDialog_BrowseFList $x tk::MotifFDialog_ActivateFList $x list $::tk::dialog::file::foo(selectPath) \ - $::tk::dialog::file::foo(selectFile) $tk::Priv(selectFilePath) + $::tk::dialog::file::foo(selectFile) [file normalize $tk::Priv(selectFilePath)] } -result "$testPWD ~nosuchuser1 $testPWD/~nosuchuser1" # cleanup diff --git a/unix/Makefile.in b/unix/Makefile.in index ab704ce..ba8dd29 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -189,7 +189,7 @@ KEYSYM_FLAGS = # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. -NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED +NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # Some versions of make, like SGI's, use the following variable to diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c index 66f88dc..0109cb7 100644 --- a/unix/tkUnixDialog.c +++ b/unix/tkUnixDialog.c @@ -166,7 +166,7 @@ Tk_GetSaveFileObjCmd( * See user documentation. * * Side effects: - * None. The MessageBox window will be destroy before this procedure + * None. The MessageBox window will be destroyed before this procedure * returns. * *---------------------------------------------------------------------- diff --git a/win/Makefile.in b/win/Makefile.in index 171501e..26f57bc 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -207,7 +207,7 @@ LN = ln # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. -NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED +NO_DEPRECATED_FLAGS = #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # TCL_EXE is the name of a tclsh executable that is available *BEFORE* diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index 0bfc7f1..ac2bf20 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -1840,7 +1840,7 @@ GetFileName( * * OFNHookProc -- * - * Dialog box hook function. This is used to sets the "tk_dialog" + * Dialog box hook function. This is used to set the "tk_dialog" * variable for test/debugging when the dialog is ready to receive * messages. When multiple file selection is enabled this function * is used to process the list of names. @@ -2719,7 +2719,7 @@ ChooseDirectoryValidateProc( * See user documentation. * * Side effects: - * None. The MessageBox window will be destroy before this function + * None. The MessageBox window will be destroyed before this function * returns. * *---------------------------------------------------------------------- diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e568f0c..6ca52b9 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -83,7 +83,7 @@ typedef struct TkWmStackorderToplevelPair { /* - * A pointer to one of these strucutures is associated with each toplevel. + * A pointer to one of these structures is associated with each toplevel. * This allows us to free up all memory associated with icon resources when a * window is deleted or if the window's icon is changed. They are simply * reference counted according to: |