summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2005-05-14 20:48:14 (GMT)
committerdas <das>2005-05-14 20:48:14 (GMT)
commitca068809f5fd859cafdfb8827f30e7401e95b835 (patch)
tree2461f0c3bbbdbb7e3c8ac29e9bbb1dd5b651f950 /macosx
parent417308254eb3d2d9ccb15f381abe79090a00f72a (diff)
downloadtk-ca068809f5fd859cafdfb8827f30e7401e95b835.zip
tk-ca068809f5fd859cafdfb8827f30e7401e95b835.tar.gz
tk-ca068809f5fd859cafdfb8827f30e7401e95b835.tar.bz2
* macosx/tkMacOSXInit.c:
* macosx/tkMacOSXNotify.c: introduction of new tcl notifier based on CFRunLoop allows replacement of the custom TkAqua notifier by a standard tcl event source. Removes requirement of threaded tcl core for TkAqua, allows to stub-link TkAqua against Tcl by removing use of the unstubbed TclInitNotifier & TclFinalizeNotifier. [Tcl Patch 1202052] * macosx/Wish.xcode/project.pbxproj: * macosx/Wish.pbproj/project.pbxproj: stub-link TkAqua: build with USE_TCL_STUBS and link against libtclstub instead of Tcl.framework, unexport libtclstub symbols from Tk to avoid duplicate symbol warnings when linking with both Tcl and Tk, fixes for gcc4.0 warnings. * macosx/Wish.xcode/project.pbxproj: sync with Wish.pbproj changes since 2004-11-19. NOTE: to use this project, need to uncomment the tclConfig.h settings at the top of tcl/unix/configure.in, autoconf and rebuild tcl ! * macosx/tkMacOSXBitmap.c: * macosx/tkMacOSXButton.c: * macosx/tkMacOSXDialog.c: * macosx/tkMacOSXFont.c: * macosx/tkMacOSXHLEvents.c: * macosx/tkMacOSXInit.c: * macosx/tkMacOSXKeyboard.c: * macosx/tkMacOSXMenu.c: * macosx/tkMacOSXMenubutton.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXXStubs.c: fixed gcc 4.0 warnings. * unix/tcl.m4: sync with tcl * unix/configure: autoconf-2.59
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Wish.pbproj/project.pbxproj49
-rw-r--r--macosx/Wish.xcode/project.pbxproj76
-rw-r--r--macosx/tkMacOSXBitmap.c4
-rw-r--r--macosx/tkMacOSXButton.c7
-rw-r--r--macosx/tkMacOSXDialog.c32
-rw-r--r--macosx/tkMacOSXFont.c8
-rw-r--r--macosx/tkMacOSXHLEvents.c4
-rw-r--r--macosx/tkMacOSXInit.c11
-rw-r--r--macosx/tkMacOSXKeyboard.c3
-rw-r--r--macosx/tkMacOSXMenu.c10
-rw-r--r--macosx/tkMacOSXMenubutton.c10
-rw-r--r--macosx/tkMacOSXNotify.c1135
-rw-r--r--macosx/tkMacOSXWm.c10
-rw-r--r--macosx/tkMacOSXXStubs.c4
14 files changed, 218 insertions, 1145 deletions
diff --git a/macosx/Wish.pbproj/project.pbxproj b/macosx/Wish.pbproj/project.pbxproj
index 241baf5..7b9d5d0 100644
--- a/macosx/Wish.pbproj/project.pbxproj
+++ b/macosx/Wish.pbproj/project.pbxproj
@@ -21,7 +21,7 @@
};
};
4C148E2407ECCFCF0033822E = {
- fileEncoding = 30;
+ fileEncoding = 5;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
path = tkMacOSXEntry.c;
@@ -41,7 +41,7 @@
};
};
4C3B4CF6040B18B200C916F0 = {
- fileEncoding = 30;
+ fileEncoding = 5;
isa = PBXFileReference;
lastKnownFileType = sourcecode.rez;
path = tkMacOSXAETE.r;
@@ -75,7 +75,7 @@
remoteInfo = TkLibrary;
};
4C8A204405E0421900C18A82 = {
- fileEncoding = 30;
+ fileEncoding = 5;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
path = tkMacOSXCarbonEvents.c;
@@ -89,7 +89,7 @@
};
};
4CB2D7CF0619F8EB0081E375 = {
- fileEncoding = 30;
+ fileEncoding = 5;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.c;
path = tkMacOSXScale.c;
@@ -126,12 +126,6 @@
settings = {
};
};
- F51D903E0181474301DC9062 = {
- fileRef = F5875C7B016FEF1D01DC9062;
- isa = PBXBuildFile;
- settings = {
- };
- };
F51D903F018149BD01DC9062 = {
buildActionMask = 2147483647;
dstPath = "Versions/$(FRAMEWORK_VERSION)/Headers/X11";
@@ -211,7 +205,7 @@
isa = PBXShellScriptBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ \"${BUILD_STYLE}\" = \"Development\" ]; then\n\t# keep copy of debug library around, so that\n\t# Deployment build can be installed on top\n\t# of Development build without overwriting it\n\tcd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\n\tcp -fp \"${PRODUCT_NAME}\" \"${PRODUCT_NAME}_debug\"\n\tln -fs \"Versions/Current/${PRODUCT_NAME}_debug\" ../..\n\tcp -fp \"libtkstub${FRAMEWORK_VERSION}.a\" \"libtkstub${FRAMEWORK_VERSION}g.a\"\n\n\t# force Deployment build to be relinked next time\n\tif [ -f \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nelse\n\t# force Development build to be relinked next time\n\tif [ -f \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nfi\n\n# fixup Framework structure\ncd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\nln -fs `ls libtkstub* | sed -e \"s|.*|Versions/${FRAMEWORK_VERSION}/&|\"` ../..\nln -fs \"Versions/Current/tkConfig.sh\" ../..\nranlib libtkstub${FRAMEWORK_VERSION}*.a\n\n# create pkgIndex\n( echo \"if {[package vcompare [package provide Tcl] ${FRAMEWORK_VERSION}] != 0} { return }\" && \\\n echo \"package ifneeded Tk ${FRAMEWORK_VERSION} [list load [file join \\$dir .. .. Tk] Tk]\" \\\n) > \"Resources/Scripts/pkgIndex.tcl\"";
+ shellScript = "if [ \"${BUILD_STYLE}\" = \"Development\" ]; then\n\t# keep copy of debug library around, so that\n\t# Deployment build can be installed on top\n\t# of Development build without overwriting it\n\tcd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\n\tln -f \"${PRODUCT_NAME}\" \"${PRODUCT_NAME}_debug\"\n\tln -fs \"Versions/Current/${PRODUCT_NAME}_debug\" ../..\n\n\t# force Deployment build to be relinked next time\n\tif [ -f \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nelse\n\t# force Development build to be relinked next time\n\tif [ -f \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/LinkFileList\"\n\tfi\nfi\n\n# fixup Framework structure\ncd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\nln -fs `ls libtkstub* | sed -e \"s|.*|Versions/${FRAMEWORK_VERSION}/&|\"` ../..\nln -fs \"Versions/Current/tkConfig.sh\" ../..\nranlib libtkstub${FRAMEWORK_VERSION}*.a\n\n# create pkgIndex\n( echo \"if {[package vcompare [package provide Tcl] ${FRAMEWORK_VERSION}] != 0} { return }\" && \\\n echo \"package ifneeded Tk ${FRAMEWORK_VERSION} [list load [file join \\$dir .. .. Tk] Tk]\" \\\n) > \"Resources/Scripts/pkgIndex.tcl\"";
};
F537552A016C352C01DC9062 = {
buildSettings = {
@@ -1906,6 +1900,7 @@
F53755DF016C38D201DC9062 = {
buildPhases = (
F5877FB7031F97ED016F146B,
+ F92CCC75080CEBA800E72D64,
F53755E0016C38D201DC9062,
F53755E1016C38D301DC9062,
F53755E2016C38D301DC9062,
@@ -1926,13 +1921,13 @@
DYLIB_INSTALL_PATH = /Library/Frameworks;
FRAMEWORK_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)\"";
FRAMEWORK_VERSION = 8.5;
- GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g'`";
+ GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g' -e 's|TCL_WIDE_INT_TYPE|BOGUS_&|'` -U_REENTRANT";
HEADER_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders\" . ../bitmaps ../generic ../xlib";
INSTALL_PATH = "${DYLIB_INSTALL_PATH}";
- LIBRARY_SEARCH_PATHS = "";
+ LIBRARY_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework\"";
OPTIMIZATION_CFLAGS = "-O0";
- OTHER_CFLAGS = "-DMAC_OSX_TK -DTCL_WIDE_INT_TYPE=\"long long\"";
- OTHER_LDFLAGS = "-seg1addr 0xb000000";
+ OTHER_CFLAGS = "-DMAC_OSX_TK -DUSE_TCL_STUBS -DTCL_WIDE_INT_TYPE=\"long long\"";
+ OTHER_LDFLAGS = "-ltclstub${FRAMEWORK_VERSION} -seg1addr 0xb000000 -Wl,-search_paths_first -Wl,-unexported_symbols_list \"${TEMP_DIR}/tclstub.exp\"";
OTHER_LIBTOOL_FLAGS = "";
OTHER_REZFLAGS = "-i \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" -i \"../generic\"";
PRECOMPILE_PREFIX_HEADER = YES;
@@ -1944,7 +1939,7 @@
TCLTKMAN2HTML = "";
TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
USE_GCC3_PFE_SUPPORT = YES;
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-deprecated-declarations";
WRAPPER_EXTENSION = framework;
};
dependencies = (
@@ -2172,7 +2167,6 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
F53755E3016C38D301DC9062 = {
buildActionMask = 2147483647;
files = (
- F51D903E0181474301DC9062,
F537567E016C3ADB01DC9062,
F50D96130196176E01DC9062,
);
@@ -3319,7 +3313,7 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
DYLIB_INSTALL_PATH = /Library/Frameworks;
FRAMEWORK_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)\" \"$(SYMROOT)\"";
FRAMEWORK_VERSION = 8.5;
- GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g'`";
+ GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g' -e 's|TCL_WIDE_INT_TYPE|BOGUS_&|'` -U_REENTRANT";
HEADER_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders\" . ../generic ../xlib";
INSTALL_PATH = "${APPLICATION_INSTALL_PATH}";
LIBRARY_SEARCH_PATHS = "";
@@ -3332,7 +3326,7 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
SYMROOT = "${SRCROOT}/../../build/tk";
TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
USE_GCC3_PFE_SUPPORT = NO;
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-deprecated-declarations";
WRAPPER_EXTENSION = app;
};
dependencies = (
@@ -3511,7 +3505,7 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
F59D847903390D7E016F146B,
);
buildSettings = {
- GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g'`";
+ GLOBAL_CFLAGS = "`source \"${TCL_FRAMEWORK_DIR}/Tcl.framework/tclConfig.sh\"; echo $${}{TCL_EXTRA_CFLAGS} $${}{TCL_DEFS} | sed -e 's|\\\\\\\\\\\\\\\"|\\\"|g' -e 's|\\\\\\\\\\\\ |_|g' -e 's|TCL_WIDE_INT_TYPE|BOGUS_&|'` -U_REENTRANT";
HEADER_SEARCH_PATHS = "\"$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers\" \"$(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders\" . ../generic ../xlib";
LIBRARY_STYLE = STATIC;
OPTIMIZATION_CFLAGS = "-O0";
@@ -3523,7 +3517,7 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
SECTORDER_FLAGS = "";
SYMROOT = "${SRCROOT}/../../build/tk";
TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
- WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas";
+ WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -Wno-deprecated-declarations";
};
dependencies = (
);
@@ -4284,6 +4278,19 @@ MacOS X Port by Jim Ingham &lt;jingham@apple.com&gt; &amp; Ian Reid, Copyright Â
//F92
//F93
//F94
+ F92CCC75080CEBA800E72D64 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ isa = PBXShellScriptBuildPhase;
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# extract global symbols in libtclstub so that we can unexport them from Tk.framework\nnm -gjp \"${TCL_FRAMEWORK_DIR}/Tcl.framework/libtclstub${FRAMEWORK_VERSION}.a\" | tail +3 > \"${TEMP_DIR}/tclstub.exp\"";
+ };
F92ED9910403D0F0006F146B = {
fileEncoding = 5;
isa = PBXFileReference;
diff --git a/macosx/Wish.xcode/project.pbxproj b/macosx/Wish.xcode/project.pbxproj
index 5dd67f5..d98c650 100644
--- a/macosx/Wish.xcode/project.pbxproj
+++ b/macosx/Wish.xcode/project.pbxproj
@@ -114,6 +114,7 @@
F537556E016C37A601DC9062,
F537556F016C37A601DC9062,
F5375570016C37A601DC9062,
+ F94BE8E60835D4CB00DE8145,
F5375571016C37A601DC9062,
F5375572016C37A601DC9062,
F5375573016C37A601DC9062,
@@ -378,6 +379,7 @@
F5375550016C376E01DC9062,
F5375551016C376E01DC9062,
F5375552016C376E01DC9062,
+ F94BE9090835D5D700DE8145,
F5375553016C376E01DC9062,
F5375554016C376E01DC9062,
F5375555016C376E01DC9062,
@@ -2211,6 +2213,19 @@
//F92
//F93
//F94
+ F92CCC75080CEBA800E72D64 = {
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ isa = PBXShellScriptBuildPhase;
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "# extract global symbols in libtclstub so that we can unexport them from Tk.framework\nnm -gjp \"${TCL_FRAMEWORK_DIR}/Tcl.framework/libtclstub${FRAMEWORK_VERSION}.a\" | tail +3 > \"${TEMP_DIR}/tclstub.exp\"";
+ };
F92ED9910403D0F0006F146B = {
fileEncoding = 5;
isa = PBXFileReference;
@@ -2220,6 +2235,35 @@
refType = 2;
sourceTree = SOURCE_ROOT;
};
+ F94BE8E60835D4CB00DE8145 = {
+ fileEncoding = 5;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ name = tkEntry.h;
+ path = ../generic/tkEntry.h;
+ refType = 2;
+ sourceTree = SOURCE_ROOT;
+ };
+ F94BE8FC0835D58C00DE8145 = {
+ fileRef = F94BE8E60835D4CB00DE8145;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ F94BE9090835D5D700DE8145 = {
+ fileEncoding = 5;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.c;
+ path = tkMacOSXEntry.c;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ F94BE90A0835D5D700DE8145 = {
+ fileRef = F94BE9090835D5D700DE8145;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
F95787DD0745BB260058B6A3 = {
buildPhases = (
F95787DF0745BB260058B6A3,
@@ -2259,6 +2303,7 @@
SYMROOT = "${SRCROOT}/../../build/tk";
TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
UNSTRIPPED_PRODUCT = YES;
+ WARNING_CFLAGS = "-Wno-deprecated-declarations";
WRAPPER_EXTENSION = app;
ZERO_LINK = NO;
};
@@ -2412,6 +2457,7 @@
F95788500745BB270058B6A3 = {
buildPhases = (
F95788520745BB270058B6A3,
+ F92CCC75080CEBA800E72D64,
F95788530745BB270058B6A3,
F95788860745BB270058B6A3,
F95788870745BB270058B6A3,
@@ -2428,23 +2474,20 @@
buildRules = (
);
buildSettings = {
- DEAD_CODE_STRIPPING = NO;
DOCDIR = "${INSTALL_PATH}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}/Resources/Documentation/Reference";
DYLIB_COMPATIBILITY_VERSION = 8.5;
DYLIB_CURRENT_VERSION = "$(FRAMEWORK_VERSION)";
DYLIB_INSTALL_PATH = /Library/Frameworks;
FRAMEWORK_SEARCH_PATHS = "$(TCL_FRAMEWORK_DIR)";
FRAMEWORK_VERSION = 8.5;
- GCC_DEBUGGING_SYMBOLS = default;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = "MAC_OSX_TK HAVE_TCL_CONFIG_H";
- GCC_USE_GCC3_PFE_SUPPORT = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = "MAC_OSX_TK USE_TCL_STUBS HAVE_TCL_CONFIG_H";
HEADER_SEARCH_PATHS = "$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers $(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders . ../bitmaps ../generic ../xlib";
INFOPLIST_FILE = "Tk-Info.plist";
INSTALL_PATH = "${DYLIB_INSTALL_PATH}";
- OTHER_LDFLAGS = "-seg1addr 0xb000000";
+ LIBRARY_SEARCH_PATHS = "$(TCL_FRAMEWORK_DIR)/Tcl.framework";
+ OTHER_CFLAGS = "-imacros tclConfig.h";
+ OTHER_LDFLAGS = "-ltclstub${FRAMEWORK_VERSION} -seg1addr 0xb000000 -Wl,-search_paths_first -Wl,-unexported_symbols_list \"${TEMP_DIR}/tclstub.exp\"";
PRODUCT_NAME = Tk;
PROJECT_TEMP_DIR = "${TEMP_ROOT}/$(PROJECT_NAME).build";
REZ_RESOURCE_MAP_READ_ONLY = YES;
@@ -2454,8 +2497,8 @@
TCLTKMAN2HTML = "";
TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
UNSTRIPPED_PRODUCT = YES;
+ WARNING_CFLAGS = "-Wno-deprecated-declarations";
WRAPPER_EXTENSION = framework;
- ZERO_LINK = NO;
};
dependencies = (
F957893D0745BB270058B6A3,
@@ -2529,6 +2572,7 @@
F95788830745BB270058B6A3,
F95788840745BB270058B6A3,
F95788850745BB270058B6A3,
+ F94BE8FC0835D58C00DE8145,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -2992,6 +3036,7 @@
F95788F30745BB270058B6A3,
F95788F40745BB270058B6A3,
F95788F50745BB270058B6A3,
+ F94BE90A0835D5D700DE8145,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
@@ -3659,19 +3704,12 @@
F95788F60745BB270058B6A3 = {
buildActionMask = 2147483647;
files = (
- F95788F70745BB270058B6A3,
F95788F80745BB270058B6A3,
F95788F90745BB270058B6A3,
);
isa = PBXFrameworksBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
};
- F95788F70745BB270058B6A3 = {
- fileRef = F5875C7B016FEF1D01DC9062;
- isa = PBXBuildFile;
- settings = {
- };
- };
F95788F80745BB270058B6A3 = {
fileRef = F537567D016C3ADB01DC9062;
isa = PBXBuildFile;
@@ -4050,7 +4088,7 @@
isa = PBXShellScriptBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ \"${BUILD_STYLE}\" = \"Development\" ]; then\n\t# keep copy of debug library around, so that\n\t# Deployment build can be installed on top\n\t# of Development build without overwriting it\n\tcd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\n\tcp -fp \"${PRODUCT_NAME}\" \"${PRODUCT_NAME}_debug\"\n\tln -fs \"Versions/Current/${PRODUCT_NAME}_debug\" ../..\n\tcp -fp \"libtkstub${FRAMEWORK_VERSION}.a\" \"libtkstub${FRAMEWORK_VERSION}g.a\"\n\n\t# force Deployment build to be relinked next time\n\tif [ -f \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME }.LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME }.LinkFileList\"\n\tfi\nelif [ \"${BUILD_STYLE}\" = \"Deployment\" ]; then\n\t# force Development build to be relinked next time\n\tif [ -f \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME }.LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME }.LinkFileList\"\n\tfi\nfi\n\n# fixup Framework structure\ncd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\nln -fs `ls libtkstub* | sed -e \"s|.*|Versions/${FRAMEWORK_VERSION}/&|\"` ../..\nln -fs \"Versions/Current/tkConfig.sh\" ../..\nranlib libtkstub${FRAMEWORK_VERSION}*.a\n\n# create pkgIndex\n( echo \"if {[package vcompare [package provide Tcl] ${FRAMEWORK_VERSION}] != 0} { return }\" && \\\n echo \"package ifneeded Tk ${FRAMEWORK_VERSION} [list load [file join \\$dir .. .. Tk] Tk]\" \\\n) > \"Resources/Scripts/pkgIndex.tcl\"\n";
+ shellScript = "if [ \"${BUILD_STYLE}\" = \"Development\" ]; then\n\t# keep copy of debug library around, so that\n\t# Deployment build can be installed on top\n\t# of Development build without overwriting it\n\tcd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\n\tln -f \"${PRODUCT_NAME}\" \"${PRODUCT_NAME}_debug\"\n\tln -fs \"Versions/Current/${PRODUCT_NAME}_debug\" ../..\n\n\t# force Deployment build to be relinked next time\n\tif [ -f \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME}.LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Deployment.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME }.LinkFileList\"\n\tfi\nelif [ \"${BUILD_STYLE}\" = \"Deployment\" ]; then\n\t# force Development build to be relinked next time\n\tif [ -f \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME}.LinkFileList\" ]; then\n\t touch -t `date -r \\`expr \\\\\\`date +\"%s\"\\\\\\` + 30\\` +\"%Y%m%d%H%M.%S\"` \"${OBJROOT}/Development.build/${PROJECT_NAME}.build/${TARGET_NAME}.build/Objects-normal/${PRODUCT_NAME }.LinkFileList\"\n\tfi\nfi\n\n# fixup Framework structure\ncd \"${TARGET_BUILD_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}/Versions/${FRAMEWORK_VERSION}\"\nln -fs `ls libtkstub* | sed -e \"s|.*|Versions/${FRAMEWORK_VERSION}/&|\"` ../..\nln -fs \"Versions/Current/tkConfig.sh\" ../..\nranlib libtkstub${FRAMEWORK_VERSION}*.a\n\n# create pkgIndex\n( echo \"if {[package vcompare [package provide Tcl] ${FRAMEWORK_VERSION}] != 0} { return }\" && \\\n echo \"package ifneeded Tk ${FRAMEWORK_VERSION} [list load [file join \\$dir .. .. Tk] Tk]\" \\\n) > \"Resources/Scripts/pkgIndex.tcl\"\n";
};
F957892E0745BB270058B6A3 = {
buildActionMask = 8;
@@ -4103,6 +4141,7 @@
GCC_PREPROCESSOR_DEFINITIONS = "MAC_OSX_TK HAVE_TCL_CONFIG_H";
HEADER_SEARCH_PATHS = "$(TCL_FRAMEWORK_DIR)/Tcl.framework/Headers $(TCL_FRAMEWORK_DIR)/Tcl.framework/PrivateHeaders . ../generic ../xlib";
LIBRARY_STYLE = STATIC;
+ OTHER_CFLAGS = "-imacros tclConfig.h";
PRODUCT_NAME = tkstub8.5;
PROJECT_TEMP_DIR = "${TEMP_ROOT}/$(PROJECT_NAME).build";
REZ_RESOURCE_MAP_READ_ONLY = YES;
@@ -4110,6 +4149,7 @@
SYMROOT = "${SRCROOT}/../../build/tk";
TCL_FRAMEWORK_DIR = "$(SYMROOT)/../tcl";
UNSTRIPPED_PRODUCT = YES;
+ WARNING_CFLAGS = "-Wno-deprecated-declarations";
ZERO_LINK = NO;
};
dependencies = (
@@ -4178,7 +4218,7 @@
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = F95788500745BB270058B6A3;
- remoteInfo = "TkLibrary (Upgraded)";
+ remoteInfo = TkLibrary;
};
F957893B0745BB270058B6A3 = {
isa = PBXTargetDependency;
@@ -4190,7 +4230,7 @@
isa = PBXContainerItemProxy;
proxyType = 1;
remoteGlobalIDString = F95789320745BB270058B6A3;
- remoteInfo = "TkStubLibrary (Upgraded)";
+ remoteInfo = TkStubLibrary;
};
F957893D0745BB270058B6A3 = {
isa = PBXTargetDependency;
diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c
index 9f930aa..0f6f319 100644
--- a/macosx/tkMacOSXBitmap.c
+++ b/macosx/tkMacOSXBitmap.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXBitmap.c,v 1.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkMacOSXBitmap.c,v 1.3 2005/05/14 20:48:14 das Exp $
*/
#include "tkPort.h"
@@ -240,7 +240,7 @@ TkpGetNativeAppBitmap(
}
if (resource == NULL) {
- return NULL;
+ return (Pixmap) NULL;
}
pix = Tk_GetPixmap(display, None, 32, 32, 0);
diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c
index 4fb3f2f..59fcc3f 100644
--- a/macosx/tkMacOSXButton.c
+++ b/macosx/tkMacOSXButton.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: tkMacOSXButton.c,v 1.11 2005/03/12 00:27:15 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXButton.c,v 1.12 2005/05/14 20:48:14 das Exp $
*/
#include "tkButton.h"
@@ -912,7 +912,6 @@ TkMacOSXDrawControl(
TkWindow * winPtr;
Rect paneRect;
Rect cntrRect;
- int hilitePart = -1;
winPtr = (TkWindow *)butPtr->tkwin;
@@ -975,7 +974,7 @@ TkMacOSXDrawControl(
if ((mbPtr->info.image == NULL) && (mbPtr->info.bitmap == None)
|| (mbPtr->info.compound != COMPOUND_NONE)) {
len = TkFontGetFirstTextLayout(butPtr->textLayout,
- &font, controlTitle);
+ &font, (char*) controlTitle);
controlTitle[len] = 0;
} else {
len = 0;
@@ -984,7 +983,7 @@ TkMacOSXDrawControl(
if (bcmp(mbPtr->controlTitle, controlTitle, len+1)) {
CFStringRef cf;
cf = CFStringCreateWithCString(NULL,
- controlTitle, kCFStringEncodingUTF8);
+ (char*) controlTitle, kCFStringEncodingUTF8);
if (cf != NULL) {
SetControlTitleWithCFString(mbPtr->control, cf);
CFRelease(cf);
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index bd7e15a..78e1360 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.12 2005/02/22 08:48:56 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.13 2005/05/14 20:48:14 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -214,7 +214,7 @@ Tk_ChooseColorObjCmd(
cpinfo.pickerType = 0L;
cpinfo.eventProc = NULL;
cpinfo.colorProc = NULL;
- cpinfo.colorProcData = NULL;
+ cpinfo.colorProcData = 0;
/* This doesn't seem to actually set the title! */
Tcl_UtfToExternal(NULL, NULL, title, -1, 0, NULL,
@@ -337,7 +337,7 @@ Tk_GetOpenFileObjCmd(
break;
case OPEN_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- message = CFStringCreateWithBytes(NULL, choice, choiceLen,
+ message = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen,
kCFStringEncodingUTF8, false);
break;
case OPEN_MULTIPLE:
@@ -357,7 +357,7 @@ Tk_GetOpenFileObjCmd(
break;
case OPEN_TITLE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- title = CFStringCreateWithBytes(NULL, choice, choiceLen,
+ title = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen,
kCFStringEncodingUTF8, false);
break;
}
@@ -473,7 +473,7 @@ Tk_GetSaveFileObjCmd(
break;
case SAVE_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- message = CFStringCreateWithBytes(NULL, choice, choiceLen,
+ message = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen,
kCFStringEncodingUTF8, false);
break;
case SAVE_PARENT:
@@ -486,7 +486,7 @@ Tk_GetSaveFileObjCmd(
break;
case SAVE_TITLE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- title = CFStringCreateWithBytes(NULL, choice, choiceLen,
+ title = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen,
kCFStringEncodingUTF8, false);
break;
}
@@ -594,7 +594,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
break;
case CHOOSE_MESSAGE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- message = CFStringCreateWithBytes(NULL, choice, choiceLen,
+ message = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen,
kCFStringEncodingUTF8, false);
break;
case CHOOSE_PARENT:
@@ -607,7 +607,7 @@ Tk_ChooseDirectoryObjCmd(clientData, interp, objc, objv)
break;
case CHOOSE_TITLE:
choice = Tcl_GetStringFromObj(objv[i + 1], &choiceLen);
- title = CFStringCreateWithBytes(NULL, choice, choiceLen,
+ title = CFStringCreateWithBytes(NULL, (unsigned char*) choice, choiceLen,
kCFStringEncodingUTF8, false);
break;
}
@@ -656,7 +656,7 @@ HandleInitialDirectory (
return TCL_ERROR;
}
- err = FSPathMakeRef(dirName,
+ err = FSPathMakeRef((unsigned char*) dirName,
dirRef, &isDirectory);
if (err != noErr) {
@@ -690,7 +690,7 @@ HandleInitialDirectory (
AECreateList(NULL, 0, false, selectDescPtr);
- err = FSPathMakeRef(namePtr, &fileRef, &isDirectory);
+ err = FSPathMakeRef((unsigned char*) namePtr, &fileRef, &isDirectory);
if (err != noErr) {
Tcl_AppendResult(interp, "bad initialfile \"", initialFile,
"\" file does not exist.", NULL);
@@ -882,7 +882,7 @@ NavServicesGetFile(
!= noErr ) {
fprintf(stderr,"AEGetDescData failed %d\n", err );
} else {
- if (err = FSRefMakePath(&fsRef, pathPtr, 1024) ) {
+ if (err = FSRefMakePath(&fsRef, (unsigned char*) pathPtr, 1024) ) {
fprintf(stderr,"FSRefMakePath failed, %d\n", err );
} else {
if (isOpen == SAVE_FILE) {
@@ -1000,9 +1000,9 @@ OpenFileFilterProc(
int len;
fileNamePtr = (((FSSpec *) *theItem->dataHandle)->name);
len = fileNamePtr[0];
- strncpy(fileName, fileNamePtr + 1, len);
+ strncpy(fileName, (char*) fileNamePtr + 1, len);
fileName[len] = '\0';
- fileNamePtr = fileName;
+ fileNamePtr = (unsigned char*) fileName;
} else if (theItem->descriptorType = typeFSRef) {
OSStatus err;
@@ -1016,7 +1016,7 @@ OpenFileFilterProc(
(Tcl_UniChar *) uniFileName.unicode,
uniFileName.length,
&fileNameDString);
- fileNamePtr = Tcl_DStringValue(&fileNameDString);
+ fileNamePtr = (unsigned char*) Tcl_DStringValue(&fileNameDString);
} else {
fileNamePtr = NULL;
}
@@ -1161,7 +1161,7 @@ MatchOneType(
* have "." in it
*/
- for (q = fileNamePtr; *q; q++) {
+ for (q = (char*) fileNamePtr; *q; q++) {
if (*q == '.') {
goto glob_unmatched;
}
@@ -1169,7 +1169,7 @@ MatchOneType(
goto glob_matched;
}
- if (Tcl_StringMatch(fileNamePtr, ext)) {
+ if (Tcl_StringMatch((char*) fileNamePtr, ext)) {
goto glob_matched;
} else {
goto glob_unmatched;
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 8e90889..d74d150 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.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: tkMacOSXFont.c,v 1.6 2004/11/12 09:03:19 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.7 2005/05/14 20:48:15 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -87,7 +87,7 @@ static TkStateMap scriptMap[] = {
{smEastEurRoman, "macCentEuro"},
{smVietnamese, "macVietnam"},
{smExtArabic, "macSindhi"},
- {NULL, NULL}
+ {0, NULL}
};
static TkStateMap romanMap[] = {
@@ -97,13 +97,13 @@ static TkStateMap romanMap[] = {
{langRomanian, "macRomania"},
{langTurkish, "macTurkish"},
{langGreek, "macGreek"},
- {NULL, NULL}
+ {0, NULL}
};
static TkStateMap cyrillicMap[] = {
{langUkrainian, "macUkraine"},
{langBulgarian, "macBulgaria"},
- {NULL, NULL}
+ {0, NULL}
};
/*
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index efe42fb..cb624aa 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.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: tkMacOSXHLEvents.c,v 1.7 2004/02/16 00:19:42 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.8 2005/05/14 20:48:15 das Exp $
*/
#include "tkMacOSXPort.h"
@@ -482,7 +482,7 @@ FSRefToDString(const FSRef *fsref, Tcl_DString *ds)
err = FSRefMakePath(fsref, fileName, sizeof(fileName));
if (err == noErr) {
- Tcl_ExternalToUtfDString(NULL, fileName, -1, ds);
+ Tcl_ExternalToUtfDString(NULL, (char*) fileName, -1, ds);
}
return err;
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 3c20b5f..b5481ba 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.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: tkMacOSXInit.c,v 1.8 2005/03/09 19:40:52 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.9 2005/05/14 20:48:15 das Exp $
*/
#include "tkInt.h"
@@ -79,7 +79,7 @@ static Map scriptMap[] = {
{smEastEurRoman, "macCentEuro"},
{smVietnamese, "macVietnam"},
{smExtArabic, "macSindhi"},
- {NULL, NULL}
+ {0, NULL}
};
Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
@@ -115,6 +115,8 @@ TkpInit(interp)
static char tkLibPath[PATH_MAX + 1];
static int tkMacOSXInitialized = false;
+ Tk_MacOSXSetupTkNotifier();
+
/*
* Since it is possible for TkInit to be called multiple times
* and we don't want to do the initialization multiple times
@@ -128,7 +130,6 @@ TkpInit(interp)
tkMacOSXInitialized = true;
- Tk_MacOSXSetupTkNotifier();
TkMacOSXInitAppleEvents(interp);
TkMacOSXInitCarbonEvents(interp);
TkMacOSXInitMenus(interp);
@@ -380,13 +381,13 @@ TkMacOSXDefaultStartupScript(void)
char startupScript[PATH_MAX + 1];
if (CFURLGetFileSystemRepresentation (appMainURL, true,
- startupScript, PATH_MAX)) {
+ (unsigned char*) startupScript, PATH_MAX)) {
Tcl_SetStartupScript(Tcl_NewStringObj(startupScript, -1), NULL);
scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(
NULL, appMainURL);
if (scriptFldrURL != NULL) {
CFURLGetFileSystemRepresentation(scriptFldrURL,
- true, scriptPath, PATH_MAX);
+ true, (unsigned char*) scriptPath, PATH_MAX);
CFRelease(scriptFldrURL);
}
}
diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c
index 97886c8..af28c4b 100644
--- a/macosx/tkMacOSXKeyboard.c
+++ b/macosx/tkMacOSXKeyboard.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.17 2004/02/17 19:49:16 cc_benny Exp $
+ * RCS: @(#) $Id: tkMacOSXKeyboard.c,v 1.18 2005/05/14 20:48:15 das Exp $
*/
#include "tkInt.h"
@@ -30,6 +30,7 @@
#define LATIN1_MAX 255
#define MAC_KEYCODE_MAX 0x7F
#define MAC_KEYCODE_MASK 0x7F
+#undef ALT_MASK
#define ALT_MASK Mod1Mask
#define OPTION_MASK Mod2Mask
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 09126b8..378fe13 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -9,7 +9,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.16 2004/11/11 01:24:32 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.17 2005/05/14 20:48:15 das Exp $
*/
#include "tkMacOSXInt.h"
#include "tkMenubutton.h"
@@ -946,9 +946,11 @@ TkpConfigureMenuEntry(
* some fields. */
{
TkMenu *menuPtr = mePtr->menuPtr;
+#if 0 /* Unused */
int index = mePtr->index;
MenuHandle macMenuHdl = ((MacMenu *) menuPtr->platformData)->menuHdl;
MenuHandle helpMenuHdl = NULL;
+#endif
/*
* Cascade menus have to have menu IDs of less than 256. So
@@ -1081,7 +1083,6 @@ ReconfigureIndividualMenu(
0, NULL);
} else {
Tcl_DString itemTextDString;
- int destWrote;
CFStringRef cf;
GetEntryText(mePtr, &itemTextDString);
cf = CFStringCreateWithCString(NULL,
@@ -1754,7 +1755,6 @@ DrawMenuBarWhenIdle(
} else if (i == helpIndex) {
TkMenu *helpMenuPtr = menuBarPtr->entries[i]
->childMenuRefPtr->menuPtr;
- MenuHandle helpMenuHdl = NULL;
if (helpMenuPtr == NULL) {
continue;
@@ -4308,9 +4308,11 @@ HandleMenuFindItemsMsg (MenuRef menu,
TkMenu *menuPtr)
{
TkMenuEntry *parentEntryPtr;
+#if 0 /* Unused */
Tk_Font tkfont;
Tk_FontMetrics fontMetrics, entryMetrics;
Tk_FontMetrics *fmPtr;
+#endif
TkMenuEntry *mePtr;
int i;
int newItem = -1;
@@ -4476,8 +4478,10 @@ HandleMenuFindItemsMsg (MenuRef menu,
}
if (scrollDirection != DONT_SCROLL) {
+#if 0
Tk_Font menuFont;
RgnHandle updateRgn = NewRgn();
+#endif
ScrollMenuImage(menu, menuRectPtr, 0, scrollAmt, NULL);
mtdPtr->virtualMenuTop += scrollAmt;
diff --git a/macosx/tkMacOSXMenubutton.c b/macosx/tkMacOSXMenubutton.c
index 0acc021..58ec4c5 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.3 2004/02/16 00:19:42 wolfsuit Exp $
+ * RCS: @(#) $Id: tkMacOSXMenubutton.c,v 1.4 2005/05/14 20:48:15 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -234,7 +234,7 @@ TkpDisplayMenuButton(
if (titleChanged) {
CFStringRef cf;
cf = CFStringCreateWithCString(NULL,
- titleParams.title, kCFStringEncodingUTF8);
+ (char*) titleParams.title, kCFStringEncodingUTF8);
if (hasImageOrBitmap) {
SetControlTitleWithCFString(mbPtr->control, cf);
} else {
@@ -559,7 +559,7 @@ static void
ComputeControlTitleParams(TkMenuButton * butPtr, ControlTitleParams * paramsPtr )
{
Tk_Font font;
- paramsPtr->len =TkFontGetFirstTextLayout(butPtr->textLayout,&font, paramsPtr->title);
+ paramsPtr->len =TkFontGetFirstTextLayout(butPtr->textLayout,&font, (char*) paramsPtr->title);
paramsPtr->title [paramsPtr->len] = 0;
if (paramsPtr->len) {
TkMacOSXInitControlFontStyle(font,&paramsPtr->style);
@@ -663,7 +663,7 @@ MenuButtonInitControl (
if (mbPtr->params.isBevel) {
CFStringRef cf;
cf = CFStringCreateWithCString(NULL,
- mbPtr->titleParams.title, kCFStringEncodingUTF8);
+ (char*) mbPtr->titleParams.title, kCFStringEncodingUTF8);
SetControlTitleWithCFString(mbPtr->control, cf);
CFRelease(cf);
if (mbPtr->titleParams.len) {
@@ -687,7 +687,7 @@ MenuButtonInitControl (
return 1;
}
cf = CFStringCreateWithCString(NULL,
- mbPtr->titleParams.title, kCFStringEncodingUTF8);
+ (char*) mbPtr->titleParams.title, kCFStringEncodingUTF8);
AppendMenuItemText(mbPtr->menuRef, "\px");
if (cf != NULL) {
SetMenuItemTextWithCFString(mbPtr->menuRef, 1, cf);
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index abf83b4..8c9a4e4 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -1,462 +1,97 @@
/*
* tkMacOSXNotify.c --
*
- * This file contains the implementation of a merged
- * Carbon/select-based notifier, which is the lowest-level part
- * of the Tcl event loop. This file works together with
- * generic/tclNotify.c.
+ * This file contains the implementation of a tcl event source
+ * for the Carbon event loop.
*
* Copyright (c) 1995-1997 Sun Microsystems, Inc.
* Copyright 2001, Apple Computer, Inc.
+ * Copyright 2005, Tcl Core Team.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.10 2005/04/28 08:37:01 dkf Exp $
+ * RCS: @(#) $Id: tkMacOSXNotify.c,v 1.11 2005/05/14 20:48:15 das Exp $
*/
#include "tclInt.h"
#include "tkInt.h"
#include "tkMacOSXEvent.h"
-
-#include <signal.h>
-
-#ifndef TCL_THREADS
-#error Mac OS X notifier requires tcl threads!
-#endif
-
-/*
- * This structure is used to keep track of the notifier info for a
- * a registered file.
- */
-
-typedef struct FileHandler {
- int fd;
- int mask; /* Mask of desired events: TCL_READABLE,
- * etc. */
- int readyMask; /* Mask of events that have been seen since the
- * last time file handlers were invoked for
- * this file. */
- Tcl_FileProc *proc; /* Procedure to call, in the style of
- * Tcl_CreateFileHandler. */
- ClientData clientData; /* Argument to pass to proc. */
- struct FileHandler *nextPtr;/* Next in list of all files we care about. */
-} FileHandler;
+#include <pthread.h>
/*
- * The following structure is what is added to the Tcl event queue when
- * file handlers are ready to fire.
- */
-
-typedef struct FileHandlerEvent {
- Tcl_Event header; /* Information that is standard for
- * all events. */
- int fd; /* File descriptor that is ready. Used
- * to find the FileHandler structure for
- * the file (can't point directly to the
- * FileHandler structure because it could
- * go away while the event is queued). */
-} FileHandlerEvent;
-
-/*
- *
- * The following structure contains a set of select() masks to track
- * readable, writable, and exceptional conditions.
- */
-
-typedef struct SelectMasks {
- fd_set readable;
- fd_set writable;
- fd_set exceptional;
-} SelectMasks;
-
-/*
- * The following static structure contains the state information for the
- * select based implementation of the Tcl notifier. One of these structures
- * is created for each thread that is using the notifier.
+ * The following static indicates whether this module has been initialized
+ * in the current thread.
*/
typedef struct ThreadSpecificData {
- FileHandler *firstFileHandlerPtr;
- /* Pointer to head of file handler list. */
-
- SelectMasks checkMasks; /* This structure is used to build up the masks
- * to be used in the next call to select.
- * Bits are set in response to calls to
- * Tcl_CreateFileHandler. */
- SelectMasks readyMasks; /* This array reflects the readable/writable
- * conditions that were found to exist by the
- * last call to select. */
- int numFdBits; /* Number of valid bits in checkMasks
- * (one more than highest fd for which
- * Tcl_WatchFile has been called). */
- int isMainLoop; /* Is this the main Carbon Loop (in which case
- * we will call RNE in the actual wait... */
- int onList; /* True if it is in this list */
- unsigned int pollState; /* pollState is used to implement a polling
- * handshake between each thread and the
- * notifier thread. Bits defined below. */
- struct ThreadSpecificData *nextPtr, *prevPtr;
- /* All threads that are currently waiting on
- * an event have their ThreadSpecificData
- * structure on a doubly-linked listed formed
- * from these pointers. You must hold the
- * notifierMutex lock before accessing these
- * fields. */
- Tcl_Condition waitCV; /* Any other thread alerts a notifier
- * that an event is ready to be processed
- * by signaling this condition variable. */
- int eventReady; /* True if an event is ready to be processed.
- * Used as condition flag together with
- * waitCV above. */
+ int initialized;
} ThreadSpecificData;
-
static Tcl_ThreadDataKey dataKey;
-/*
- * The following static indicates the number of threads that have
- * initialized notifiers.
- *
- * You must hold the notifierMutex lock before accessing this variable.
- */
-
-static int notifierCount = 0;
-
-/*
- * The following variable points to the head of a doubly-linked list of
- * of ThreadSpecificData structures for all threads that are currently
- * waiting on an event.
- *
- * You must hold the notifierMutex lock before accessing this list.
- */
-
-static ThreadSpecificData *waitingListPtr = NULL;
-
-/*
- * The notifier thread spends all its time in select() waiting for a
- * file descriptor associated with one of the threads on the waitingListPtr
- * list to do something interesting. But if the contents of the
- * waitingListPtr list ever changes, we need to wake up and restart
- * the select() system call. You can wake up the notifier thread by
- * writing a single byte to the file descriptor defined below. This
- * file descriptor is the input-end of a pipe and the notifier thread is
- * listening for data on the output-end of the same pipe. Hence writing
- * to this file descriptor will cause the select() system call to return
- * and wake up the notifier thread.
- *
- * You must hold the notifierMutex lock before accessing this list.
- */
-
-static int triggerPipe = -1;
-
-/*
- * The notifierMutex locks access to all of the global notifier state.
- */
-
-TCL_DECLARE_MUTEX(notifierMutex)
-
-/*
- * The notifier thread signals the notifierCV when it has finished
- * initializing the triggerPipe and right before the notifier
- * thread terminates.
- */
-
-static Tcl_Condition notifierCV;
-
-/*
- * The pollState bits
- * POLL_WANT is set by each thread before it waits on its condition
- * variable. It is checked by the notifier before it does
- * select.
- * POLL_DONE is set by the notifier if it goes into select after
- * seeing POLL_WANT. The idea is to ensure it tries a select
- * with the same bits the initial thread had set.
- */
-#define POLL_WANT 0x1
-#define POLL_DONE 0x2
-
-/*
- * This is the thread ID of the notifier thread that does select.
- */
-static Tcl_ThreadId notifierThread;
-
-/*
- * Static routines defined in this file.
- */
+static void TkMacOSXNotifyExitHandler(ClientData clientData);
+static void CarbonEventsSetupProc(ClientData clientData, int flags);
+static void CarbonEventsCheckProc(ClientData clientData, int flags);
-static void NotifierThreadProc(ClientData clientData);
-static int FileHandlerEventProc(Tcl_Event *evPtr, int flags);
-static void AlertNotifier(ThreadSpecificData *tsdPtr);
-
-/* DKF: Should these be static? */
-void TkMacOSXSetTimer(Tcl_Time *timePtr);
-void TkMacOSXCreateFileHandler(int fd, int mask, Tcl_FileProc *proc,
- ClientData clientData);
-void TkMacOSXDeleteFileHandler(int fd);
-int TkMacOSXWaitForEvent(Tcl_Time *timePtr);
-void TkMacOSXAlertNotifier(ClientData clientData);
-ClientData TkMacOSXInitNotifier();
-void TkMacOSXFinalizeNotifier(ClientData clientData);
-void TkMacOSXServiceModeHook(int mode);
-EventRef TkMacOSXCreateFakeEvent();
/*
*----------------------------------------------------------------------
*
* Tk_MacOSXSetupTkNotifier --
*
- * Replaces the Tcl notifier (from tclUnixNotfy.c) with
- * the Mac notifier that melds the Unix select based notifer
- * with the Carbon event handling side of the Tk notifier.
+ * This procedure is called during Tk initialization to create
+ * the event source for Carbon events.
*
* Results:
- * Replaces the notifier callbacks with MacOS X specific ones.
- *
- * Side effects:
* None.
*
- *----------------------------------------------------------------------
- */
-
-void
-Tk_MacOSXSetupTkNotifier()
-{
- EventQueueRef mainEventQueue;
- Tcl_NotifierProcs macNotifierProcs = {
- TkMacOSXSetTimer,
- TkMacOSXWaitForEvent,
- TkMacOSXCreateFileHandler,
- TkMacOSXDeleteFileHandler,
- TkMacOSXInitNotifier,
- TkMacOSXFinalizeNotifier,
- TkMacOSXAlertNotifier,
- TkMacOSXServiceModeHook
- };
-
- /*
- * Dispose of existing unix notifier thread
- */
-
- TclFinalizeNotifier();
-
- Tcl_SetNotifier(&macNotifierProcs);
-
- /* HACK ALERT: There is a bug in Jaguar where when it goes to make
- * the event queue for the Main Event Loop, it stores the Current
- * event loop rather than the Main Event Loop in the Queue structure.
- * So we have to make sure that the Main Event Queue gets set up on
- * the main thread. Calling GetMainEventQueue will force this to
- * happen.
- */
-
- mainEventQueue = GetMainEventQueue();
-
- /*
- * Tcl_SetNotifier doesn't call the TclInitNotifier
- * so we call it now. If we don't do this the
- * ThreadSpecificData will keep a pointer to the original
- * InitNotifier. See tclNotify.c:TclInitNotifier().
- */
-
- TclInitNotifier();
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_InitNotifier --
- *
- * Initializes the platform specific notifier state.
- *
- * Results:
- * Returns a handle to the notifier state for this thread..
- *
* Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-ClientData
-TkMacOSXInitNotifier()
-{
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
- tsdPtr->eventReady = 0;
-
- /*
- * Start the Notifier thread if necessary.
- */
-
- Tcl_MutexLock(&notifierMutex);
- if (notifierCount == 0) {
- if (Tcl_CreateThread(&notifierThread, NotifierThreadProc, NULL,
- TCL_THREAD_STACK_DEFAULT, TCL_THREAD_NOFLAGS) != TCL_OK) {
- Tcl_Panic("Tcl_InitNotifier: unable to start notifier thread");
- }
- }
- notifierCount++;
-
- if (GetCurrentEventLoop() == GetMainEventLoop()) {
- tsdPtr->isMainLoop = 1;
- } else {
- tsdPtr->isMainLoop = 0;
- }
-
- /*
- * Wait for the notifier pipe to be created.
- */
-
- while (triggerPipe < 0) {
- Tcl_ConditionWait(&notifierCV, &notifierMutex, NULL);
- }
-
- Tcl_MutexUnlock(&notifierMutex);
- return (ClientData) tsdPtr;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_FinalizeNotifier --
- *
- * This function is called to cleanup the notifier state before
- * a thread is terminated.
- *
- * Results:
- * None.
- *
- * Side effects:
- * May terminate the background notifier thread if this is the
- * last notifier instance.
+ * A new event source is created.
*
*----------------------------------------------------------------------
*/
void
-TkMacOSXFinalizeNotifier(clientData)
- ClientData clientData; /* Not used. */
+Tk_MacOSXSetupTkNotifier()
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
- Tcl_MutexLock(&notifierMutex);
- notifierCount--;
-
- /*
- * If this is the last thread to use the notifier, close the notifier
- * pipe and wait for the background thread to terminate.
- */
-
- if (notifierCount == 0) {
- if (triggerPipe < 0) {
- Tcl_Panic("Tcl_FinalizeNotifier: notifier pipe not initialized");
+
+ if (!tsdPtr->initialized) {
+ /* HACK ALERT: There is a bug in Jaguar where when it goes to make
+ * the event queue for the Main Event Loop, it stores the Current
+ * event loop rather than the Main Event Loop in the Queue structure.
+ * So we have to make sure that the Main Event Queue gets set up on
+ * the main thread. Calling GetMainEventQueue will force this to
+ * happen.
+ */
+ EventQueueRef mainEventQueue = GetMainEventQueue();
+
+ tsdPtr->initialized = 1;
+ /* Install Carbon events event source in main event loop thread. */
+ if (GetCurrentEventLoop() == GetMainEventLoop()) {
+ if (!pthread_main_np()) {
+ /*
+ * Panic if the Carbon main event loop thread (i.e. the
+ * thread where HIToolbox was first loaded) is not the
+ * main application thread, as Carbon does not support
+ * this properly.
+ */
+ Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s",
+ "first [load] of TkAqua has to occur in the main thread!");
+ }
+ Tcl_CreateEventSource(CarbonEventsSetupProc,
+ CarbonEventsCheckProc, GetMainEventQueue());
+ TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL);
}
-
- /*
- * Send "q" message to the notifier thread so that it will
- * terminate. The notifier will return from its call to select()
- * and notice that a "q" message has arrived, it will then close
- * its side of the pipe and terminate its thread. Note the we can
- * not just close the pipe and check for EOF in the notifier
- * thread because if a background child process was created with
- * exec, select() would not register the EOF on the pipe until the
- * child processes had terminated. [Bug: 4139]
- */
- write(triggerPipe, "q", 1);
- close(triggerPipe);
-
- Tcl_ConditionWait(&notifierCV, &notifierMutex, NULL);
}
-
- /*
- * Clean up any synchronization objects in the thread local storage.
- */
-
- Tcl_ConditionFinalize(&(tsdPtr->waitCV));
-
- Tcl_MutexUnlock(&notifierMutex);
}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_AlertNotifier --
- *
- * Wake up the specified notifier from any thread. This routine
- * is called by the platform independent notifier code whenever
- * the Tcl_ThreadAlert routine is called. This routine is
- * guaranteed not to be called on a given notifier after
- * Tcl_FinalizeNotifier is called for that notifier.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Signals the notifier condition variable for the specified
- * notifier.
- *
- *----------------------------------------------------------------------
- */
-void
-TkMacOSXAlertNotifier(clientData)
- ClientData clientData;
-{
- ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData;
- Tcl_MutexLock(&notifierMutex);
- tsdPtr->eventReady = 1;
- AlertNotifier(tsdPtr);
- Tcl_MutexUnlock(&notifierMutex);
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * AlertNotifier --
- *
- * The core of the notifier alerting scheme. Either we wake up
- * the main event loop and stuff the event to it, or we signal
- * the thread's condition variable. Note that callers are
- * responsible for locking the right mutexes, managing the rest
- * of the notifier state, etc. The thread to alert is determined
- * by whose tsdPtr we actually have as our argument. The only
- * expected callers are TkMacOSXAlertNotifier() and
- * NotifierThreadProc(), both of which take appropriate
- * precautions.
- *
- * Results:
- * none
- *
- * Side effects:
- * A notifier is alerted.
- *
- *----------------------------------------------------------------------
- */
-
-static void
-AlertNotifier(tsdPtr)
- ThreadSpecificData *tsdPtr;
-{
- if (tsdPtr->isMainLoop) {
- /* We need to wake up the main loop, and let it have the event. */
- EventRef fakeEvent = TkMacOSXCreateFakeEvent();
- EventQueueRef mainEventQueue = GetMainEventQueue();
- OSErr err;
-
- err = PostEventToQueue(mainEventQueue, fakeEvent, kEventPriorityHigh);
- ReleaseEvent(fakeEvent);
- } else {
- Tcl_ConditionNotify(&tsdPtr->waitCV);
- }
-}
-
/*
*----------------------------------------------------------------------
*
- * Tcl_SetTimer --
+ * TkMacOSXNotifyExitHandler --
*
- * This procedure sets the current notifier timer value. This
- * interface is not implemented in this notifier because we are
- * always running inside of Tcl_DoOneEvent.
+ * This function is called during finalization to clean up the
+ * TkMacOSXNotify module.
*
* Results:
* None.
@@ -467,693 +102,79 @@ AlertNotifier(tsdPtr)
*----------------------------------------------------------------------
*/
-void
-TkMacOSXSetTimer(timePtr)
- Tcl_Time *timePtr; /* Timeout value, may be NULL. */
-{
- /*
- * The interval timer doesn't do anything in this implementation,
- * because the only event loop is via Tcl_DoOneEvent, which passes
- * timeout values to Tcl_WaitForEvent.
- */
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_ServiceModeHook --
- *
- * This function is invoked whenever the service mode changes.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXServiceModeHook(mode)
- int mode; /* Either TCL_SERVICE_ALL, or
- * TCL_SERVICE_NONE. */
-{
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * Tcl_CreateFileHandler --
- *
- * This procedure registers a file handler with the select notifier.
- *
- * Results:
- * None.
- *
- * Side effects:
- * Creates a new file handler structure.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXCreateFileHandler(fd, mask, proc, clientData)
- int fd; /* Handle of stream to watch. */
- int mask; /* OR'ed combination of TCL_READABLE,
- * TCL_WRITABLE, and TCL_EXCEPTION:
- * indicates conditions under which
- * proc should be called. */
- Tcl_FileProc *proc; /* Procedure to call for each
- * selected event. */
- ClientData clientData; /* Arbitrary data to pass to proc. */
+static void
+TkMacOSXNotifyExitHandler(clientData)
+ ClientData clientData; /* Not used. */
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
- FileHandler *filePtr;
-
- for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
- filePtr = filePtr->nextPtr) {
- if (filePtr->fd == fd) {
- break;
- }
- }
- if (filePtr == NULL) {
- filePtr = (FileHandler*) ckalloc(sizeof(FileHandler));
- filePtr->fd = fd;
- filePtr->readyMask = 0;
- filePtr->nextPtr = tsdPtr->firstFileHandlerPtr;
- tsdPtr->firstFileHandlerPtr = filePtr;
- }
- filePtr->proc = proc;
- filePtr->clientData = clientData;
- filePtr->mask = mask;
-
- /*
- * Update the check masks for this file.
- */
- if (mask & TCL_READABLE) {
- FD_SET(fd, &(tsdPtr->checkMasks.readable));
- } else {
- FD_CLR(fd, &(tsdPtr->checkMasks.readable));
- }
- if (mask & TCL_WRITABLE) {
- FD_SET(fd, &(tsdPtr->checkMasks.writable));
- } else {
- FD_CLR(fd, &(tsdPtr->checkMasks.writable));
- }
- if (mask & TCL_EXCEPTION) {
- FD_SET(fd, &(tsdPtr->checkMasks.exceptional));
- } else {
- FD_CLR(fd, &(tsdPtr->checkMasks.exceptional));
- }
- if (tsdPtr->numFdBits <= fd) {
- tsdPtr->numFdBits = fd+1;
- }
+ Tcl_DeleteEventSource(CarbonEventsSetupProc,
+ CarbonEventsCheckProc, GetMainEventQueue());
+ tsdPtr->initialized = 0;
}
/*
*----------------------------------------------------------------------
*
- * Tcl_DeleteFileHandler --
+ * CarbonEventsSetupProc --
*
- * Cancel a previously-arranged callback arrangement for
- * a file.
+ * This procedure implements the setup part of the Carbon Events
+ * event source. It is invoked by Tcl_DoOneEvent before entering
+ * the notifier to check for events.
*
* Results:
* None.
*
* Side effects:
- * If a callback was previously registered on file, remove it.
+ * If Carbon events are queued, then the maximum block time will be
+ * set to 0 to ensure that the notifier returns control to Tcl.
*
*----------------------------------------------------------------------
*/
-void
-TkMacOSXDeleteFileHandler(fd)
- int fd; /* Stream id for which to remove callback procedure. */
+static void
+CarbonEventsSetupProc(clientData, flags)
+ ClientData clientData;
+ int flags;
{
- FileHandler *filePtr, *prevPtr;
- int i;
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
- /*
- * Find the entry for the given file (and return if there isn't one).
- */
-
- for (prevPtr = NULL, filePtr = tsdPtr->firstFileHandlerPtr; ;
- prevPtr = filePtr, filePtr = filePtr->nextPtr) {
- if (filePtr == NULL) {
- return;
- }
- if (filePtr->fd == fd) {
- break;
- }
- }
-
- /*
- * Update the check masks for this file.
- */
-
- if (filePtr->mask & TCL_READABLE) {
- FD_CLR(fd, &(tsdPtr->checkMasks.readable));
- }
- if (filePtr->mask & TCL_WRITABLE) {
- FD_CLR(fd, &(tsdPtr->checkMasks.writable));
- }
- if (filePtr->mask & TCL_EXCEPTION) {
- FD_CLR(fd, &(tsdPtr->checkMasks.exceptional));
- }
-
- /*
- * Find current max fd.
- */
+ static Tcl_Time blockTime = { 0, 0 };
- if (fd+1 == tsdPtr->numFdBits) {
- tsdPtr->numFdBits = 0;
- for (i = fd-1; i >= 0; i--) {
- if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
- || FD_ISSET(i, &(tsdPtr->checkMasks.writable))
- || FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
- tsdPtr->numFdBits = i+1;
- break;
- }
- }
+ if (!(flags & TCL_WINDOW_EVENTS)) {
+ return;
}
- /*
- * Clean up information in the callback record.
- */
-
- if (prevPtr == NULL) {
- tsdPtr->firstFileHandlerPtr = filePtr->nextPtr;
- } else {
- prevPtr->nextPtr = filePtr->nextPtr;
+ if (GetNumEventsInQueue((EventQueueRef)clientData)) {
+ Tcl_SetMaxBlockTime(&blockTime);
}
- ckfree((char *) filePtr);
}
-
-/*
- *----------------------------------------------------------------------
- *
- * FileHandlerEventProc --
- *
- * This procedure is called by Tcl_ServiceEvent when a file event
- * reaches the front of the event queue. This procedure is
- * responsible for actually handling the event by invoking the
- * callback for the file handler.
- *
- * Results:
- * Returns 1 if the event was handled, meaning it should be removed
- * from the queue. Returns 0 if the event was not handled, meaning
- * it should stay on the queue. The only time the event isn't
- * handled is if the TCL_FILE_EVENTS flag bit isn't set.
- *
- * Side effects:
- * Whatever the file handler's callback procedure does.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-FileHandlerEventProc(evPtr, flags)
- Tcl_Event *evPtr; /* Event to service. */
- int flags; /* Flags that indicate what events to
- * handle, such as TCL_FILE_EVENTS. */
-{
- int mask;
- FileHandler *filePtr;
- FileHandlerEvent *fileEvPtr = (FileHandlerEvent *) evPtr;
- ThreadSpecificData *tsdPtr;
-
- if (!(flags & TCL_FILE_EVENTS)) {
- return 0;
- }
-
- /*
- * Search through the file handlers to find the one whose handle matches
- * the event. We do this rather than keeping a pointer to the file
- * handler directly in the event, so that the handler can be deleted
- * while the event is queued without leaving a dangling pointer.
- */
-
- tsdPtr = TCL_TSD_INIT(&dataKey);
- for (filePtr = tsdPtr->firstFileHandlerPtr; filePtr != NULL;
- filePtr = filePtr->nextPtr) {
- if (filePtr->fd != fileEvPtr->fd) {
- continue;
- }
- /*
- * The code is tricky for two reasons:
- * 1. The file handler's desired events could have changed
- * since the time when the event was queued, so AND the
- * ready mask with the desired mask.
- * 2. The file could have been closed and re-opened since
- * the time when the event was queued. This is why the
- * ready mask is stored in the file handler rather than
- * the queued event: it will be zeroed when a new
- * file handler is created for the newly opened file.
- */
-
- mask = filePtr->readyMask & filePtr->mask;
- filePtr->readyMask = 0;
- if (mask != 0) {
- (*filePtr->proc)(filePtr->clientData, mask);
- }
- break;
- }
- return 1;
-}
-
/*
*----------------------------------------------------------------------
*
- * Tcl_WaitForEvent --
+ * CarbonEventsCheckProc --
*
- * This function is called by Tcl_DoOneEvent to wait for new
- * events on the message queue. If the block time is 0, then
- * Tcl_WaitForEvent just polls without blocking.
+ * This procedure processes events sitting in the Carbon event
+ * queue.
*
* Results:
- * Returns -1 if the select would block forever, otherwise
- * returns 0.
- *
- * Side effects:
- * Queues file events that are detected by the select.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacOSXWaitForEvent(timePtr)
- Tcl_Time *timePtr; /* Maximum block time, or NULL. */
-{
- FileHandler *filePtr;
- FileHandlerEvent *fileEvPtr;
- int mask;
- Tcl_Time myTime;
- int waitForFiles;
- Tcl_Time *myTimePtr;
- ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
-
- /*
- * Set up the timeout structure. Note that if there are no events to
- * check for, we return with a negative result rather than blocking
- * forever.
- */
-
- if (timePtr != NULL) {
- /* TIP #233 (Virtualized Time). Is virtual time in effect ?
- * And do we actually have something to scale ? If yes to both
- * then we call the handler to do this scaling */
-
- myTime.sec = timePtr->sec;
- myTime.usec = timePtr->usec;
-
- if (myTime.sec != 0 || myTime.usec != 0) {
- Tcl_ScaleTimeProc* tclScaleTimeProcPtr;
- ClientData tclTimeClientData;
-
- Tcl_QueryTimeProc(NULL, &tclScaleTimeProcPtr, &tclTimeClientData);
- (*tclScaleTimeProcPtr) (&myTime, tclTimeClientData);
- }
- myTimePtr = &myTime;
- } else {
- myTimePtr = NULL;
- }
-
- /*
- * Place this thread on the list of interested threads, signal the
- * notifier thread, and wait for a response or a timeout.
- */
-
- Tcl_MutexLock(&notifierMutex);
-
- waitForFiles = (tsdPtr->numFdBits > 0);
- if (myTimePtr != NULL && myTimePtr->sec == 0 && myTimePtr->usec == 0) {
- /*
- * Cannot emulate a polling select with a polling condition variable.
- * Instead, pretend to wait for files and tell the notifier
- * thread what we are doing. The notifier thread makes sure
- * it goes through select with its select mask in the same state
- * as ours currently is. We block until that happens.
- */
-
- waitForFiles = 1;
- tsdPtr->pollState = POLL_WANT;
- myTimePtr = NULL;
- } else {
- tsdPtr->pollState = 0;
- }
-
- if (waitForFiles) {
- /*
- * Add the ThreadSpecificData structure of this thread to the list
- * of ThreadSpecificData structures of all threads that are waiting
- * on file events.
- */
-
- tsdPtr->nextPtr = waitingListPtr;
- if (waitingListPtr) {
- waitingListPtr->prevPtr = tsdPtr;
- }
- tsdPtr->prevPtr = 0;
- waitingListPtr = tsdPtr;
- tsdPtr->onList = 1;
-
- write(triggerPipe, "", 1);
- }
-
- FD_ZERO(&(tsdPtr->readyMasks.readable));
- FD_ZERO(&(tsdPtr->readyMasks.writable));
- FD_ZERO(&(tsdPtr->readyMasks.exceptional));
-
- if (!tsdPtr->eventReady) {
- if (!tsdPtr->isMainLoop) {
- Tcl_ConditionWait(&tsdPtr->waitCV, &notifierMutex, myTimePtr);
- } else {
- OSErr err;
- EventRef eventRef;
- EventTime waitTime;
-
- if (myTimePtr == NULL) {
- waitTime = kEventDurationForever;
- } else {
- waitTime = myTimePtr->sec * kEventDurationSecond
- + myTimePtr->usec * kEventDurationMicrosecond;
- }
- Tcl_MutexUnlock(&notifierMutex);
- err = ReceiveNextEvent(0, NULL, waitTime, false, &eventRef);
- Tcl_MutexLock(&notifierMutex);
- }
- }
- tsdPtr->eventReady = 0;
-
- if (waitForFiles && tsdPtr->onList) {
- /*
- * Remove the ThreadSpecificData structure of this thread from the
- * waiting list. Alert the notifier thread to recompute its select
- * masks - skipping this caused a hang when trying to close a pipe
- * which the notifier thread was still doing a select on.
- */
-
- if (tsdPtr->prevPtr) {
- tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
- } else {
- waitingListPtr = tsdPtr->nextPtr;
- }
- if (tsdPtr->nextPtr) {
- tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
- }
- tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
- tsdPtr->onList = 0;
- write(triggerPipe, "", 1);
- }
-
- /*
- * Queue all detected file events before returning.
- */
-
- for (filePtr = tsdPtr->firstFileHandlerPtr; (filePtr != NULL);
- filePtr = filePtr->nextPtr) {
-
- mask = 0;
- if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.readable))) {
- mask |= TCL_READABLE;
- }
- if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.writable))) {
- mask |= TCL_WRITABLE;
- }
- if (FD_ISSET(filePtr->fd, &(tsdPtr->readyMasks.exceptional))) {
- mask |= TCL_EXCEPTION;
- }
-
- if (!mask) {
- continue;
- }
-
- /*
- * Don't bother to queue an event if the mask was previously
- * non-zero since an event must still be on the queue.
- */
-
- if (filePtr->readyMask == 0) {
- fileEvPtr = (FileHandlerEvent *) ckalloc(sizeof(FileHandlerEvent));
- fileEvPtr->header.proc = FileHandlerEventProc;
- fileEvPtr->fd = filePtr->fd;
- Tcl_QueueEvent((Tcl_Event *) fileEvPtr, TCL_QUEUE_TAIL);
- }
- filePtr->readyMask = mask;
- }
- Tcl_MutexUnlock(&notifierMutex);
-
- /*
- * Also queue the Mac Events found...
- */
- if (tsdPtr->isMainLoop) {
- TkMacOSXCountAndProcessMacEvents();
- }
-
- return 0;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * NotifierThreadProc --
- *
- * This routine is the initial (and only) function executed by the
- * special notifier thread. Its job is to wait for file descriptors
- * to become readable or writable or to have an exception condition
- * and then to notify other threads who are interested in this
- * information by signalling a condition variable. Other threads
- * can signal this notifier thread of a change in their interests
- * by writing a single byte to a special pipe that the notifier
- * thread is monitoring.
- *
- * Result:
- * None. Once started, this routine never exits. It dies with
- * the overall process.
+ * None.
*
* Side effects:
- * The trigger pipe used to signal the notifier thread is created
- * when the notifier thread first starts.
+ * Moves applicable queued Carbon events onto the Tcl event queue.
*
*----------------------------------------------------------------------
*/
static void
-NotifierThreadProc(clientData)
- ClientData clientData; /* Not used. */
+CarbonEventsCheckProc(clientData, flags)
+ ClientData clientData;
+ int flags;
{
- ThreadSpecificData *tsdPtr;
- fd_set readableMask;
- fd_set writableMask;
- fd_set exceptionalMask;
- int fds[2];
- int i, status, numFdBits = 0, receivePipe;
- long found;
- struct timeval poll = {0., 0.}, *timePtr;
- char buf[2];
-
- if (pipe(fds) != 0) {
- Tcl_Panic("NotifierThreadProc: could not create trigger pipe.");
- }
-
- receivePipe = fds[0];
-
- status = fcntl(receivePipe, F_GETFL);
- status |= O_NONBLOCK;
- if (fcntl(receivePipe, F_SETFL, status) < 0) {
- Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking.");
+ if (!(flags & TCL_WINDOW_EVENTS)) {
+ return;
}
- status = fcntl(fds[1], F_GETFL);
- status |= O_NONBLOCK;
- if (fcntl(fds[1], F_SETFL, status) < 0) {
- Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking.");
- }
-
- /*
- * Install the write end of the pipe into the global variable.
- */
-
- Tcl_MutexLock(&notifierMutex);
- triggerPipe = fds[1];
-
- /*
- * Signal any threads that are waiting.
- */
-
- Tcl_ConditionNotify(&notifierCV);
- Tcl_MutexUnlock(&notifierMutex);
-
- /*
- * Look for file events and report them to interested threads.
- */
-
- while (1) {
- FD_ZERO(&readableMask);
- FD_ZERO(&writableMask);
- FD_ZERO(&exceptionalMask);
-
- /*
- * Compute the logical OR of the select masks from all the
- * waiting notifiers.
- */
-
- Tcl_MutexLock(&notifierMutex);
- timePtr = NULL;
- for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
- for (i = tsdPtr->numFdBits-1; i >= 0; --i) {
- if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))) {
- FD_SET(i, &readableMask);
- }
- if (FD_ISSET(i, &(tsdPtr->checkMasks.writable))) {
- FD_SET(i, &writableMask);
- }
- if (FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))) {
- FD_SET(i, &exceptionalMask);
- }
- }
- if (tsdPtr->numFdBits > numFdBits) {
- numFdBits = tsdPtr->numFdBits;
- }
- if (tsdPtr->pollState & POLL_WANT) {
- /*
- * Here we make sure we go through select() with the same
- * mask bits that were present when the thread tried to poll.
- */
-
- tsdPtr->pollState |= POLL_DONE;
- timePtr = &poll;
- }
- }
- Tcl_MutexUnlock(&notifierMutex);
-
- /*
- * Set up the select mask to include the receive pipe.
- */
-
- if (receivePipe >= numFdBits) {
- numFdBits = receivePipe + 1;
- }
- FD_SET(receivePipe, &readableMask);
-
- if (select(numFdBits, &readableMask, &writableMask, &exceptionalMask,
- timePtr) == -1) {
- /*
- * Try again immediately on an error.
- */
-
- continue;
- }
-
- /*
- * Alert any threads that are waiting on a ready file descriptor.
- */
-
- Tcl_MutexLock(&notifierMutex);
- for (tsdPtr = waitingListPtr; tsdPtr; tsdPtr = tsdPtr->nextPtr) {
- found = 0;
-
- for (i = tsdPtr->numFdBits-1; i >= 0; --i) {
- if (FD_ISSET(i, &(tsdPtr->checkMasks.readable))
- && FD_ISSET(i, &readableMask)) {
- FD_SET(i, &(tsdPtr->readyMasks.readable));
- found = 1;
- }
- if (FD_ISSET(i, &(tsdPtr->checkMasks.writable))
- && FD_ISSET(i, &writableMask)) {
- FD_SET(i, &(tsdPtr->readyMasks.writable));
- found = 1;
- }
- if (FD_ISSET(i, &(tsdPtr->checkMasks.exceptional))
- && FD_ISSET(i, &exceptionalMask)) {
- FD_SET(i, &(tsdPtr->readyMasks.exceptional));
- found = 1;
- }
- }
-
- if (found || (tsdPtr->pollState & POLL_DONE)) {
- tsdPtr->eventReady = 1;
- if (tsdPtr->onList) {
- /*
- * Remove the ThreadSpecificData structure of this
- * thread from the waiting list. This prevents us from
- * continuously spining on select until the other
- * threads runs and services the file event.
- */
-
- if (tsdPtr->prevPtr) {
- tsdPtr->prevPtr->nextPtr = tsdPtr->nextPtr;
- } else {
- waitingListPtr = tsdPtr->nextPtr;
- }
- if (tsdPtr->nextPtr) {
- tsdPtr->nextPtr->prevPtr = tsdPtr->prevPtr;
- }
- tsdPtr->nextPtr = tsdPtr->prevPtr = NULL;
- tsdPtr->onList = 0;
- tsdPtr->pollState = 0;
- }
- AlertNotifier(tsdPtr);
- }
- }
- Tcl_MutexUnlock(&notifierMutex);
-
- /*
- * Consume the next byte from the notifier pipe if the pipe was
- * readable. Note that there may be multiple bytes pending, but
- * to avoid a race condition we only read one at a time.
- */
-
- if (FD_ISSET(receivePipe, &readableMask)) {
- i = read(receivePipe, buf, 1);
-
- if ((i == 0) || ((i == 1) && (buf[0] == 'q'))) {
- /*
- * Someone closed the write end of the pipe or sent us a
- * Quit message [Bug: 4139] and then closed the write end
- * of the pipe so we need to shut down the notifier thread.
- */
-
- break;
- }
- }
- }
-
- /*
- * Clean up the read end of the pipe and signal any threads waiting on
- * termination of the notifier thread.
- */
-
- close(receivePipe);
- Tcl_MutexLock(&notifierMutex);
- triggerPipe = -1;
- Tcl_ConditionNotify(&notifierCV);
- Tcl_MutexUnlock(&notifierMutex);
-
- Tcl_ExitThread(0);
-}
-
-EventRef
-TkMacOSXCreateFakeEvent()
-{
- EventKind eKind;
- EventClass eClass;
- EventTime eTime;
- EventRef eventRef;
- EventAttributes flags;
- eClass = kEventClassWish;
- eKind = 0xffff;
- eTime = GetLastUserEventTime() + 0.001;
- flags = kEventAttributeUserEvent;
- if (CreateEvent(NULL,eClass,eKind,eTime,flags,&eventRef) != noErr) {
- /* DKF: Printing to stderr? Leaked debug code here? */
- fprintf(stderr, "CreateEvent failed\n");
- return NULL;
+ if (GetNumEventsInQueue((EventQueueRef)clientData)) {
+ TkMacOSXCountAndProcessMacEvents();
}
- return eventRef;
}
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index fafa6f8..4ca74d7 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -12,7 +12,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.17 2005/04/07 20:14:24 mdejong Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.18 2005/05/14 20:48:15 das Exp $
*/
#include <Carbon/Carbon.h>
@@ -873,7 +873,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
break;
case WmAttrTitlePathIdx:
err = FSPathMakeRef(
- Tcl_GetStringFromObj(objv[i+1], NULL),
+ (unsigned char*) Tcl_GetStringFromObj(objv[i+1], NULL),
&ref, &isDirectory);
if (err == noErr) {
err = FSNewAlias(NULL, &ref, &alias);
@@ -974,7 +974,7 @@ static void WmAttrGetTitlePath(WindowRef macWindow, Tcl_Obj *result)
err = FSRefMakePath(&ref, path, 2048);
}
if (err == noErr) {
- Tcl_AppendToObj(result, path, -1);
+ Tcl_AppendToObj(result, (char*) path, -1);
} else {
Tcl_AppendToObj(result, "{}", -1);
}
@@ -1687,7 +1687,7 @@ Tcl_Obj *CONST objv[]; /* Argument objects. */
AliasHandle alias;
FSRef ref;
Boolean isDirectory;
- err = FSPathMakeRef(Tcl_GetStringFromObj(objv[3], NULL), &ref, &isDirectory);
+ err = FSPathMakeRef((unsigned char*) Tcl_GetStringFromObj(objv[3], NULL), &ref, &isDirectory);
if (err == noErr) {
err = FSNewAlias(NULL, &ref, &alias);
if (err == noErr) {
@@ -4588,7 +4588,7 @@ TkSetWMName(
}
if (strlen(titleUid) > 0) {
- title = CFStringCreateWithBytes(NULL, titleUid, strlen(titleUid),
+ title = CFStringCreateWithBytes(NULL, (unsigned char*) titleUid, strlen(titleUid),
kCFStringEncodingUTF8, false);
} else {
title = NULL;
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index e43f1ab..f88a4e3 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.7 2004/11/13 03:41:47 das Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.8 2005/05/14 20:48:15 das Exp $
*/
#include "tkInt.h"
@@ -365,7 +365,7 @@ XGetImage(display, d, x, y, width, height, plane_mask, format)
int format;
{
XImage * imagePtr = NULL;
- Pixmap pixmap = NULL;
+ Pixmap pixmap = (Pixmap) NULL;
Tk_Window win = (Tk_Window) ((MacDrawable *) d)->winPtr;
GC gc;
int depth = 32;