diff options
-rw-r--r-- | macosx/README | 39 | ||||
-rw-r--r-- | macosx/Wish-Info.plist.in | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXDialog.c | 51 | ||||
-rw-r--r-- | macosx/tkMacOSXEvent.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXInit.c | 18 | ||||
-rw-r--r-- | macosx/tkMacOSXMenu.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXNotify.c | 6 | ||||
-rw-r--r-- | macosx/tkMacOSXPrivate.h | 21 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 17 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 40 |
10 files changed, 24 insertions, 176 deletions
diff --git a/macosx/README b/macosx/README index c796396..cea3847 100644 --- a/macosx/README +++ b/macosx/README @@ -32,7 +32,7 @@ available as an optional or default install on recent macOS). TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem]. - At a minimum, macOS 10.3 is required to run Tcl and TkX11. -TkAqua requires macOS 10.5 or later (starting with the Cocoa-based Tk 8.5.7). +TkAqua requires macOS 10.6 or later. - Unless weak-linking is used, Tcl/Tk built on macOS 10.x will not run on 10.y with y < x; on the other hand Tcl/Tk built on 10.y will always run on 10.x @@ -62,8 +62,7 @@ the Resources/Scripts directory of the framework. - [load]able binary extensions can linked as either ordinary shared libraries (.dylib) or as MachO bundles (since 8.4.10/8.5a3); bundles have the advantage that they are [load]ed more efficiently from a tcl VFS (no temporary copy to the -native filesystem required), and prior to macOS 10.5, only bundles can be -[unload]ed. +native filesystem required). - The 'deploy' target of macosx/GNUmakefile installs the html manpages into the standard documentation location in the Tcl/Tk frameworks: @@ -215,11 +214,6 @@ purple #800080 brown #996633 clear systemTransparent -- The Cocoa-based TkAqua can be distinguished from the older Carbon-based -version via the [winfo server .] command, example output on macOS 10.5.7: - Cocoa-based: CG409.3 Apple AppKit GC 949.46 macOS 1057 - Carbon-based: QD10R30 Apple 1057 - - If you want to use Remote Debugging with Xcode, you need to set the environment variable XCNOSTDIN to 1 in the Executable editor for Wish. That will cause us to force closing stdin & stdout. Otherwise, given how Xcode launches @@ -229,13 +223,12 @@ Wish remotely, they will be left open and then Wish & gdb will fight for stdin. 3. Building Tcl/Tk on macOS ------------------------------ -- At least macOS 10.3 is required to build Tcl and TkX11, and macOS 10.5 -is required to build TkAqua. -Apple's Xcode Developer Tools need to be installed (only the most recent version -matching your OS release is supported), the Xcode installer is available on Mac -OS X install media or may be present in /Applications/Installers on Macs that -came with OS X preinstalled. The most recent version can always be downloaded -from the ADC website http://connect.apple.com (free ADC membership required). +- At least macOS 10.3 is required to build Tcl and TkX11, and macOS 10.6 +is required to build TkAqua. The XCode application provides everything +needed to build Tk, but it is not necessary to install the full XCode. +It suffices to install the Command Line Tools package, which can be done +by running the command: +xcode-selecct --install - Tcl/Tk are most easily built as macOS frameworks via GNUmakefile in tcl/macosx and tk/macosx (see below for details), but can also be built with the @@ -247,8 +240,9 @@ The macOS specific configure flags are --enable-aqua, --enable-framework and select based notifier). Note that --enable-aqua is incompatible with --disable-corefoundation (for both Tcl and Tk configure). -- It is also possible to build with the Xcode IDE via the projects in -tk/macosx, take care to use the project matching your DevTools and OS version: +- It was once possible to build with the Xcode IDE via the projects in +tk/macosx, but this has not been tested recently. Take care to use the +project matching your DevTools and OS version: Tk.xcode: for Xcode 3.1 on 10.5 Tk.xcodeproj: for Xcode 3.2 on 10.6 These have the following targets: @@ -303,9 +297,9 @@ above, they will be [load]able by universal as well as thin binaries of Tcl. - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable to the minimal OS version the binaries should be able to run on, e.g: - export MACOSX_DEPLOYMENT_TARGET=10.4 + export MACOSX_DEPLOYMENT_TARGET=10.6 This requires at least gcc 3.1; with gcc 4 or later, set/add to CFLAGS instead: - export CFLAGS="-mmacosx-version-min=10.4" + export CFLAGS="-mmacosx-version-min=10.6" Support for weak-linking was added with 8.4.14/8.5a5. Detailed Instructions for building with macosx/GNUmakefile @@ -458,9 +452,10 @@ In order to carry out the job of managing autorelease pools, which would normally be handled by the [NSApp run] method, a private NSAUtoreleasePool* property is added to the TkApplication subclass of NSApplication. The TkpInit function calls [NSApp _setup] which -initializes this property by creating an NSAutoreleasePool. A bit -later on, TkpInit calls [NSAPP _setupEventLoop] which in turn calls -the [NSApp finishLaunching] method. +initializes this property by creating an NSAutoreleasePool prior to +calling [NSApp finishLaunching]. This mimics the behavior of the +[NSApp run] method, which calls [NSApp finishLaunching] just before +starting the event loop. Since the CheckProc function gets called for every Tk event, it is an appropriate place to drain the main NSAutoreleasePool and replace it diff --git a/macosx/Wish-Info.plist.in b/macosx/Wish-Info.plist.in index db75cf2..d2fc388 100644 --- a/macosx/Wish-Info.plist.in +++ b/macosx/Wish-Info.plist.in @@ -69,7 +69,7 @@ <key>CFBundleVersion</key> <string>@TK_VERSION@@TK_PATCH_LEVEL@</string> <key>LSMinimumSystemVersion</key> - <string>10.5.0</string> + <string>10.6.0</string> <key>LSRequiresCarbon</key> <true/> <key>NSAppleScriptEnabled</key> diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 96b1e0b..b98d6d8 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -169,7 +169,6 @@ static const short alertNativeButtonIndexAndTypeToButtonIndex[][3] = { * Construct a file URL from directory and filename. Either may * be nil. If both are nil, returns nil. */ -#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050 static NSURL *getFileURL(NSString *directory, NSString *filename) { NSURL *url = nil; if (directory) { @@ -180,7 +179,6 @@ static NSURL *getFileURL(NSString *directory, NSString *filename) { } return url; } -#endif #pragma mark TKApplication(TKDialog) @@ -716,17 +714,7 @@ Tk_GetOpenFileObjCmd( callbackInfo->multiple = multiple; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { - parentIsKey = [parent isKeyWindow]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - [openpanel beginSheetForDirectory:directory - file:filename - types:openFileTypes - modalForWindow:parent - modalDelegate:NSApp - didEndSelector: - @selector(tkFilePanelDidEnd:returnCode:contextInfo:) - contextInfo:callbackInfo]; -#else + parentIsKey = [parent isKeyWindow]; if (directory || filename ) { NSURL * fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; @@ -737,20 +725,14 @@ Tk_GetOpenFileObjCmd( { [NSApp tkFilePanelDidEnd:openpanel returnCode:returnCode contextInfo:callbackInfo ]; } ]; -#endif modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:openpanel]; } else { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - modalReturnCode = [openpanel runModalForDirectory:directory - file:filename]; -#else if (directory || filename ) { NSURL * fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; } modalReturnCode = [openpanel runModal]; -#endif [NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode contextInfo:callbackInfo]; } @@ -1001,16 +983,7 @@ Tk_GetSaveFileObjCmd( parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - [savepanel beginSheetForDirectory:directory - file:filename - modalForWindow:parent - modalDelegate:NSApp - didEndSelector: - @selector(tkFilePanelDidEnd:returnCode:contextInfo:) - contextInfo:callbackInfo]; -#else - if (directory) { + if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } /*check for file name, otherwise set to empty string; crashes with uncaught exception if set to nil*/ @@ -1024,12 +997,8 @@ Tk_GetSaveFileObjCmd( { [NSApp tkFilePanelDidEnd:savepanel returnCode:returnCode contextInfo:callbackInfo ]; } ]; -#endif modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:savepanel]; } else { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - modalReturnCode = [savepanel runModalForDirectory:directory file:filename]; -#else if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } @@ -1040,7 +1009,6 @@ Tk_GetSaveFileObjCmd( [savepanel setNameFieldStringValue:@""]; } modalReturnCode = [savepanel runModal]; -#endif [NSApp tkFilePanelDidEnd:savepanel returnCode:modalReturnCode contextInfo:callbackInfo]; } @@ -1172,30 +1140,17 @@ Tk_ChooseDirectoryObjCmd( } parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { - parentIsKey = [parent isKeyWindow]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - [panel beginSheetForDirectory:directory - file:nil - modalForWindow:parent - modalDelegate:NSApp - didEndSelector: @selector(tkFilePanelDidEnd:returnCode:contextInfo:) - contextInfo:callbackInfo]; -#else + parentIsKey = [parent isKeyWindow]; [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; [panel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:panel returnCode:returnCode contextInfo:callbackInfo ]; } ]; -#endif modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:panel]; } else { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - modalReturnCode = [panel runModalForDirectory:directory file:nil]; -#else [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; modalReturnCode = [panel runModal]; -#endif [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode contextInfo:callbackInfo]; } diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index de57008..95e80a9 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -89,7 +89,6 @@ enum { } case NSCursorUpdate: break; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 case NSEventTypeGesture: case NSEventTypeMagnify: case NSEventTypeRotate: @@ -98,7 +97,6 @@ enum { case NSEventTypeEndGesture: break; #endif -#endif default: break; /* return theEvent */ diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 7b91f97..d2ae147 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -33,22 +33,11 @@ long tkMacOSXMacOSXVersion = 0; #pragma mark TKApplication(TKInit) -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -#define NSTextInputContextKeyboardSelectionDidChangeNotification @"NSTextInputContextKeyboardSelectionDidChangeNotification" -static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) { - [[NSNotificationCenter defaultCenter] postNotificationName:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil userInfo:nil]; -} -#endif - @interface TKApplication(TKKeyboard) - (void) keyboardChanged: (NSNotification *) notification; @end -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 #define TKApplication_NSApplicationDelegate <NSApplicationDelegate> -#else -#define TKApplication_NSApplicationDelegate -#endif @interface TKApplication(TKWindowEvent) TKApplication_NSApplicationDelegate - (void) _setupWindowNotifications; @end @@ -106,9 +95,6 @@ static void keyboardChanged(CFNotificationCenterRef center, void *observer, CFSt observe(NSApplicationDidChangeScreenParametersNotification, displayChanged:); observe(NSTextInputContextKeyboardSelectionDidChangeNotification, keyboardChanged:); #undef observe -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), NULL, &keyboardChanged, kTISNotifySelectedKeyboardInputSourceChanged, NULL, CFNotificationSuspensionBehaviorCoalesce); -#endif } -(void)applicationWillFinishLaunching:(NSNotification *)aNotification @@ -273,8 +259,8 @@ TkpInit( * Initialize/check OS version variable for runtime checks. */ -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -# error Mac OS X 10.5 required +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# error Mac OS X 10.6 required #endif if (!uname(&name)) { diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index d21cd11..2101977 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -117,11 +117,7 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) insertItem: (NSMenuItem *) newItem atTkIndex: (NSInteger) index; @end -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 #define TKMenu_NSMenuDelegate <NSMenuDelegate> -#else -#define TKMenu_NSMenuDelegate -#endif @interface TKMenu(TKMenuDelegate) TKMenu_NSMenuDelegate @end diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index ac0c0ec..fad61b4 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -276,15 +276,9 @@ TkMacOSXEventsCheckProc( inMode:GetRunLoopMode(modalSession) dequeue:NO]; /* We must not steal any events during LiveResize. */ - #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 if (testEvent && [[testEvent window] inLiveResize]) { break; } - #else - if (testEvent && [[[testEvent window] contentView] inLiveResize]) { - break; - } - #endif currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(modalSession) diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index ee7d5b3..730ccaa 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -59,27 +59,6 @@ if (0) { #define tk_else_mac_os_x_no(...) \ } else { __VA_ARGS__ -/* Private mapping macros defined according to Mac OS X version requirements */ -/* 10.5 Leopard */ -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 -#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_yes -#define tk_else_mac_os_x_min_10_5 tk_else_mac_os_x_yes -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 -#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_yes -#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_yes -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ -#else /* MAC_OS_X_VERSION_MIN_REQUIRED */ -#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_chk -#define tk_else_mac_os_x_min_10_5 tk_else_mac_os_x_chk -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 -#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_chk -#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_chk -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */ -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 -#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_no -#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_no -#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */ /* * Macros for DEBUG_ASSERT_MESSAGE et al from Debugging.h. diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 34245b1..4ed5d8c 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -42,11 +42,6 @@ static void DoWindowActivate(ClientData clientData); extern NSString *NSWindowWillOrderOnScreenNotification; extern NSString *NSWindowDidOrderOnScreenNotification; extern NSString *NSWindowDidOrderOffScreenNotification; - -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -#define NSWindowWillStartLiveResizeNotification @"NSWindowWillStartLiveResizeNotification" -#define NSWindowDidEndLiveResizeNotification @"NSWindowDidEndLiveResizeNotification" -#endif #endif extern BOOL opaqueTag; @@ -750,17 +745,7 @@ TkWmProtocolEventProc( int Tk_MacOSXIsAppInFront(void) { - Boolean isFrontProcess = true; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - ProcessSerialNumber frontPsn, ourPsn = {0, kCurrentProcess}; - - if (noErr == GetFrontProcess(&frontPsn)){ - SameProcess(&frontPsn, &ourPsn, &isFrontProcess); - } -#else - isFrontProcess = [NSRunningApplication currentApplication].active; -#endif - return (isFrontProcess == true); + return ([NSRunningApplication currentApplication].active == true); } #pragma mark TKContentView diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 23d3e1f..9f39e4c 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -365,18 +365,8 @@ static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); -#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 -#define TK_GOT_AT_LEAST_SNOW_LEOPARD 1 -#endif - #pragma mark TKWindow(TKWm) -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 -@interface NSWindow(TkWm) -- (void) setCanCycle: (BOOL) canCycleFlag; -@end -#endif - @interface NSDrawerWindow : NSWindow { id _i1, _i2; @@ -5685,11 +5675,7 @@ TkMacOSXMakeRealWindowExist( } if (opaqueTag) { -#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD [window setOpaque: opaqueTag]; -#else - [window setOpaque: YES]; -#endif } [window setDocumentEdited:NO]; @@ -6382,24 +6368,12 @@ ApplyWindowAttributeFlagChanges( } else if (newAttributes & tkMoveToActiveSpaceAttribute) { b |= NSWindowCollectionBehaviorMoveToActiveSpace; } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 if (newAttributes & kWindowDoesNotCycleAttribute) { b |= NSWindowCollectionBehaviorIgnoresCycle; } else { b |= NSWindowCollectionBehaviorParticipatesInCycle; } -#endif [macWindow setCollectionBehavior:b]; -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - if (((changedAttributes & kWindowDoesNotCycleAttribute) || initial) -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - && tkMacOSXMacOSXVersion < 1060 -#endif - ) { - [macWindow setCanCycle: - !(newAttributes & kWindowDoesNotCycleAttribute)]; - } -#endif } if ((wmPtr->flags & WM_TOPMOST) != (oldFlags & WM_TOPMOST)) { [macWindow setLevel:(wmPtr->flags & WM_TOPMOST) ? @@ -6531,9 +6505,7 @@ TkMacOSXMakeFullscreen( { WmInfo *wmPtr = winPtr->wmInfoPtr; int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN); -#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD static unsigned long prevMask = 0, prevPres = 0; -#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ if (fullscreen) { int screenWidth = WidthOfScreen(Tk_Screen(winPtr)); @@ -6574,28 +6546,16 @@ TkMacOSXMakeFullscreen( wmPtr->flags |= WM_FULLSCREEN; } -#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD - /* - * We can't set these features on Leopard or earlier, as they don't - * exist (neither options nor API that uses them). This formally means - * that there's a bug with full-screen windows with Tk on old OSX, but - * it isn't worth blocking a build just for this. - */ - prevMask = [window styleMask]; prevPres = [NSApp presentationOptions]; [window setStyleMask: NSBorderlessWindowMask]; [NSApp setPresentationOptions: NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar]; Tk_MapWindow((Tk_Window) winPtr); -#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } else { wmPtr->flags &= ~WM_FULLSCREEN; - -#ifdef TK_GOT_AT_LEAST_SNOW_LEOPARD [NSApp setPresentationOptions: prevPres]; [window setStyleMask: prevMask]; -#endif /*TK_GOT_AT_LEAST_SNOW_LEOPARD*/ } if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) { |