summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/GNUmakefile3
-rw-r--r--macosx/README37
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj31
-rw-r--r--macosx/tkMacOSXEvent.h7
-rw-r--r--macosx/tkMacOSXFont.c110
-rw-r--r--macosx/tkMacOSXKeyEvent.c19
-rw-r--r--macosx/tkMacOSXMenu.c5
-rw-r--r--macosx/tkMacOSXMenubutton.c5
-rw-r--r--macosx/tkMacOSXMenus.c5
-rw-r--r--macosx/tkMacOSXMouseEvent.c5
-rw-r--r--macosx/tkMacOSXWm.c52
11 files changed, 159 insertions, 120 deletions
diff --git a/macosx/GNUmakefile b/macosx/GNUmakefile
index 123efd4..ce9d159 100644
--- a/macosx/GNUmakefile
+++ b/macosx/GNUmakefile
@@ -4,7 +4,7 @@
# uses the standard unix build system in tk/unix (which can be used directly instead of this
# if you are not using the tk/macosx projects).
#
-# RCS: @(#) $Id: GNUmakefile,v 1.4 2006/04/12 00:58:41 das Exp $
+# RCS: @(#) $Id: GNUmakefile,v 1.5 2006/07/20 06:25:18 das Exp $
#
########################################################################################################
@@ -117,6 +117,7 @@ export CPPROG := cp -p
ifeq (${TK_X11},)
override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-aqua
else
+override CONFIGURE_ARGS := ${CONFIGURE_ARGS} --enable-xft
VERSION := ${VERSION}-X11
wish := ${wish}-X11
endif
diff --git a/macosx/README b/macosx/README
index 15b9a12..511ece3 100644
--- a/macosx/README
+++ b/macosx/README
@@ -1,7 +1,7 @@
Tcl/Tk Mac OS X README
----------------------
-RCS: @(#) $Id: README,v 1.17 2006/04/11 10:19:51 das Exp $
+RCS: @(#) $Id: README,v 1.18 2006/07/20 06:25:19 das Exp $
This is the README file for the Mac OS X/Darwin version of Tcl/Tk.
@@ -43,9 +43,12 @@ TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem].
required to run TkAqua. However OS X 10.3 or higher is recommended (certain
[file] operations behave incorrectly on earlier releases).
-- Tcl/Tk built on Mac OS X 10.x will not run on 10.y for y < x, on the other
-hand Tcl/Tk built on 10.y will run on 10.x for y < x (but without any of the
-fixes and optimizations that would be available in a binary built on 10.x).
+- Unless weak-linking is used, Tcl/Tk built on Mac OS X 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
+with y <= x (but without any of the fixes and optimizations that would be
+available in a binary built on 10.x).
+Weak-linking is available on OS X 10.2 or later, it additionally allows Tcl/Tk
+built on 10.x to run on any 10.y with x > y >= z (for a chosen z >= 2).
- Wish checks the Resources/Scripts directory in its application bundle for a
file called AppMain.tcl, if found it is used as the startup script and the
@@ -158,11 +161,10 @@ tcl/macosx and tk/macosx (see below for details), but can also be built with the
standard unix configure and make buildsystem in tcl/unix resp. tk/unix as on any
other unix platform (indeed, the Makefiles are just wrappers around the unix
buildsystem).
-The Mac OS X specifc configure flags are --enable-aqua, --enable-framework and
+The Mac OS X specific configure flags are --enable-aqua, --enable-framework and
--disable-corefoundation (which disables CF and notably reverts to the standard
-select based notifier, you will only need this if your require use of naked fork
-(i.e. not followed by execve) in an unthreaded core). Note that --enable-aqua is
-incompatible with --disable-corefoundation (for both Tcl and Tk configure).
+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 Apple's IDE via the projects in tk/macosx,
take care to only use the project matching your DevTools and OS version:
@@ -199,7 +201,7 @@ Notes about the native targets of the Xcode projects:
export CFLAGS="-arch ppc -arch i386 \
-isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4"
This requires Mac OS X 10.4 and Xcode 2.2 (_not_ Xcode 2.1) and will work on
-any of the architectures (on i386 DTKs, the -isysroot is not required).
+any of the architectures (on intel Macs, the -isysroot is not required).
Note that it is not possible to configure correctly if the current architecture
is not present in CFLAGS (i.e. -arch `arch` must always be there).
Universal builds of Tk TEA extensions are also possible with CFLAGS set as
@@ -209,7 +211,18 @@ TkX11 can be built with -arch ppc64 as the corresponding GUI libraries are not
available for 64bit at present. However, linking a universal 'ppc i386' Tk
binary against a universal 'ppc ppc64 i386' Tcl binary works just fine.
The Tk configure script automatically removes '-arch ppc64' from CFLAGS to
-facilitate universal building of both Tcl and Tk with the same CFLAGS setting.
+facilitate universal building of both Tcl and Tk with the same CFLAGS setting;
+the same happens with configure in Tk extensions based on TEA 3.5 or later.
+
+- To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable
+to the minimal OS version (>= 10.2) the binaries should be able to run on, e.g:
+ export MACOSX_DEPLOYMENT_TARGET=10.2
+This requires Mac OS X 10.2 and gcc 3.1; if you have gcc 4 or later you can set
+CFLAGS instead:
+ export CFLAGS="-mmacosx-version-min=10.2"
+The Wish.xcodeproj is setup to produce binaires that can run on 10.2 or later,
+except for the 'ReleaseUniversal'configuration, where they require 10.4.
+Support for weak-linking was added to the code for 8.4.14/8.5a5.
Detailed Instructions for building with macosx/Makefile
-------------------------------------------------------
@@ -250,8 +263,8 @@ instead by passing an INSTALL_ROOT argument to make:
- The default Makefile targets will build _both_ debug and optimized versions of
the Tcl and Tk frameworks with the standard convention of naming the debug
library Tcl.framework/Tcl_debug resp. Tk.framework/Tk_debug.
-This allows you to dynamically link to the debug libraries at runtime by setting
- setenv DYLD_IMAGE_SUFFIX _debug
+This allows switching to the debug libraries at runtime by setting
+ export DYLD_IMAGE_SUFFIX=_debug
(c.f. man dyld for more details)
If you only want to build and install the debug or optimized build, use the
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
index 1cf376e..1e0e2bd 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -3354,7 +3354,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
+ shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring tcl\"\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n";
};
F9A5C5F608F651AB008AE941 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -3373,7 +3373,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
- shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
+ shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.in -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-/usr/bin/autoconf} && ${AUTOHEADER:-/usr/bin/autoheader}\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring tk\"\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi";
};
/* End PBXShellScriptBuildPhase section */
@@ -3708,7 +3708,6 @@
INCLUDEDIR = "${PREFIX}/include";
INSTALL_PATH = "${BINDIR}";
LIBDIR = "${PREFIX}/lib";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
MANDIR = "${PREFIX}/man";
OTHER_CFLAGS = (
"-imacros",
@@ -3740,6 +3739,9 @@
WARNING_CFLAGS = (
"-Wall",
"-Wno-implicit-int",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ "-Wno-missing-field-initializers",
);
ZERO_LINK = NO;
};
@@ -3751,6 +3753,7 @@
CFLAGS = "-arch ppc -arch i386 -isysroot ${SDKROOT} -mmacosx-version-min=10.4";
CONFIGURE_ARGS = "--disable-symbols";
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
+ MACOSX_DEPLOYMENT_TARGET = 10.4;
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
};
name = ReleaseUniversal;
@@ -3842,7 +3845,6 @@
INCLUDEDIR = "${PREFIX}/include";
INSTALL_PATH = "${BINDIR}";
LIBDIR = "${PREFIX}/lib";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
MANDIR = "${PREFIX}/man";
OTHER_CFLAGS = (
"-imacros",
@@ -3874,6 +3876,9 @@
WARNING_CFLAGS = (
"-Wall",
"-Wno-implicit-int",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ "-Wno-missing-field-initializers",
);
ZERO_LINK = YES;
};
@@ -3911,7 +3916,6 @@
INCLUDEDIR = "${PREFIX}/include";
INSTALL_PATH = "${BINDIR}";
LIBDIR = "${PREFIX}/lib";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
MANDIR = "${PREFIX}/man";
OTHER_CFLAGS = (
"-imacros",
@@ -3943,6 +3947,9 @@
WARNING_CFLAGS = (
"-Wall",
"-Wno-implicit-int",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ "-Wno-missing-field-initializers",
);
ZERO_LINK = NO;
};
@@ -3981,7 +3988,6 @@
INCLUDEDIR = "${PREFIX}/include";
INSTALL_PATH = "${BINDIR}";
LIBDIR = "${PREFIX}/lib";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
MANDIR = "${PREFIX}/man";
OTHER_CFLAGS = (
"-imacros",
@@ -4013,6 +4019,9 @@
WARNING_CFLAGS = (
"-Wall",
"-Wno-implicit-int",
+ "-Wextra",
+ "-Wno-unused-parameter",
+ "-Wno-missing-field-initializers",
);
ZERO_LINK = NO;
};
@@ -4022,7 +4031,11 @@
isa = XCBuildConfiguration;
buildSettings = {
CONFIGURE_ARGS = "--enable-symbols";
- GCC_PREPROCESSOR_DEFINITIONS = "__private_extern__=extern";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "__private_extern__=extern",
+ "DEBUG_ASSERT_PRODUCTION_CODE=0",
+ );
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
};
name = Debug;
};
@@ -4031,6 +4044,7 @@
buildSettings = {
CONFIGURE_ARGS = "--disable-symbols";
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
};
name = Release;
};
@@ -4038,7 +4052,8 @@
isa = XCBuildConfiguration;
buildSettings = {
CONFIGURE_ARGS = "--enable-symbols";
- GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_PREPROCESSOR_DEFINITIONS = "DEBUG_ASSERT_PRODUCTION_CODE=0";
+ MACOSX_DEPLOYMENT_TARGET = 10.2;
};
name = DebugNoFixZL;
};
diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h
index 00f1963..9c5f583 100644
--- a/macosx/tkMacOSXEvent.h
+++ b/macosx/tkMacOSXEvent.h
@@ -50,7 +50,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.10 2006/04/28 06:02:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.h,v 1.11 2006/07/20 06:25:19 das Exp $
*/
#ifndef _TKMACEVENT
@@ -100,10 +100,9 @@ MODULE_SCOPE int TkMacOSXKeycodeToUnicode(
MODULE_SCOPE OSStatus TkMacOSXStartTclEventLoopCarbonTimer();
MODULE_SCOPE OSStatus TkMacOSXStopTclEventLoopCarbonTimer();
-#if !defined(MAC_OS_X_VERSION_10_3) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
/* Define constants only available on Mac OS X 10.3 or later */
-enum { kEventAppAvailableWindowBoundsChanged = 110 };
+#define kEventAppAvailableWindowBoundsChanged 110
#endif
#endif
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 403a903..280e649 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -35,7 +35,7 @@
* that such fonts can not be used for controls, because controls
* definitely require a family id (this assertion needs testing).
*
- * RCS: @(#) $Id: tkMacOSXFont.c,v 1.18 2006/05/16 07:58:09 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.19 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -690,7 +690,7 @@ TkpMeasureCharsInContext(
* also something we like to decide for ourself.
*/
- while ((offset > urstart) && (uchars[offset-1] == ' ')) {
+ while ((offset > (UniCharArrayOffset)urstart) && (uchars[offset-1] == ' ')) {
offset--;
}
@@ -708,8 +708,8 @@ TkpMeasureCharsInContext(
* forward.
*/
- if ((offset == urstart) || (uchars[offset] != ' ')) {
- while ((offset < urend)
+ if ((offset == (UniCharArrayOffset)urstart) || (uchars[offset] != ' ')) {
+ while ((offset < (UniCharArrayOffset)urend)
&& (uchars[offset] != ' ')) {
offset++;
}
@@ -721,12 +721,12 @@ TkpMeasureCharsInContext(
* backward.
*/
- if ((offset != urend) && (uchars[offset] != ' ')) {
- while ((offset > urstart)
+ if ((offset != (UniCharArrayOffset)urend) && (uchars[offset] != ' ')) {
+ while ((offset > (UniCharArrayOffset)urstart)
&& (uchars[offset-1] != ' ')) {
offset--;
}
- while ((offset > urstart)
+ while ((offset > (UniCharArrayOffset)urstart)
&& (uchars[offset-1] == ' ')) {
offset--;
}
@@ -735,7 +735,7 @@ TkpMeasureCharsInContext(
}
}
- if (offset > urend) {
+ if (offset > (UniCharArrayOffset)urend) {
offset = urend;
}
@@ -747,14 +747,14 @@ TkpMeasureCharsInContext(
if ((err != kATSULineBreakInWord)
&& !(flags & TK_WHOLE_WORDS)
- && (offset <= urend)) {
+ && (offset <= (UniCharArrayOffset)urend)) {
UniCharArrayOffset lastOffset = offset;
UniCharArrayOffset nextoffset;
int lastX = -1;
int wantonemorechar = -1; /* undecided */
- while (offset <= urend) {
+ while (offset <= (UniCharArrayOffset)urend) {
if (flags & TK_ISOLATE_END) {
TkMacOSXLayoutSetString(fontPtr, &drawingContext,
@@ -778,7 +778,7 @@ TkpMeasureCharsInContext(
if (wantonemorechar == -1) {
wantonemorechar =
((flags & TK_AT_LEAST_ONE)
- && (lastOffset == urstart))
+ && (lastOffset == (UniCharArrayOffset)urstart))
||
((flags & TK_PARTIAL_OK)
&& (lastX != maxLength))
@@ -811,7 +811,7 @@ TkpMeasureCharsInContext(
* into account.
*/
- if (offset >= urend) {
+ if (offset >= (UniCharArrayOffset)urend) {
break;
}
nextoffset = 0;
@@ -1103,44 +1103,50 @@ TkMacOSXQuarzStartDraw(
err = QDBeginCGContext(destPort, &outContext);
- /*
- * Now clip the CG Context to the port. We also have to intersect our clip
- * region with the port visible region so we don't overwrite the window
- * decoration.
- */
-
- if (!clipRgn) {
- clipRgn = NewRgn();
+ if (err == noErr && outContext) {
+ /*
+ * Now clip the CG Context to the port. We also have to intersect our clip
+ * region with the port visible region so we don't overwrite the window
+ * decoration.
+ */
+
+ if (!clipRgn) {
+ clipRgn = NewRgn();
+ }
+
+ GetPortBounds(destPort, &boundsRect);
+
+ RectRgn(clipRgn, &boundsRect);
+ SectRegionWithPortClipRegion(destPort, clipRgn);
+ SectRegionWithPortVisibleRegion(destPort, clipRgn);
+ ClipCGContextToRegion(outContext, &boundsRect, clipRgn);
+ SetEmptyRgn(clipRgn);
+
+ /*
+ * Note: You have to call SyncCGContextOriginWithPort
+ * AFTER all the clip region manipulations.
+ */
+
+ SyncCGContextOriginWithPort(outContext, destPort);
+
+ /*
+ * Scale the color values, as QD uses UInt16 with the range [0..2^16-1]
+ * while Quarz uses float with [0..1]. NB: Only
+ * CGContextSetRGBFillColor() seems to be actually used by ATSU.
+ */
+
+ GetForeColor(&macColor);
+ CGContextSetRGBFillColor(outContext,
+ RGBFLOATRED(macColor),
+ RGBFLOATGREEN(macColor),
+ RGBFLOATBLUE(macColor),
+ 1.0f);
+ #ifdef TK_MAC_DEBUG_FONTS
+ } else {
+ fprintf(stderr, "QDBeginCGContext(): Error %d\n", (int) err);
+ #endif
}
- GetPortBounds(destPort, &boundsRect);
-
- RectRgn(clipRgn, &boundsRect);
- SectRegionWithPortClipRegion(destPort, clipRgn);
- SectRegionWithPortVisibleRegion(destPort, clipRgn);
- ClipCGContextToRegion(outContext, &boundsRect, clipRgn);
- SetEmptyRgn(clipRgn);
-
- /*
- * Note: You have to call SyncCGContextOriginWithPort
- * AFTER all the clip region manipulations.
- */
-
- SyncCGContextOriginWithPort(outContext, destPort);
-
- /*
- * Scale the color values, as QD uses UInt16 with the range [0..2^16-1]
- * while Quarz uses float with [0..1]. NB: Only
- * CGContextSetRGBFillColor() seems to be actually used by ATSU.
- */
-
- GetForeColor(&macColor);
- CGContextSetRGBFillColor(outContext,
- RGBFLOATRED(macColor),
- RGBFLOATGREEN(macColor),
- RGBFLOATBLUE(macColor),
- 1.0f);
-
drawingContextPtr->graphPort = destPort;
drawingContextPtr->cgContext = outContext;
drawingContextPtr->portRect = boundsRect;
@@ -1170,9 +1176,11 @@ void
TkMacOSXQuarzEndDraw(
DrawingContext * drawingContextPtr)
{
- QDEndCGContext(
- drawingContextPtr->graphPort,
- &drawingContextPtr->cgContext);
+ if (drawingContextPtr->cgContext) {
+ QDEndCGContext(
+ drawingContextPtr->graphPort,
+ &drawingContextPtr->cgContext);
+ }
}
#endif /* TK_MAC_USE_QUARZ */
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 0201054..070c3d4 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -54,12 +54,18 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.15 2006/05/12 18:17:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXKeyEvent.c,v 1.16 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMacOSXEvent.h"
+/*
+#ifdef TK_MAC_DEBUG
+#define TK_MAC_DEBUG_KEYBOARD
+#endif
+*/
+
typedef struct {
WindowRef whichWindow;
int global_x, global_y;
@@ -563,8 +569,7 @@ InitKeyEvent(
* duplicate enums and typedefs would give errrors.
*/
-#if !defined(MAC_OS_X_VERSION_10_2) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1020
#define KeyboardLayoutRef Ptr
#define KeyboardLayoutPropertyTag UInt32
#define kKLKCHRData 0
@@ -643,7 +648,7 @@ GetKeyboardLayout (Ptr * resourcePtr, TextEncoding * encodingPtr)
if ((lastLayout != currentLayout)
|| (lastLayoutId != currentLayoutId)) {
-#ifdef TK_MAC_DEBUG
+#ifdef TK_MAC_DEBUG_KEYBOARD
fprintf (stderr, "GetKeyboardLayout(): Use KLS\n");
#endif
@@ -684,7 +689,7 @@ GetKeyboardLayout (Ptr * resourcePtr, TextEncoding * encodingPtr)
if ((lastLayout == NULL) || (lastLayoutId != currentLayoutId)) {
-#ifdef TK_MAC_DEBUG
+#ifdef TK_MAC_DEBUG_KEYBOARD
fprintf (stderr, "GetKeyboardLayout(): Use GetResource()\n");
#endif
@@ -719,7 +724,7 @@ GetKeyboardLayout (Ptr * resourcePtr, TextEncoding * encodingPtr)
if (hasLayoutChanged) {
-#ifdef TK_MAC_DEBUG
+#ifdef TK_MAC_DEBUG_KEYBOARD
if (KCHR != NULL) {
fprintf (stderr, "GetKeyboardLayout(): New 'KCHR' layout %d\n",
(int) (short) currentLayoutId);
@@ -747,7 +752,7 @@ GetKeyboardLayout (Ptr * resourcePtr, TextEncoding * encodingPtr)
if (KCHR != NULL) {
lastEncoding = GetKCHREncoding(currentKeyScript, currentLayoutId);
-#ifdef TK_MAC_DEBUG
+#ifdef TK_MAC_DEBUG_KEYBOARD
fprintf (stderr, "GetKeyboardLayout(): New 'KCHR' encoding %lu "
"(%lu + 0x%lX)\n",
lastEncoding, lastEncoding & 0xFFFFL,
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index b3c0f20..758d107 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.29 2006/05/12 18:18:36 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.30 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -28,8 +28,7 @@
#endif
*/
-#if !defined(MAC_OS_X_VERSION_10_3) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
/* Define constants only available on Mac OS X 10.3 or later */
#define kMenuAttrDoNotUseUserCommandKeys (1 << 7)
#endif
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index 106df35..50f2ed5 100644
--- a/macosx/tkMacOSXMenubutton.c
+++ b/macosx/tkMacOSXMenubutton.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.10 2006/03/24 14:58:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.11 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -19,8 +19,7 @@
#include "tkMacOSXFont.h"
#include "tkMacOSXDebug.h"
-#if !defined(MAC_OS_X_VERSION_10_3) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
/* Define constants only available on Mac OS X 10.3 or later */
#define kMenuAttrDoNotUseUserCommandKeys (1 << 7)
#endif
diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c
index 7d5471f..1810f97 100644
--- a/macosx/tkMacOSXMenus.c
+++ b/macosx/tkMacOSXMenus.c
@@ -11,13 +11,12 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.13 2006/05/16 06:53:58 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenus.c,v 1.14 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
-#if !defined(MAC_OS_X_VERSION_10_3) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
/* Define constants only available on Mac OS X 10.3 or later */
#define kMenuAttrDoNotUseUserCommandKeys (1 << 7)
#endif
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 6326ec5..59a03a8 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,15 +54,14 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.22 2006/04/28 06:02:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMouseEvent.c,v 1.23 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMacOSXEvent.h"
#include "tkMacOSXDebug.h"
-#if !defined(MAC_OS_X_VERSION_10_3) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
/* Define constants only available on Mac OS X 10.3 or later */
#define kEventParamWindowPartCode 'wpar'
#define typeWindowPartCode 'wpar'
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index b8fcd3f..628fbfb 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXWm.c,v 1.35 2006/05/16 07:37:17 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.36 2006/07/20 06:25:19 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -22,14 +22,12 @@
#include "tkMacOSXEvent.h"
/* Define constants only available on Mac OS X 10.3 or later */
-#if !defined(MAC_OS_X_VERSION_10_3) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
#define kSimpleWindowClass 18
#define kWindowDoesNotCycleAttribute (1L << 15)
#endif
/* Define constants only available on Mac OS X 10.4 or later */
-#if !defined(MAC_OS_X_VERSION_10_4) || \
- (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
#define kWindowNoTitleBarAttribute (1L << 9)
#define kWindowMetalNoContentSeparatorAttribute (1L << 11)
#endif
@@ -880,17 +878,19 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
Boolean d;
err = FSPathMakeRef((unsigned char*) path, &ref, &d);
if (err == noErr) {
-#if defined(MAC_OS_X_VERSION_10_4) && \
- (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- err = HIWindowSetProxyFSRef(macWindow, &ref);
-#else
- AliasHandle alias;
- err = FSNewAlias(NULL, &ref, &alias);
- if (err == noErr) {
- err = SetWindowProxyAlias(macWindow, alias);
- DisposeHandle((Handle) alias);
- }
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+ if (HIWindowSetProxyFSRef != NULL) {
+ err = HIWindowSetProxyFSRef(macWindow, &ref);
+ } else
#endif
+ {
+ AliasHandle alias;
+ err = FSNewAlias(NULL, &ref, &alias);
+ if (err == noErr) {
+ err = SetWindowProxyAlias(macWindow, alias);
+ DisposeHandle((Handle) alias);
+ }
+ }
}
} else {
int len;
@@ -1714,17 +1714,19 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
}
macWindow = GetWindowFromPort(TkMacOSXGetDrawablePort(winPtr->window));
if (len) {
-#if defined(MAC_OS_X_VERSION_10_4) && \
- (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- err = HIWindowSetProxyFSRef(macWindow, &ref);
-#else
- AliasHandle alias;
- err = FSNewAlias(NULL, &ref, &alias);
- if (err == noErr) {
- err = SetWindowProxyAlias(macWindow, alias);
- DisposeHandle((Handle) alias);
- }
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+ if (HIWindowSetProxyFSRef != NULL) {
+ err = HIWindowSetProxyFSRef(macWindow, &ref);
+ } else
#endif
+ {
+ AliasHandle alias;
+ err = FSNewAlias(NULL, &ref, &alias);
+ if (err == noErr) {
+ err = SetWindowProxyAlias(macWindow, alias);
+ DisposeHandle((Handle) alias);
+ }
+ }
} else {
err = RemoveWindowProxy(macWindow);
if (wmPtr->hints.icon_pixmap != None) {