summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-09-20 05:47:45 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-09-20 05:47:45 (GMT)
commitc4f43cbfd61694402d68b8b956becdfca5e13117 (patch)
tree33e818cebbd468d27a5f7eefbddc465a940b6a21
parent53d6fbfb14d816635671417a8023a355d7611f3d (diff)
parent63c9a7bdc6784f26faea47bd01badf0ad1d94d17 (diff)
downloadtk-c4f43cbfd61694402d68b8b956becdfca5e13117.zip
tk-c4f43cbfd61694402d68b8b956becdfca5e13117.tar.gz
tk-c4f43cbfd61694402d68b8b956becdfca5e13117.tar.bz2
merge 8.6
-rw-r--r--.fossil-settings/ignore-glob2
-rw-r--r--.gitignore2
-rw-r--r--doc/messageBox.n5
-rw-r--r--doc/ttk_image.n5
-rw-r--r--generic/tkBitmap.c4
-rw-r--r--generic/tkEvent.c2
-rw-r--r--generic/tkImgPhoto.c2
-rw-r--r--generic/tkObj.c4
-rw-r--r--generic/tkPanedWindow.c2
-rw-r--r--generic/tkTextBTree.c2
-rw-r--r--generic/ttk/ttkImage.c2
-rw-r--r--generic/ttk/ttkTreeview.c4
-rw-r--r--generic/ttk/ttkWidget.c38
-rw-r--r--library/demos/goldberg.tcl4
-rw-r--r--library/demos/menu.tcl3
-rw-r--r--library/demos/menubu.tcl3
-rw-r--r--library/demos/puzzle.tcl2
-rw-r--r--library/tk.tcl9
-rw-r--r--macosx/README2
-rw-r--r--macosx/tkMacOSXBitmap.c23
-rw-r--r--macosx/tkMacOSXColor.c29
-rw-r--r--macosx/tkMacOSXDialog.c115
-rw-r--r--macosx/tkMacOSXFileTypes.c112
-rw-r--r--macosx/tkMacOSXFileTypes.h144
-rw-r--r--macosx/tkMacOSXFont.c6
-rw-r--r--macosx/tkMacOSXInit.c37
-rw-r--r--macosx/tkMacOSXMenu.c88
-rw-r--r--macosx/tkMacOSXMouseEvent.c7
-rw-r--r--macosx/tkMacOSXNotify.c2
-rw-r--r--macosx/tkMacOSXPrivate.h13
-rw-r--r--macosx/tkMacOSXSubwindows.c4
-rw-r--r--macosx/tkMacOSXTest.c4
-rw-r--r--macosx/tkMacOSXWindowEvent.c4
-rw-r--r--macosx/tkMacOSXWm.c15
-rw-r--r--macosx/ttkMacOSXTheme.c2
-rw-r--r--tests/ttk/treeview.test23
-rw-r--r--unix/Makefile.in24
-rwxr-xr-xunix/configure3
-rw-r--r--unix/configure.in3
-rw-r--r--unix/tkUnixDialog.c2
-rw-r--r--win/tkWinDialog.c4
-rw-r--r--win/tkWinWm.c2
42 files changed, 566 insertions, 197 deletions
diff --git a/.fossil-settings/ignore-glob b/.fossil-settings/ignore-glob
index 05f877d..93e1db1 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
diff --git a/.gitignore b/.gitignore
index 33f0e0d..77ed6f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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 ccc97a4..55317de 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 456b86d..9c3b1b3 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -1992,7 +1992,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/tkImgPhoto.c b/generic/tkImgPhoto.c
index d385a7c..3d22c63 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -3025,7 +3025,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/tkObj.c b/generic/tkObj.c
index 1552d11..0abf534 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -975,8 +975,8 @@ FreeWindowInternalRep(
*
* TkNewWindowObj --
*
- * 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 44afb6e..5f542d0 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 1b65cbc..533f1bf 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/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index 002a753..e33a9de 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -249,7 +249,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 b37273b..7a5438a 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -241,8 +241,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->idObj = 0;
column->anchorObj = 0;
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index 36b5097..9fa8ec0 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -115,6 +115,19 @@ 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 = clientData;
+ SizeChanged(corePtr);
+ TtkRedisplayWidget(corePtr);
+}
+
/* TtkResizeWidget --
* Recompute widget size, schedule geometry propagation and redisplay.
*/
@@ -124,8 +137,7 @@ void TtkResizeWidget(WidgetCore *corePtr)
return;
}
- SizeChanged(corePtr);
- TtkRedisplayWidget(corePtr);
+ WidgetWorldChanged(corePtr);
}
/* TtkWidgetChangeState --
@@ -309,8 +321,7 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr)
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,24 +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 = clientData;
- SizeChanged(corePtr);
- TtkRedisplayWidget(corePtr);
-}
-
static 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 1cc52c6..7bedfa9 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 244361d..dc5ce9b 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."
@@ -176,5 +175,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 5bb3be7..3112da0 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -675,15 +675,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 4ed334f..db51db2 100644
--- a/macosx/README
+++ b/macosx/README
@@ -548,7 +548,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/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index 4f51fc6..30ed5fe 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -13,6 +13,7 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXConstants.h"
+
/*
* This structure holds information about native bitmaps.
*/
@@ -174,9 +175,8 @@ TkpCreateNativeBitmap(
Display *display,
const void *source) /* Info about the icon to build. */
{
- NSString *iconUTI = OSTYPE_TO_UTI(PTR2UINT(source));
- NSImage *iconImage = [[NSWorkspace sharedWorkspace]
- iconForFileType: iconUTI];
+ NSString *filetype = [NSString stringWithUTF8String:(char *)source];
+ NSImage *iconImage = TkMacOSXIconForFileType(filetype);
CGSize size = CGSizeMake(builtInIconSize, builtInIconSize);
Pixmap pixmap = PixmapFromImage(display, iconImage, size);
return pixmap;
@@ -253,7 +253,6 @@ TkpGetNativeAppBitmap(
NSString *string;
NSImage *image = nil;
NSSize size = { .width = builtInIconSize, .height = builtInIconSize };
-
if (iconBitmapTable.buckets &&
(hPtr = Tcl_FindHashEntry(&iconBitmapTable, name))) {
OSType type;
@@ -268,12 +267,12 @@ TkpGetNativeAppBitmap(
break;
case ICON_FILETYPE:
string = [NSString stringWithUTF8String:iconBitmap->value];
- image = [[NSWorkspace sharedWorkspace] iconForFileType:string];
+ image = TkMacOSXIconForFileType(string);
break;
case ICON_OSTYPE:
if (OSTypeFromString(iconBitmap->value, &type) == TCL_OK) {
- string = NSFileTypeForHFSTypeCode(type);
- image = [[NSWorkspace sharedWorkspace] iconForFileType:string];
+ string = [NSString stringWithUTF8String:iconBitmap->value];
+ image = TkMacOSXIconForFileType(string);
}
break;
case ICON_SYSTEMTYPE:
@@ -312,11 +311,15 @@ TkpGetNativeAppBitmap(
*height = size.height;
pixmap = PixmapFromImage(display, image, NSSizeToCGSize(size));
} else if (name) {
+ /*
+ * As a last resort, try to interpret the name as an OSType.
+ * It would probably be better to just return None at this
+ * point.
+ */
OSType iconType;
if (OSTypeFromString(name, &iconType) == TCL_OK) {
- NSString *iconUTI = OSTYPE_TO_UTI(iconType);
- NSImage *iconImage = [[NSWorkspace sharedWorkspace]
- iconForFileType: iconUTI];
+ NSString *iconUTI = TkMacOSXOSTypeToUTI(iconType);
+ NSImage *iconImage = TkMacOSXIconForFileType(iconUTI);
pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size));
}
}
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 3951683..39e443e 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -31,6 +31,7 @@ static SystemColorDatum **systemColorIndex;
static NSAppearance *lightAqua = nil;
static NSAppearance *darkAqua = nil;
#endif
+
static NSColorSpace* sRGB = NULL;
static const CGFloat WINDOWBACKGROUND[4] =
{236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0};
@@ -299,7 +300,7 @@ GetRGBA(
/*
* Prior to OSX 10.14, getComponents returns black when applied to
- * windowBackGroundColor.
+ * windowBackgroundColor.
*/
if ([NSApp macOSVersion] < 101400) {
@@ -417,6 +418,7 @@ SetCGColorComponents(
if (entry->type == HIBrush) {
OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c);
+ [pool drain];
return err == noErr;
}
GetRGBA(entry, pixel, rgba);
@@ -456,7 +458,7 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
if (view) {
name = [[view effectiveAppearance] name];
} else {
- name = [[NSAppearance currentAppearance] name];
+ name = [[NSApp effectiveAppearance] name];
}
return (name == NSAppearanceNameDarkAqua);
}
@@ -630,11 +632,9 @@ TkpGetColor(
Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap;
NSView *view = nil;
static Bool initialized = NO;
- static NSColorSpace* sRGB = nil;
if (!initialized) {
initialized = YES;
- sRGB = [NSColorSpace sRGBColorSpace];
initColorTable();
}
if (tkwin) {
@@ -662,19 +662,30 @@ TkpGetColor(
CGFloat rgba[4];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (@available(macOS 10.14, *)) {
- NSAppearance *savedAppearance = [NSAppearance currentAppearance];
- NSAppearance *windowAppearance = savedAppearance;
+ NSAppearance *windowAppearance;
if (view) {
windowAppearance = [view effectiveAppearance];
+ } else {
+ windowAppearance = [NSApp effectiveAppearance];
}
if ([windowAppearance name] == NSAppearanceNameDarkAqua) {
colormap = darkColormap;
} else {
colormap = lightColormap;
}
- [NSAppearance setCurrentAppearance:windowAppearance];
- GetRGBA(entry, p.ulong, rgba);
- [NSAppearance setCurrentAppearance:savedAppearance];
+ if (@available(macOS 11.0, *)) {
+ CGFloat *rgbaPtr = rgba;
+ [windowAppearance performAsCurrentDrawingAppearance:^{
+ GetRGBA(entry, p.ulong, rgbaPtr);
+ }];
+ } else {
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 110000
+ NSAppearance *savedAppearance = [NSAppearance currentAppearance];
+ [NSAppearance setCurrentAppearance:windowAppearance];
+ GetRGBA(entry, p.ulong, rgba);
+ [NSAppearance setCurrentAppearance:savedAppearance];
+#endif
+ }
} else {
GetRGBA(entry, p.ulong, rgba);
}
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index f850fbb..8af298b 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -6,7 +6,8 @@
* Copyright (c) 1996-1997 Sun Microsystems, Inc.
* Copyright (c) 2001-2009, Apple Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright (c) 2017 Christian Gollwitzer.
+ * Copyright (c) 2017 Christian Gollwitzer
+ * Copyright (c) 2022 Marc Culler
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -26,6 +27,30 @@
#define modalOther -1 // indicates that the -command option was used.
#define modalError -2
+static void setAllowedFileTypes(
+ NSSavePanel *panel,
+ NSMutableArray *extensions)
+{
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
+/* UTType exists in the SDK */
+ if (@available(macOS 11.0, *)) {
+ NSMutableArray<UTType *> *allowedTypes = [NSMutableArray array];
+ for (NSString *ext in extensions) {
+ UTType *uttype = [UTType typeWithFilenameExtension: ext];
+ [allowedTypes addObject:uttype];
+ }
+ [panel setAllowedContentTypes:allowedTypes];
+ } else {
+# if MAC_OS_X_VERSION_MIN_REQUIRED < 110000
+/* setAllowedFileTypes is not deprecated */
+ [panel setAllowedFileTypes:extensions];
+#endif
+ }
+#else
+ [panel setAllowedFileTypes:extensions];
+#endif
+}
+
/*
* Vars for filtering in "open file" and "save file" dialogs.
*/
@@ -93,7 +118,7 @@ static const char *const chooseOptionStrings[] = {
};
enum chooseOptions {
CHOOSE_INITDIR, CHOOSE_MESSAGE, CHOOSE_MUSTEXIST, CHOOSE_PARENT,
- CHOOSE_TITLE, CHOOSE_COMMAND,
+ CHOOSE_TITLE, CHOOSE_COMMAND
};
typedef struct {
Tcl_Interp *interp;
@@ -107,7 +132,7 @@ static const char *const alertOptionStrings[] = {
};
enum alertOptions {
ALERT_DEFAULT, ALERT_DETAIL, ALERT_ICON, ALERT_MESSAGE, ALERT_PARENT,
- ALERT_TITLE, ALERT_TYPE, ALERT_COMMAND,
+ ALERT_TITLE, ALERT_TYPE, ALERT_COMMAND
};
typedef struct {
Tcl_Interp *interp;
@@ -302,11 +327,11 @@ getFileURL(
* any file.
*/
- [openpanel setAllowedFileTypes:nil];
+ setAllowedFileTypes(openpanel, nil);
} else {
NSMutableArray *allowedtypes =
[filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex];
- [openpanel setAllowedFileTypes:allowedtypes];
+ setAllowedFileTypes(openpanel, allowedtypes);
[openpanel setAllowsOtherFileTypes:NO];
}
@@ -319,11 +344,11 @@ getFileURL(
if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) {
[savepanel setAllowsOtherFileTypes:YES];
- [savepanel setAllowedFileTypes:nil];
+ setAllowedFileTypes(savepanel, nil);
} else {
NSMutableArray *allowedtypes =
[filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex];
- [savepanel setAllowedFileTypes:allowedtypes];
+ setAllowedFileTypes(savepanel, allowedtypes);
[savepanel setAllowsOtherFileTypes:NO];
}
@@ -461,7 +486,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 +558,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 +576,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 +629,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 +720,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 +751,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];
@@ -801,9 +828,9 @@ Tk_GetOpenFileObjCmd(
[openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]];
*/
- [openpanel setAllowedFileTypes:filterInfo.allowedExtensions];
+ setAllowedFileTypes(openpanel, filterInfo.allowedExtensions);
} else {
- [openpanel setAllowedFileTypes:filterInfo.allowedExtensions];
+ setAllowedFileTypes(openpanel, filterInfo.allowedExtensions);
}
if (filterInfo.allowedExtensionsAllowAll) {
[openpanel setAllowsOtherFileTypes:YES];
@@ -960,10 +987,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 +1000,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 +1026,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];
@@ -1072,7 +1101,8 @@ Tk_GetSaveFileObjCmd(
[savepanel setAccessoryView:accessoryView];
- [savepanel setAllowedFileTypes:[filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]];
+ setAllowedFileTypes(savepanel,
+ [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]);
[savepanel setAllowsOtherFileTypes:filterInfo.allowedExtensionsAllowAll];
} else if (defaultType) {
/*
@@ -1084,7 +1114,7 @@ Tk_GetSaveFileObjCmd(
NSMutableArray *AllowedFileTypes = [NSMutableArray array];
[AllowedFileTypes addObject:defaultType];
- [savepanel setAllowedFileTypes:AllowedFileTypes];
+ setAllowedFileTypes(savepanel, AllowedFileTypes);
[savepanel setAllowsOtherFileTypes:YES];
}
@@ -1198,13 +1228,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 +1254,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 +1419,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 +1434,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 +1451,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/tkMacOSXFileTypes.c b/macosx/tkMacOSXFileTypes.c
new file mode 100644
index 0000000..c89328d
--- /dev/null
+++ b/macosx/tkMacOSXFileTypes.c
@@ -0,0 +1,112 @@
+/*
+There are situations where a graphical user interface needs to know the file
+type (i.e. data format) of a file. The two main ones are when generating an
+icon to represent a file, and when filtering the choice of files in a file
+open or save dialog.
+
+Early Macintosh systems used OSTypes as identifiers for file types. An OSType
+is a FourCC datatype - four bytes which can be packed into a 32 bit integer. In
+the HFS filesystem they were included in the file metadata. The metadata also
+included another OSType (the Creator Code) which identified the application
+which created the file.
+
+In OSX 10.4 the Uniform Type Identifier was introduced as an alternative way to
+describe file types. These are strings (NSStrings, actually) in a reverse DNS
+format, such as "com.apple.application-bundle". Apple provided a tool for
+converting OSType codes to Uniform Type Identifiers, which they deprecated in
+macOS 12.0 after introducing the UTType class in macOS 11.0. An instance of the
+UTType class has properties which give the Uniform Type Identifier as well as
+the preferred file name extension for a given file type.
+
+This module provides tools for working with file types which are meant to abstract
+the many variants that Apple has used over the years, and which can be used
+without generating deprecation warnings.
+*/
+
+#include "tkMacOSXPrivate.h"
+#include "tkMacOSXFileTypes.h"
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
+#endif
+
+#define CHARS_TO_OSTYPE(string) (OSType) string[0] << 24 | \
+ (OSType) string[1] << 16 | \
+ (OSType) string[2] << 8 | \
+ (OSType) string[3]
+
+static BOOL initialized = false;
+static Tcl_HashTable ostype2identifier;
+static void initOSTypeTable(void) {
+ int newPtr;
+ Tcl_HashEntry *hPtr;
+ const IdentifierForOSType *entry;
+ Tcl_InitHashTable(&ostype2identifier, TCL_ONE_WORD_KEYS);
+ for (entry = OSTypeDB; entry->ostype != NULL; entry++) {
+ const char *key = INT2PTR(CHARS_TO_OSTYPE(entry->ostype));
+ hPtr = Tcl_CreateHashEntry(&ostype2identifier, key, &newPtr);
+ if (newPtr) {
+ Tcl_SetHashValue(hPtr, entry->identifier);
+ }
+ }
+ initialized = true;
+}
+
+MODULE_SCOPE NSString *TkMacOSXOSTypeToUTI(OSType ostype) {
+ if (!initialized) {
+ initOSTypeTable();
+ }
+ Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&ostype2identifier, INT2PTR(ostype));
+ if (hPtr) {
+ char *UTI = Tcl_GetHashValue(hPtr);
+ return [[NSString alloc] initWithCString:UTI
+ encoding:NSASCIIStringEncoding];
+ }
+ return nil;
+}
+
+/*
+ * The NSWorkspace method iconForFileType, which was deprecated in macOS 12.0, would
+ * accept an NSString which could be an encoding of an OSType, or a file extension,
+ * or a Uniform Type Idenfier. This function can serve as a replacement.
+ */
+
+MODULE_SCOPE NSImage *TkMacOSXIconForFileType(NSString *filetype) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
+ if (!initialized) {
+ initOSTypeTable();
+ }
+ if (@available(macOS 11.0, *)) {
+ UTType *uttype = [UTType typeWithIdentifier: filetype];
+ if (![uttype isDeclared]) {
+ uttype = [UTType typeWithFilenameExtension: filetype];
+ }
+ if (![uttype isDeclared] && [filetype length] == 4) {
+ OSType ostype = CHARS_TO_OSTYPE(filetype.UTF8String);
+ NSString *UTI = TkMacOSXOSTypeToUTI(ostype);
+ uttype = [UTType typeWithIdentifier:UTI];
+ }
+ if (![uttype isDeclared]) {
+ return nil;
+ }
+ return [[NSWorkspace sharedWorkspace] iconForContentType:uttype];
+ } else {
+/* Despite Apple's claims, @available does not prevent deprecation warnings. */
+# if MAC_OS_X_VERSION_MIN_REQUIRED < 110000
+ return [[NSWorkspace sharedWorkspace] iconForFileType:filetype];
+#else
+ return nil; /* Never executed. */
+#endif
+ }
+#else /* @available is not available. */
+ return [[NSWorkspace sharedWorkspace] iconForFileType:filetype];
+#endif
+}
+
+/*
+ * Local Variables:
+ * mode: objc
+ * c-basic-offset: 4
+ * fill-column: 79
+ * coding: utf-8
+ * End:
+ */
diff --git a/macosx/tkMacOSXFileTypes.h b/macosx/tkMacOSXFileTypes.h
new file mode 100644
index 0000000..1c11d29
--- /dev/null
+++ b/macosx/tkMacOSXFileTypes.h
@@ -0,0 +1,144 @@
+/*
+Apple never published a database of OSType codes for File Types. However,
+a database of known OSType codes representing Creators and File Types used on
+Apple systems prior to 2003 is available at:
+
+ http://www.lacikam.co.il/tcdb/download/TCDBdata.zip
+
+Among the 12034 distinct OSType codes for File Types that are listed in the TCDB
+database, there are 121 for which the UTTypeCreatePreferredIdentifierForTag
+function (deprecated in macOS 12.0) was able to generate a Uniform Type
+Identifier on macOS 12.5.1. The mapping from those OSTypes to Uniform Type
+identifiers is given by the following array, in which OSTypes are represented as
+strings of length 4.
+*/
+
+typedef struct {
+ char *ostype;
+ char *identifier;
+} IdentifierForOSType;
+
+static const IdentifierForOSType OSTypeDB[] = {
+ {".SGI", "com.sgi.sgi-image"},
+ {".WAV", "com.microsoft.waveform-audio"},
+ {"8BPS", "com.adobe.photoshop-image"},
+ {"ABPR", "com.apple.addressbook.person"},
+ {"AIFC", "public.aifc-audio"},
+ {"AIFF", "public.aiff-audio"},
+ {"APPC", "com.apple.deprecated-application-file"},
+ {"APPD", "com.apple.deprecated-application-file"},
+ {"APPL", "com.apple.application-bundle"},
+ {"ASF_", "com.microsoft.advanced-systems-format"},
+ {"ASX_", "com.microsoft.advanced-stream-redirector"},
+ {"BMP ", "com.microsoft.bmp"},
+ {"BMPf", "com.microsoft.bmp"},
+ {"BNDL", "com.apple.generic-bundle"},
+ {"DDim", "com.apple.disk-image-raw"},
+ {"DICM", "org.nema.dicom"},
+ {"DOTM", "org.openxmlformats.wordprocessingml.template.macro-enabled"},
+ {"EM3F", "com.apple.logic-song"},
+ {"EPSF", "com.adobe.encapsulated-postscript"},
+ {"FFIL", "com.apple.font-suitcase"},
+ {"FLI ", "public.flc-animation"},
+ {"FNDR", "com.apple.legacy.finder-icon"},
+ {"GIFf", "com.compuserve.gif"},
+ {"HTML", "public.html"},
+ {"JPEG", "public.jpeg"},
+ {"LWFN", "com.adobe.postscript-lwfn-font"},
+ {"MP3 ", "public.mp3"},
+ {"MP3!", "public.mp3"},
+ {"MP3U", "com.apple.tv.m3u-playlist"},
+ {"MPEG", "public.mpeg"},
+ {"MPG ", "public.mpeg"},
+ {"MPG2", "com.apple.music.mp2"},
+ {"MPG3", "public.mp3"},
+ {"Midi", "public.midi-audio"},
+ {"MooV", "com.apple.quicktime-movie"},
+ {"Mp3 ", "public.mp3"},
+ {"PAT ", "org.gimp.pat"},
+ {"PDF ", "com.adobe.pdf"},
+ {"PICT", "com.apple.pict"},
+ {"PNGf", "public.png"},
+ {"PNRA", "com.real.realaudio"},
+ {"PNRM", "com.real.realmedia"},
+ {"PNTG", "com.apple.macpaint-image"},
+ {"PPOT", "com.microsoft.powerpoint.pot"},
+ {"PPSS", "com.microsoft.powerpoint.pps"},
+ {"RTF ", "public.rtf"},
+ {"SDP ", "public.sdp"},
+ {"SIT5", "com.stuffit.archive.sit"},
+ {"SLD8", "com.microsoft.powerpoint.ppt"},
+ {"Sd2f", "com.digidesign.sd2-audio"},
+ {"TEXT", "com.apple.traditional-mac-plain-text"},
+ {"TIFF", "public.tiff"},
+ {"TPIC", "com.truevision.tga-image"},
+ {"ULAW", "public.ulaw-audio"},
+ {"VfW ", "public.avi"},
+ {"W8BN", "com.microsoft.word.doc"},
+ {"W8TN", "com.microsoft.word.dot"},
+ {"WAVE", "com.microsoft.waveform-audio"},
+ {"XLA5", "com.microsoft.excel.xla"},
+ {"XLS8", "com.microsoft.excel.xls"},
+ {"XLW8", "com.microsoft.excel.xlw"},
+ {"alis", "com.apple.alias-record"},
+ {"appe", "com.apple.deprecated-application-file"},
+ {"cdev", "com.apple.deprecated-application-file"},
+ {"clpp", "com.apple.finder.pictclipping"},
+ {"clps", "com.apple.finder.sound-clipping"},
+ {"clpt", "com.apple.finder.textclipping"},
+ {"clpu", "com.apple.finder.clipping"},
+ {"ctrl", "com.apple.legacy.finder-icon"},
+ {"dfil", "com.apple.deprecated-application-file"},
+ {"dict", "com.apple.document-type.dictionary"},
+ {"disk", "public.volume"},
+ {"docs", "com.apple.documents-folder"},
+ {"dvc!", "public.dv-movie"},
+ {"ffil", "com.apple.font-suitcase"},
+ {"flpy", "com.apple.storage-removable"},
+ {"fold", "public.folder"},
+ {"font", "com.apple.legacy.finder-icon"},
+ {"grup", "com.apple.user-group"},
+ {"hdrv", "com.apple.disk-image-raw"},
+ {"hdsk", "com.apple.storage-internal"},
+ {"help", "com.apple.help-document"},
+ {"hkdb", "com.apple.itunes.db"},
+ {"hvpl", "com.apple.music.visual"},
+ {"ilaf", "com.apple.afp-internet-location"},
+ {"ilfi", "com.apple.file-internet-location"},
+ {"ilft", "com.apple.ftp-internet-location"},
+ {"ilge", "com.apple.generic-internet-location"},
+ {"ilht", "com.apple.web-internet-location"},
+ {"ilma", "com.apple.mail-internet-location"},
+ {"ilnw", "com.apple.news-internet-location"},
+ {"macD", "com.apple.legacy.finder-icon"},
+ {"mp3!", "public.mp3"},
+ {"mpg3", "public.mp3"},
+ {"note", "com.apple.alert-note"},
+ {"osas", "com.apple.applescript.script"},
+ {"plug", "com.apple.plugin"},
+ {"pref", "com.apple.legacy.finder-icon"},
+ {"prfb", "com.apple.icon-overlay.private-folder-badge"},
+ {"prof", "com.apple.colorsync-profile"},
+ {"qtif", "com.apple.quicktime-image"},
+ {"sLS8", "com.microsoft.excel.xlt"},
+ {"sM3F", "com.apple.logic-song"},
+ {"sbBF", "com.apple.finder.burn-folder"},
+ {"scrp", "com.apple.legacy.finder-icon"},
+ {"sdoc", "com.apple.generic-stationery"},
+ {"sfnt", "com.apple.font-suitcase"},
+ {"shlb", "com.apple.legacy.finder-icon"},
+ {"srvr", "com.apple.file-server"},
+ {"svg ", "public.svg-image"},
+ {"svgz", "public.svg-image"},
+ {"tDoc", "com.apple.documents-folder"},
+ {"tfil", "com.apple.font-suitcase"},
+ {"trsh", "com.apple.trash-empty"},
+ {"ttcf", "public.truetype-collection-font"},
+ {"ttro", "com.apple.traditional-mac-plain-text"},
+ {"txtn", "com.apple.txn.text-multimedia-data"},
+ {"url ", "public.url"},
+ {"user", "com.apple.user"},
+ {"utxt", "public.utf16-plain-text"},
+ {"vCrd", "public.vcard"},
+ {NULL, NULL}
+};
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index d9c1c01..b33de0a 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -4,9 +4,9 @@
* Contains the Macintosh implementation of the platform-independent font
* package interface.
*
- * Copyright 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
+ * Copyright (c) 2002-2004 Benjamin Riefenstahl, Benjamin.Riefenstahl@epost.de
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
- * Copyright 2008-2009, Apple Inc.
+ * Copyright (c) 2008-2009 Apple Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -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];
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index d9f3d12..a9b459a 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -45,8 +45,41 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
@synthesize needsToDraw = _needsToDraw;
@synthesize tkLiveResizeEnded = _tkLiveResizeEnded;
@synthesize tkPointerWindow = _tkPointerWindow;
+- (void) setTkPointerWindow: (TkWindow *)winPtr
+{
+ if (_tkPointerWindow) {
+ Tcl_Release(_tkPointerWindow);
+ }
+ if (winPtr) {
+ Tcl_Preserve(winPtr);
+ }
+ _tkPointerWindow = winPtr;
+ return;
+}
@synthesize tkEventTarget = _tkEventTarget;
+- (void) setTkEventTarget: (TkWindow *)winPtr
+{
+ if (_tkEventTarget) {
+ Tcl_Release(_tkEventTarget);
+ }
+ if (winPtr) {
+ Tcl_Preserve(winPtr);
+ }
+ _tkEventTarget = winPtr;
+ return;
+}
@synthesize tkDragTarget = _tkDragTarget;
+- (void) setTkDragTarget: (TkWindow *)winPtr
+{
+ if (_tkDragTarget) {
+ Tcl_Release(_tkDragTarget);
+ }
+ if (winPtr) {
+ Tcl_Preserve(winPtr);
+ }
+ _tkDragTarget = winPtr;
+ return;
+}
@synthesize tkButtonState = _tkButtonState;
@end
@@ -415,7 +448,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) {
@@ -476,7 +509,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 cc3ab7f..b690d9d 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -3,8 +3,8 @@
*
* This module implements the Mac-platform specific features of menus.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
+ * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright (c) 2001-2009 Apple Inc.
* Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
* Copyright (c) 2012 Adrian Robert.
*
@@ -94,7 +94,7 @@ static const struct {
static int gNoTkMenus = 0; /* This is used by Tk_MacOSXTurnOffMenus as
* the flag that Tk is not to draw any
* menus. */
-static int inPostMenu = 0;
+static Bool inPostMenu = true;
static SInt32 menuMarkColumnWidth = 0, menuIconTrailingEdgeMargin = 0;
static SInt32 menuTextLeadingEdgeMargin = 0, menuTextTrailingEdgeMargin = 0;
static SInt16 menuItemExtraHeight = 0, menuItemExtraWidth = 0;
@@ -124,7 +124,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
@@ -200,25 +200,36 @@ TKBackgroundLoop *backgroundLoop = nil;
* Spanish keyboard both the ' and the ` keys are dead keys used to place
* accents over letters. But ⌘` is a standard KeyEquivalent which cycles
* through the open windows of an application, changing the focus to the next
- * window.
- *
- * The performKeyEquivalent callback method is being overridden here to work
- * around a bug reported in [1626ed65b8]. When a dead key that is also as a
- * KeyEquivalent is pressed, a KeyDown event with no characters is passed to
- * performKeyEquivalent. The default implementation provided by Apple will
- * cause that event to be routed to some private methods of NSMenu which raise
- * NSInvalidArgumentException, causing an abort. Returning NO in such a case
- * prevents the abort, but does not prevent the KeyEquivalent action from being
- * invoked, presumably because the event does get correctly handled higher in
- * the responder chain.
+ * window. This caused a bug reported in [1626ed65b8]. When a dead key that is
+ * also as a KeyEquivalent is pressed, a KeyDown event with no characters would
+ * be passed to performKeyEquivalent. The default implementation provided by
+ * Apple would cause that event to be routed to some private methods of NSMenu
+ * which raise NSInvalidArgumentException, causing an abort. Returning NO in
+ * such a case prevents the abort. So the override below returns NO when the
+ * event has no characters.
+ *
+ * In fact, however, we never want to handle accelerators because they are
+ * handled by Tk. Hence this method could always return NO. But if we did
+ * that then we would not see the menu flash when an accelerator is pressed.
+ * The flash is a useful visual indicator. It turns out that the flash is an
+ * undocumented side effect of calling the super method for
+ * performKeyEquivalent. The super method also calls the NSMenuItem's action
+ * method - tkMenuItemInvoke in our case. This is also not documented.
+ *
+ * To enable the flash we set up a flag that tells the action method to do
+ * nothing, because it is being called by an accelerator. The override below
+ * sets the flag and then calls super. See ticket [ead70921a9].
*/
+static Bool runMenuCommand = true;
- (BOOL)performKeyEquivalent:(NSEvent *)event
{
- if (event.characters.length == 0) {
+ if ([[event characters] length] == 0) {
return NO;
}
- return [super performKeyEquivalent:event];
+ runMenuCommand = false;
+ /* Make the menu flash and call tkMenuItemInvoke. */
+ return [super performKeyEquivalent: event];
}
@end
@@ -239,8 +250,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];
@@ -332,11 +343,19 @@ TKBackgroundLoop *backgroundLoop = nil;
- (void) tkMenuItemInvoke: (id) sender
{
+ if (!runMenuCommand) {
+
+ /*
+ * We are being called for a menu accelerator. Tk will handle it.
+ * Just update the runMenuCommand flag.
+ */
+
+ runMenuCommand = true;
+ return;
+ }
+
/*
- * With the delegate matching key equivalents, when a menu action is sent
- * in response to a key equivalent, the sender is the whole menu and not the
- * specific menu item. We use this to ignore key equivalents for Tk
- * menus (as Tk handles them directly via bindings).
+ * We are being called for an actual menu item selection; run the command.
*/
if ([sender isKindOfClass:[NSMenuItem class]]) {
@@ -736,14 +755,9 @@ TkpConfigureMenuEntry(
[menuItem setImage:image];
if ((!image || mePtr->compound != COMPOUND_NONE) && mePtr->labelPtr &&
mePtr->labelLength) {
- Tcl_DString ds;
- Tcl_DStringInit(&ds);
- Tcl_UtfToUniCharDString(Tcl_GetString(mePtr->labelPtr),
- mePtr->labelLength, &ds);
- title = [[NSString alloc]
- initWithCharacters:(unichar *)Tcl_DStringValue(&ds)
- length:Tcl_DStringLength(&ds)>>1];
- Tcl_DStringFree(&ds);
+ title = [[TKNSString alloc]
+ initWithTclUtfBytes:Tcl_GetString(mePtr->labelPtr)
+ length:mePtr->labelLength];
if ([title hasSuffix:@"..."]) {
title = [NSString stringWithFormat:@"%@%C",
[title substringToIndex:[title length] - 3], 0x2026];
@@ -814,7 +828,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())
*/
@@ -943,10 +957,10 @@ TkpPostMenu(
NSMenuItem *item = nil;
NSPoint location = NSMakePoint(x, TkMacOSXZeroScreenHeight() - y);
- inPostMenu = 1;
+ inPostMenu = true;
result = TkPreprocessMenu(menuPtr);
if (result != TCL_OK) {
- inPostMenu = 0;
+ inPostMenu = false;
return result;
}
if (itemIndex >= numItems) {
@@ -968,7 +982,7 @@ TkpPostMenu(
[menu popUpMenuPositioningItem:item
atLocation:[win tkConvertPointFromScreen:location]
inView:view];
- inPostMenu = 0;
+ inPostMenu = false;
return TCL_OK;
}
@@ -1314,7 +1328,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];
}
}
@@ -1324,7 +1338,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 fd9bbc1..e33f787 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -133,6 +133,7 @@ enum {
buttonState &= ~TkGetButtonMask(button);
break;
case NSLeftMouseDragged:
+ buttonState |= TkGetButtonMask(button);
if (![NSApp tkDragTarget]) {
if (isOutside) {
ignoreDrags = YES;
@@ -248,7 +249,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.
*/
@@ -404,7 +405,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. */
@@ -500,7 +500,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) {
@@ -818,7 +818,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 208d846..3cb6c48 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -341,7 +341,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/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 3b03139..bc6b49c 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -28,6 +28,9 @@
#import <ApplicationServices/ApplicationServices.h>
#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
+#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
+#endif
#ifndef NO_CARBON_H
#import <Carbon/Carbon.h>
#endif
@@ -294,7 +297,9 @@ MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view,
MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin);
MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData);
MODULE_SCOPE unsigned long TkMacOSXClearPixel(void);
-
+MODULE_SCOPE NSString* TkMacOSXOSTypeToUTI(OSType ostype);
+MODULE_SCOPE NSImage* TkMacOSXIconForFileType(NSString *filetype);
+
#pragma mark Private Objective-C Classes
#define VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
@@ -351,9 +356,9 @@ VISIBILITY_HIDDEN
* Persistent state variables used by processMouseEvent.
*/
-@property TkWindow *tkPointerWindow;
-@property TkWindow *tkEventTarget;
-@property TkWindow *tkDragTarget;
+@property(nonatomic) TkWindow *tkPointerWindow;
+@property(nonatomic) TkWindow *tkEventTarget;
+@property(nonatomic) TkWindow *tkDragTarget;
@property unsigned int tkButtonState;
@end
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index dbae21e..5d61981 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 ec19ec5..a4a6aa8 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 5769369..a806729 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 f8561bf..b72c5a7 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -6,7 +6,7 @@
* the "wm" command and passes geometry information to the window manager.
*
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright 2001-2009, Apple Inc.
+ * Copyright (c) 2001-2009, Apple Inc.
* Copyright (c) 2006-2009 Daniel A. Steffen <das@users.sourceforge.net>
* Copyright (c) 2010 Kevin Walzer/WordTech Communications LLC.
* Copyright (c) 2017-2019 Marc Culler.
@@ -2596,7 +2596,7 @@ WmIconphotoCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Image tk_icon;
- int width, height, isDefault = 0;
+ int width, height;
NSImage *newIcon = NULL;
if (objc < 4) {
@@ -2610,7 +2610,6 @@ WmIconphotoCmd(
*/
if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) {
- isDefault = 1;
if (objc == 4) {
Tcl_WrongNumArgs(interp, 2, objv,
"window ?-default? image1 ?image2 ...?");
@@ -5420,7 +5419,7 @@ TkSetWMName(
return;
}
- NSString *title = [[NSString alloc] initWithUTF8String:titleUid];
+ NSString *title = [[TKNSString alloc] initWithTclUtfBytes:titleUid length:-1];
[TkMacOSXGetNSWindowForDrawable(winPtr->window) setTitle:title];
[title release];
}
@@ -5968,7 +5967,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".
*
@@ -6034,9 +6033,9 @@ WmWinAppearance(
if (objc == 4) {
int index;
if (Tcl_GetIndexFromObjStruct(interp, objv[3], appearanceStrings,
- sizeof(char *), "appearancename", 0, &index) != TCL_OK) {
- return TCL_ERROR;
- }
+ sizeof(char *), "appearancename", 0, &index) != TCL_OK) {
+ return TCL_ERROR;
+ }
switch ((enum appearances) index) {
case APPEARANCE_AQUA:
win.appearance = [NSAppearance appearanceNamed:
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index ddaa226..38e6fa3 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -236,7 +236,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/ttk/treeview.test b/tests/ttk/treeview.test
index 6a1964b..6059a6f 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -923,4 +923,27 @@ 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}
+
tcltest::cleanupTests
diff --git a/unix/Makefile.in b/unix/Makefile.in
index ce17f6d..3b3fa69 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -396,15 +396,14 @@ X11_OBJS = tkUnix.o tkUnix3d.o tkUnixButton.o tkUnixColor.o tkUnixConfig.o \
AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \
tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \
tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \
- tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \
- tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \
- tkMacOSXMenu.o \
- tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \
- tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \
- tkMacOSXServices.o tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \
- tkMacOSXWm.o tkMacOSXXStubs.o \
- tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \
- xcolors.o xdraw.o xgc.o ximage.o xutil.o \
+ tkMacOSXEvent.o tkMacOSXFileTypes.o tkMacOSXFont.o tkMacOSXHLEvents.o \
+ tkMacOSXImage.o tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \
+ tkMacOSXMenu.o tkMacOSXMenubutton.o tkMacOSXMenus.o \
+ tkMacOSXMouseEvent.o tkMacOSXNotify.o tkMacOSXRegion.o \
+ tkMacOSXScrlbr.o tkMacOSXSend.o tkMacOSXServices.o \
+ tkMacOSXSubwindows.o tkMacOSXWindowEvent.o tkMacOSXWm.o \
+ tkMacOSXXStubs.o tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o \
+ tkUnixScale.o xcolors.o xdraw.o xgc.o ximage.o xutil.o \
ttkMacOSXTheme.o
AQUA_TKTEST_OBJS = tkMacOSXTest.o
@@ -521,8 +520,8 @@ AQUA_SRCS = \
$(MAC_OSX_DIR)/tkMacOSXDebug.c $(MAC_OSX_DIR)/tkMacOSXDialog.c \
$(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \
$(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \
- $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \
- $(MAC_OSX_DIR)/tkMacOSXImage.c \
+ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXFileTypes.c\
+ $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(MAC_OSX_DIR)/tkMacOSXImage.c \
$(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \
$(MAC_OSX_DIR)/tkMacOSXKeyEvent.c \
$(MAC_OSX_DIR)/tkMacOSXMenu.c \
@@ -1275,6 +1274,9 @@ tkMacOSXEntry.o: $(MAC_OSX_DIR)/tkMacOSXEntry.c
tkMacOSXEvent.o: $(MAC_OSX_DIR)/tkMacOSXEvent.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEvent.c
+tkMacOSXFileTypes.o: $(MAC_OSX_DIR)/tkMacOSXFileTypes.c
+ $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFileTypes.c
+
tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFont.c
diff --git a/unix/configure b/unix/configure
index 035c1f8..a1eea6f 100755
--- a/unix/configure
+++ b/unix/configure
@@ -9437,6 +9437,9 @@ cat >>confdefs.h <<\_ACEOF
_ACEOF
LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore"
+ if test -d "/System/Library/Frameworks/UniformTypeIdentifiers.framework"; then
+ LIBS="$LIBS -framework UniformTypeIdentifiers"
+ fi
EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c'
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
diff --git a/unix/configure.in b/unix/configure.in
index 6805020..b483ce0 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -352,6 +352,9 @@ fi
if test $tk_aqua = yes; then
AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?])
LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore"
+ if test -d "/System/Library/Frameworks/UniformTypeIdentifiers.framework"; then
+ LIBS="$LIBS -framework UniformTypeIdentifiers"
+ fi
EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c'
TK_WINDOWINGSYSTEM=AQUA
if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then
diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c
index afe443f..a149610 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/tkWinDialog.c b/win/tkWinDialog.c
index 176ba88..da13e48 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1900,7 +1900,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.
@@ -2779,7 +2779,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 9495f7d..80bdc75 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -131,7 +131,7 @@ typedef struct {
} ICONDIR, *LPICONDIR;
/*
- * 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: