diff options
author | das <das> | 2007-06-09 17:09:39 (GMT) |
---|---|---|
committer | das <das> | 2007-06-09 17:09:39 (GMT) |
commit | 00da9d704110e07f22779330047d0b99406dd2ce (patch) | |
tree | f359d2dd182768b18f13b4636ebdc5c225ffa0f8 /macosx/tkMacOSXInit.c | |
parent | a700737d94005b30448cf6028feee89c787ed748 (diff) | |
download | tk-00da9d704110e07f22779330047d0b99406dd2ce.zip tk-00da9d704110e07f22779330047d0b99406dd2ce.tar.gz tk-00da9d704110e07f22779330047d0b99406dd2ce.tar.bz2 |
* macosx/tkMacOSXColor.c: fix issues with TK_{IF,ELSE,ENDIF} macros;
* macosx/tkMacOSXDraw.c: implement Jaguar equivalent of unavailable
* macosx/tkMacOSXEntry.c: kHIToolboxVersion global; panic at startup
* macosx/tkMacOSXEvent.c: if MAC_OS_X_VERSION_MIN_REQUIRED constraint
* macosx/tkMacOSXInit.c: is not satisfied.
* macosx/tkMacOSXInt.h:
* macosx/tkMacOSXWm.c:
* macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage)
(TkMacOSXSetupDrawingContext): factor out common code and standardize
setup/restore of port, context and clipping; formatting cleanup.
* macosx/tkMacOSXWindowEvent.c: add error checking.
* macosx/tkMacOSXMenu.c: fix gcc3 warning.
* macosx/tkMacOSXScrlbr.c: fix testsuite crash.
* macosx/tkMacOSXSubwindows.c: formatting cleanup.
* macosx/tkMacOSXRegion.c: fix typos.
* macosx/tkMacOSXScale.c:
* macosx/tkMacOSXXStubs.c (Tk_GetUserInactiveTime): remove superfluous
CFRetain/CFRelease.
* macosx/Wish-Release.xcconfig: disable tktest release build stripping.
* macosx/Wish.xcodeproj/project.pbxproj: add new Tclsh-Info.plist.in.
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r-- | macosx/tkMacOSXInit.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index f1990bd..8fdbe9f 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXInit.c,v 1.30 2007/06/06 09:55:52 das Exp $ + * RCS: @(#) $Id: tkMacOSXInit.c,v 1.31 2007/06/09 17:09:40 das Exp $ */ #include "tkMacOSXInt.h" @@ -19,6 +19,7 @@ #include "tclInt.h" /* for Tcl_GetStartupScript() & Tcl_SetStartupScript() */ #include <sys/stat.h> +#include <sys/utsname.h> #include <mach-o/dyld.h> #include <mach-o/getsect.h> @@ -93,6 +94,8 @@ Tcl_Encoding TkMacOSXCarbonEncoding = NULL; */ static char scriptPath[PATH_MAX + 1] = ""; +float tkMacOSXToolboxVersionNumber = 0; + /* *---------------------------------------------------------------------- @@ -117,7 +120,7 @@ TkpInit( Tcl_Interp *interp) { static char tkLibPath[PATH_MAX + 1]; - static int tkMacOSXInitialized = 0; + static int initialized = 0; Tk_MacOSXSetupTkNotifier(); @@ -127,15 +130,44 @@ TkpInit( * we protect against doing it more than once. */ - if (!tkMacOSXInitialized) { + if (!initialized) { int bundledExecutable = 0; CFBundleRef bundleRef; CFURLRef bundleUrl = NULL; CFStringEncoding encoding; const char *encodingStr = NULL; int i; + struct utsname name; + long osVersion = 0; - tkMacOSXInitialized = 1; + initialized = 1; + + /* + * Initialize/check OS version variable for runtime checks. + */ + + if (!uname(&name)) { + osVersion = strtol(name.release, NULL, 10) - 4; + } + if (osVersion && osVersion < (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10) { + Tcl_Panic("Mac OS X 10.%d or later required !", + (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10); + } + TK_IF_MAC_OS_X_API (3, &kHIToolboxVersionNumber, + tkMacOSXToolboxVersionNumber = kHIToolboxVersionNumber; + ) TK_ELSE_MAC_OS_X (3, + if (osVersion > 5) { + tkMacOSXToolboxVersionNumber = INFINITY; + } else if (osVersion >= 3) { + static const float tbVersions[3] = { + kHIToolboxVersionNumber10_3, + kHIToolboxVersionNumber10_4, + kHIToolboxVersionNumber10_5, + }; + + tkMacOSXToolboxVersionNumber = tbVersions[osVersion-3]; + } + ) TK_ENDIF /* * When Tk is in a framework, force tcl_findLibrary to look in the @@ -258,7 +290,7 @@ TkpInit( TK_IF_MAC_OS_X_API (3, TransformProcessType, err = ChkErr(TransformProcessType, &psn, kProcessTransformToForegroundApplication); - ) TK_ENDIF_MAC_OS_X + ) TK_ENDIF #if MAC_OSX_TK_USE_CPS_SPI if (err != noErr) { /* |