Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch monterey_deprecations Excluding Merge-Ins
This is equivalent to a diff from 743531bb to 99699362
2022-09-20
| ||
03:22 | Fix [33de843084]: deprecations introduced in macOS 12. Now Tk builds on Monterey with only the scrollRect deprecation warning. check-in: eaf45e87 user: marc_culler tags: core-8-6-branch | |
2022-09-17
| ||
00:46 | merge monterey_deprecations check-in: aec9ed04 user: marc_culler tags: chavez_cgimage_drawing | |
00:18 | Replace [NSApp currentAppearance] by [NSApp effectiveAppearance], now that I know it exists. Closed-Leaf check-in: 99699362 user: marc_culler tags: monterey_deprecations | |
2022-09-15
| ||
15:19 | Add missing [pool drain]. check-in: 9379364a user: marc_culler tags: monterey_deprecations | |
2022-09-14
| ||
15:31 | Fix [d412a99152]: Aqua: Unexpected <ButtonRelease> and <Enter> events check-in: 929ba2d9 user: marc_culler tags: core-8-6-branch | |
2022-09-13
| ||
04:11 | Fix [ead70921a9]: menu accelerators can be triggered on Aqua without bindings. check-in: 3e4a7b6e user: marc_culler tags: bug-ead70921a9 | |
2022-09-12
| ||
18:19 | Fix [d412a99152]: unexpected <Enter> and <Button1-Release> events. Closed-Leaf check-in: e851e6e4 user: marc_culler tags: bug-d412a99152 | |
05:13 | Merge 8.6 check-in: e81d87c3 user: marc_culler tags: monterey_deprecations | |
2022-09-11
| ||
20:30 | merge 8.6 check-in: 5f135c79 user: dgp tags: core-8-6-13-rc | |
2022-09-10
| ||
21:11 | Merge 8.6 check-in: 848dab73 user: jan.nijtmans tags: trunk, main | |
21:10 | Fix [006403a25d]: various comment/documentation fixes check-in: 743531bb user: jan.nijtmans tags: core-8-6-branch | |
2022-09-08
| ||
10:39 | Fix [c5c3d882cc]: Need to set fill colors in goldberg.tcl check-in: d674b099 user: jan.nijtmans tags: core-8-6-branch | |
Changes to macosx/tkMacOSXBitmap.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" /* * This structure holds information about native bitmaps. */ typedef struct { const char *name; /* Name of icon. */ OSType iconType; /* OSType of icon. */ | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkMacOSXConstants.h" /* * This structure holds information about native bitmaps. */ typedef struct { const char *name; /* Name of icon. */ OSType iconType; /* OSType of icon. */ |
︙ | ︙ | |||
170 171 172 173 174 175 176 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { | | | < | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { NSString *filetype = [NSString stringWithUTF8String:(char *)source]; NSImage *iconImage = TkMacOSXIconForFileType(filetype); CGSize size = CGSizeMake(builtInIconSize, builtInIconSize); Pixmap pixmap = PixmapFromImage(display, iconImage, size); return pixmap; } /* |
︙ | ︙ | |||
249 250 251 252 253 254 255 | int *height) { Tcl_HashEntry *hPtr; Pixmap pixmap = None; NSString *string; NSImage *image = nil; NSSize size = { .width = builtInIconSize, .height = builtInIconSize }; | < | | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | int *height) { Tcl_HashEntry *hPtr; Pixmap pixmap = None; NSString *string; NSImage *image = nil; NSSize size = { .width = builtInIconSize, .height = builtInIconSize }; if (iconBitmapTable.buckets && (hPtr = Tcl_FindHashEntry(&iconBitmapTable, name))) { OSType type; IconBitmap *iconBitmap = (IconBitmap *)Tcl_GetHashValue(hPtr); name = NULL; size = NSMakeSize(iconBitmap->width, iconBitmap->height); switch (iconBitmap->kind) { case ICON_FILE: string = [[NSString stringWithUTF8String:iconBitmap->value] stringByExpandingTildeInPath]; image = [[NSWorkspace sharedWorkspace] iconForFile:string]; break; case ICON_FILETYPE: string = [NSString stringWithUTF8String:iconBitmap->value]; image = TkMacOSXIconForFileType(string); break; case ICON_OSTYPE: if (OSTypeFromString(iconBitmap->value, &type) == TCL_OK) { string = [NSString stringWithUTF8String:iconBitmap->value]; image = TkMacOSXIconForFileType(string); } break; case ICON_SYSTEMTYPE: name = iconBitmap->value; break; case ICON_NAMEDIMAGE: string = [NSString stringWithUTF8String:iconBitmap->value]; |
︙ | ︙ | |||
308 309 310 311 312 313 314 315 316 | } } if (image) { *width = size.width; *height = size.height; pixmap = PixmapFromImage(display, image, NSSizeToCGSize(size)); } else if (name) { OSType iconType; if (OSTypeFromString(name, &iconType) == TCL_OK) { | > > > > > | | < | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | } } if (image) { *width = size.width; *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 = TkMacOSXOSTypeToUTI(iconType); NSImage *iconImage = TkMacOSXIconForFileType(iconUTI); pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size)); } } return pixmap; } /* |
︙ | ︙ |
Changes to macosx/tkMacOSXColor.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | static int pressedButtonTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 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}; void initColorTable() { NSAutoreleasePool *pool = [NSAutoreleasePool new]; | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | static int pressedButtonTextIndex; static Bool useFakeAccentColor = NO; static SystemColorDatum **systemColorIndex; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 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}; void initColorTable() { NSAutoreleasePool *pool = [NSAutoreleasePool new]; |
︙ | ︙ | |||
413 414 415 416 417 418 419 420 421 422 423 424 425 426 | * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (entry->type == HIBrush) { OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c); return err == noErr; } GetRGBA(entry, pixel, rgba); *c = CGColorCreate(sRGB.CGColorSpace, rgba); [pool drain]; return true; } | > | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (entry->type == HIBrush) { OSStatus err = ChkErr(HIThemeBrushCreateCGColor, entry->value, c); [pool drain]; return err == noErr; } GetRGBA(entry, pixel, rgba); *c = CGColorCreate(sRGB.CGColorSpace, rgba); [pool drain]; return true; } |
︙ | ︙ | |||
452 453 454 455 456 457 458 | NSView *view = nil; if (winPtr && winPtr->privatePtr) { view = TkMacOSXGetNSViewForDrawable((Drawable)winPtr->privatePtr); } if (view) { name = [[view effectiveAppearance] name]; } else { | | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | NSView *view = nil; if (winPtr && winPtr->privatePtr) { view = TkMacOSXGetNSViewForDrawable((Drawable)winPtr->privatePtr); } if (view) { name = [[view effectiveAppearance] name]; } else { name = [[NSApp effectiveAppearance] name]; } return (name == NSAppearanceNameDarkAqua); } #endif return false; } |
︙ | ︙ | |||
626 627 628 629 630 631 632 | { Display *display = NULL; TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; NSView *view = nil; static Bool initialized = NO; | < < | 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | { Display *display = NULL; TkColor *tkColPtr; XColor color; Colormap colormap = tkwin ? Tk_Colormap(tkwin) : noColormap; NSView *view = nil; static Bool initialized = NO; if (!initialized) { initialized = YES; initColorTable(); } if (tkwin) { display = Tk_Display(tkwin); Drawable d = Tk_WindowId(tkwin); view = TkMacOSXGetNSViewForDrawable(d); } |
︙ | ︙ | |||
658 659 660 661 662 663 664 | p.pixel.colortype = entry->type; p.pixel.value = entry->index; color.pixel = p.ulong; if (entry->type == semantic) { CGFloat rgba[4]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { | < | > > > > > > > > > > | | | > > | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | p.pixel.colortype = entry->type; p.pixel.value = entry->index; color.pixel = p.ulong; if (entry->type == semantic) { CGFloat rgba[4]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { NSAppearance *windowAppearance; if (view) { windowAppearance = [view effectiveAppearance]; } else { windowAppearance = [NSApp effectiveAppearance]; } if ([windowAppearance name] == NSAppearanceNameDarkAqua) { colormap = darkColormap; } else { colormap = lightColormap; } 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); } #else GetRGBA(entry, p.ulong, rgba); #endif color.red = rgba[0] * 65535.0; |
︙ | ︙ |
Changes to macosx/tkMacOSXDialog.c.
1 2 3 4 5 6 7 8 | /* * tkMacOSXDialog.c -- * * Contains the Mac implementation of the common dialog boxes. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright (c) 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> | | > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /* * tkMacOSXDialog.c -- * * Contains the Mac implementation of the common dialog boxes. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * Copyright (c) 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * 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. */ #include "tkMacOSXPrivate.h" #include "tkFileFilter.h" #include "tkMacOSXConstants.h" #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #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. */ typedef struct { bool doFileTypes; /* Show the accessory view which |
︙ | ︙ | |||
298 299 300 301 302 303 304 | /* * setAllowsOtherFileTypes might have no effect; it's inherited from * the NSSavePanel, where it has the effect that it does not append an * extension. Setting the allowed file types to nil allows selecting * any file. */ | | | | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | /* * setAllowsOtherFileTypes might have no effect; it's inherited from * the NSSavePanel, where it has the effect that it does not append an * extension. Setting the allowed file types to nil allows selecting * any file. */ setAllowedFileTypes(openpanel, nil); } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; setAllowedFileTypes(openpanel, allowedtypes); [openpanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } - (void)saveFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [savepanel setAllowsOtherFileTypes:YES]; setAllowedFileTypes(savepanel, nil); } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; setAllowedFileTypes(savepanel, allowedtypes); [savepanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } @end |
︙ | ︙ | |||
799 800 801 802 803 804 805 | /* * On OSX > 10.11, the options are not visible by default. Ergo * allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ | | | | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | /* * On OSX > 10.11, the options are not visible by default. Ergo * allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ setAllowedFileTypes(openpanel, filterInfo.allowedExtensions); } else { setAllowedFileTypes(openpanel, filterInfo.allowedExtensions); } if (filterInfo.allowedExtensionsAllowAll) { [openpanel setAllowsOtherFileTypes:YES]; } else { [openpanel setAllowsOtherFileTypes:NO]; } [openpanel setAccessoryView:accessoryView]; |
︙ | ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | [popupButton setTarget:NSApp]; [popupButton setAction:@selector(saveFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; [savepanel setAccessoryView:accessoryView]; | > | | | 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 | [popupButton setTarget:NSApp]; [popupButton setAction:@selector(saveFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; [savepanel setAccessoryView:accessoryView]; setAllowedFileTypes(savepanel, [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]); [savepanel setAllowsOtherFileTypes:filterInfo.allowedExtensionsAllowAll]; } else if (defaultType) { /* * If no filetypes are given, defaultextension is an alternative way to * specify the attached extension. Just propose this extension, but * don't display an accessory view. */ NSMutableArray *AllowedFileTypes = [NSMutableArray array]; [AllowedFileTypes addObject:defaultType]; setAllowedFileTypes(savepanel, AllowedFileTypes); [savepanel setAllowsOtherFileTypes:YES]; } [savepanel setCanSelectHiddenExtension:YES]; [savepanel setExtensionHidden:NO]; if (cmdObj) { |
︙ | ︙ |
Added macosx/tkMacOSXFileTypes.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | /* 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: */ |
Added macosx/tkMacOSXFileTypes.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 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} }; |
Changes to macosx/tkMacOSXPrivate.h.
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #define instancetype id #endif #define TextStyle MacTextStyle #import <ApplicationServices/ApplicationServices.h> #import <Cocoa/Cocoa.h> #import <QuartzCore/QuartzCore.h> #ifndef NO_CARBON_H #import <Carbon/Carbon.h> #endif #undef TextStyle #import <objc/runtime.h> /* for sel_isEqual() */ #ifndef _TKMACINT | > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #define instancetype id #endif #define TextStyle MacTextStyle #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 #undef TextStyle #import <objc/runtime.h> /* for sel_isEqual() */ #ifndef _TKMACINT |
︙ | ︙ | |||
290 291 292 293 294 295 296 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE unsigned TkMacOSXAddVirtual(unsigned int keycode); MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view, NSRect *bounds); MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); MODULE_SCOPE void TkMacOSXDrawAllViews(ClientData clientData); MODULE_SCOPE unsigned long TkMacOSXClearPixel(void); | > > | | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE unsigned TkMacOSXAddVirtual(unsigned int keycode); MODULE_SCOPE void TkMacOSXWinNSBounds(TkWindow *winPtr, NSView *view, NSRect *bounds); 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"))) enum { tkMainMenu = 1, tkApplicationMenu, tkWindowsMenu, tkHelpMenu}; VISIBILITY_HIDDEN |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.c.
︙ | ︙ | |||
2592 2593 2594 2595 2596 2597 2598 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Image tk_icon; | | < | 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Image tk_icon; int width, height; NSImage *newIcon = NULL; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } /* * Parse args. */ if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) { if (objc == 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } } |
︙ | ︙ |
Changes to unix/Makefile.in.
︙ | ︙ | |||
392 393 394 395 396 397 398 | tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \ tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixWm.o tkUnixXId.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 \ | | | | | | | < | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | tkUnixFocus.o $(FONT_OBJS) tkUnixInit.o tkUnixKey.o tkUnixMenu.o \ tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixWm.o tkUnixXId.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 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 OBJS = $(GENERIC_OBJS) $(WIDG_OBJS) $(CANV_OBJS) $(IMAGE_OBJS) $(TEXT_OBJS) \ $(STUB_OBJS) $(TTK_OBJS) \ $(@TK_WINDOWINGSYSTEM@_OBJS) @PLAT_OBJS@ |
︙ | ︙ | |||
517 518 519 520 521 522 523 | AQUA_SRCS = \ $(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \ $(MAC_OSX_DIR)/tkMacOSXClipboard.c $(MAC_OSX_DIR)/tkMacOSXColor.c \ $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(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 \ | | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | AQUA_SRCS = \ $(MAC_OSX_DIR)/tkMacOSXBitmap.c $(MAC_OSX_DIR)/tkMacOSXButton.c \ $(MAC_OSX_DIR)/tkMacOSXClipboard.c $(MAC_OSX_DIR)/tkMacOSXColor.c \ $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(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)/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 \ $(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \ $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \ $(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \ $(MAC_OSX_DIR)/tkMacOSXServices.c \ |
︙ | ︙ | |||
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | tkMacOSXEntry.o: $(MAC_OSX_DIR)/tkMacOSXEntry.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEntry.c tkMacOSXEvent.o: $(MAC_OSX_DIR)/tkMacOSXEvent.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXEvent.c tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXFont.c tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c | > > > | 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | tkMacOSXEntry.o: $(MAC_OSX_DIR)/tkMacOSXEntry.c $(CC) -c $(CC_SWITCHES) $(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 tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c tkMacOSXImage.o: $(MAC_OSX_DIR)/tkMacOSXImage.c |
︙ | ︙ |
Changes to unix/configure.
︙ | ︙ | |||
9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 | if test $tk_aqua = yes; then cat >>confdefs.h <<\_ACEOF #define MAC_OSX_TK 1 _ACEOF LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit -framework QuartzCore" EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then cat >>confdefs.h <<\_ACEOF #define TK_MAC_DEBUG 1 _ACEOF | > > > | 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 | if test $tk_aqua = yes; then cat >>confdefs.h <<\_ACEOF #define MAC_OSX_TK 1 _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 cat >>confdefs.h <<\_ACEOF #define TK_MAC_DEBUG 1 _ACEOF |
︙ | ︙ |
Changes to unix/configure.in.
︙ | ︙ | |||
348 349 350 351 352 353 354 355 356 357 358 359 360 361 | else tk_aqua=no 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" EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) fi else #-------------------------------------------------------------------- | > > > | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | else tk_aqua=no 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 AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) fi else #-------------------------------------------------------------------- |
︙ | ︙ |