summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--generic/tkInitScript.h54
-rw-r--r--generic/tkWindow.c24
-rw-r--r--macosx/tkMacOSXInit.c10
-rw-r--r--unix/Makefile.in6
-rw-r--r--unix/tkUnixInit.c11
-rw-r--r--win/tkWinInit.c10
7 files changed, 44 insertions, 83 deletions
diff --git a/ChangeLog b/ChangeLog
index 22d5334..b842e15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-09-06 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tkWindow.c (Initialize): Moved common Tk initialization
+ * generic/tkInitScript.h (removed): script out of tkInitScript.h
+ * macosx/tkMacOSXInit.c: and multiple TkpInit() routines and
+ * unix/Makefile.in: into the common Initialize() routine in
+ * unix/tkUnixInit.c: generic code. Also removed constraint on
+ * win/tkWinInit.c: ability to define a custom [tkInit] before
+ calling Tk_Init(). Until now the custom [tkInit] had to be a proc.
+ Now it can be any command. Removal of tkInitScript.h also fixes
+ [Bug 1656283].
+
2007-09-06 Daniel Steffen <das@users.sourceforge.net>
* macosx/Wish.xcode/project.pbxproj: discontinue unmaintained support
diff --git a/generic/tkInitScript.h b/generic/tkInitScript.h
deleted file mode 100644
index ee86e1b..0000000
--- a/generic/tkInitScript.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * tkInitScript.h --
- *
- * This file contains Unix & Windows common init script
- *
- * Copyright (c) 1997 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution of
- * this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * RCS: @(#) $Id: tkInitScript.h,v 1.10 2005/11/15 15:18:21 dkf Exp $
- */
-
-/*
- * In order to find tk.tcl during initialization, the following script is
- * invoked by Tk_Init(). It looks in several different directories:
- *
- * $tk_library - can specify a primary location, if set no
- * other locations will be checked
- *
- * $env(TK_LIBRARY) - highest priority so user can always override
- * the search path unless the application has
- * specified an exact directory above
- *
- * $tcl_library/../tk$tk_version
- * - look relative to init.tcl in an installed
- * lib directory (e.g. /usr/local)
- *
- * <executable directory>/../lib/tk$tk_version
- * - look for a lib/tk<ver> in a sibling of the
- * bin directory (e.g. /usr/local)
- *
- * <executable directory>/../library
- * - look in Tk build directory
- *
- * <executable directory>/../../tk$tk_patchLevel/library
- * - look for Tk build directory relative to a
- * parallel build directory
- *
- * The first directory on this path that contains a valid tk.tcl script will
- * be set ast the value of tk_library.
- *
- * Note that this entire search mechanism can be bypassed by defining an
- * alternate tkInit procedure before calling Tk_Init().
- */
-
-static char initScript[] = "if {[info proc tkInit]==\"\"} {\n\
- proc tkInit {} {\n\
- global tk_library tk_version tk_patchLevel\n\
- rename tkInit {}\n\
- tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\
- }\n\
-}\n\
-tkInit";
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 4a821e0..2397347 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.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: tkWindow.c,v 1.80 2007/02/13 00:16:39 dkf Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.81 2007/09/06 19:33:55 dgp Exp $
*/
#include "tkPort.h"
@@ -3233,6 +3233,28 @@ Initialize(
}
code = TkpInit(interp);
if (code == TCL_OK) {
+
+ /*
+ * In order to find tk.tcl during initialization, we evaluate the
+ * following script. It calls on the Tcl command [tcl_findLibrary]
+ * to perform the search. See the docs for that command for details
+ * on where it looks.
+ *
+ * Note that this entire search mechanism can be bypassed by defining
+ * an alternate [tkInit] command before calling Tk_Init().
+ */
+
+ code = Tcl_Eval(interp,
+"if {[namespace which -command tkInit] eq \"\"} {\n\
+ proc tkInit {} {\n\
+ global tk_library tk_version tk_patchLevel\n\
+ rename tkInit {}\n\
+ tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\
+ }\n\
+}\n\
+tkInit");
+ }
+ if (code == TCL_OK) {
/*
* Create exit handlers to delete all windows when the application or
* thread exits. The handler need to be invoked before other platform
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index bf6ef38..615b35d 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.32 2007/06/29 03:20:01 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.33 2007/09/06 19:33:56 dgp Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -24,12 +24,6 @@
#include <mach-o/getsect.h>
/*
- * The Init script (common to Windows and Unix platforms) is
- * defined in tkInitScript.h
- */
-#include "tkInitScript.h"
-
-/*
* Define the following to 0 to not attempt to use an undocumented SPI
* to notify the window server that an unbundled executable is a full
* GUI application after loading Tk.
@@ -387,7 +381,7 @@ TkpInit(
TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE);
}
- return Tcl_EvalEx(interp, initScript, -1, TCL_EVAL_GLOBAL);
+ return TCL_OK;
}
/*
diff --git a/unix/Makefile.in b/unix/Makefile.in
index 34f00b8..4e2e8fa 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -5,7 +5,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.135 2007/09/05 01:39:45 das Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.136 2007/09/06 19:34:02 dgp Exp $
# Current Tk version; used in various names.
@@ -1167,7 +1167,7 @@ tkUnixFont.o: $(UNIX_DIR)/tkUnixFont.c
tkUnixRFont.o: $(UNIX_DIR)/tkUnixRFont.c
$(CC) -c $(CC_SWITCHES) $(XFT_CFLAGS) $(UNIX_DIR)/tkUnixRFont.c
-tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
+tkUnixInit.o: $(UNIX_DIR)/tkUnixInit.c tkConfig.sh
$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(UNIX_DIR)/tkUnixInit.c
@@ -1243,7 +1243,7 @@ tkMacOSXFont.o: $(MAC_OSX_DIR)/tkMacOSXFont.c
tkMacOSXHLEvents.o: $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
$(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXHLEvents.c
-tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c $(GENERIC_DIR)/tkInitScript.h tkConfig.sh
+tkMacOSXInit.o: $(MAC_OSX_DIR)/tkMacOSXInit.c tkConfig.sh
$(CC) -c $(CC_SWITCHES) -DTK_LIBRARY=\"${TK_LIBRARY}\" \
$(MAC_OSX_DIR)/tkMacOSXInit.c
diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c
index 4fbef46..b493c2a 100644
--- a/unix/tkUnixInit.c
+++ b/unix/tkUnixInit.c
@@ -8,19 +8,12 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixInit.c,v 1.7 2005/11/14 11:54:21 dkf Exp $
+ * RCS: @(#) $Id: tkUnixInit.c,v 1.8 2007/09/06 19:34:02 dgp Exp $
*/
#include "tkInt.h"
#include "tkUnixInt.h"
-/*
- * The Init script (common to Windows and Unix platforms) is defined in
- * tkInitScript.h
- */
-
-#include "tkInitScript.h"
-
#ifdef HAVE_COREFOUNDATION
static int GetLibraryPath(Tcl_Interp *interp);
#else
@@ -51,7 +44,7 @@ TkpInit(
{
TkCreateXEventSource();
GetLibraryPath(interp);
- return Tcl_Eval(interp, initScript);
+ return TCL_OK;
}
/*
diff --git a/win/tkWinInit.c b/win/tkWinInit.c
index 71c98af..cd187f7 100644
--- a/win/tkWinInit.c
+++ b/win/tkWinInit.c
@@ -9,17 +9,11 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinInit.c,v 1.12 2005/12/02 00:19:04 dkf Exp $
+ * RCS: @(#) $Id: tkWinInit.c,v 1.13 2007/09/06 19:34:02 dgp Exp $
*/
#include "tkWinInt.h"
-/*
- * The Init script (common to Windows and Unix platforms) is defined in
- * tkInitScript.h
- */
-
-#include "tkInitScript.h"
/*
*----------------------------------------------------------------------
@@ -49,7 +43,7 @@ TkpInit(
*/
TkWinXInit(Tk_GetHINSTANCE());
- return Tcl_Eval(interp, initScript);
+ return TCL_OK;
}
/*