summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInit.c
diff options
context:
space:
mode:
authordas <das@noemail.net>2007-06-09 17:10:18 (GMT)
committerdas <das@noemail.net>2007-06-09 17:10:18 (GMT)
commit9498f015f8dc3ae9a18f27f4f7e8c34c86d74593 (patch)
treea3e94fad92980067b80074fd7b368d458bd1d229 /macosx/tkMacOSXInit.c
parent3ff35898db0c4bb319fda02323f3132c25086580 (diff)
downloadtk-9498f015f8dc3ae9a18f27f4f7e8c34c86d74593.zip
tk-9498f015f8dc3ae9a18f27f4f7e8c34c86d74593.tar.gz
tk-9498f015f8dc3ae9a18f27f4f7e8c34c86d74593.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: FossilOrigin-Name: 39cb2ed4eadbfc948f0d66b2b80a8dd4fb8b79cd
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r--macosx/tkMacOSXInit.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index e523582..4fa67c9 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.3.2.22 2007/06/06 09:56:54 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.3.2.23 2007/06/09 17:10:21 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -19,6 +19,7 @@
#include "tclInt.h" /* for Tcl{G,S}etStartupScriptFileName() */
#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) {
/*