summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-09-06 19:33:55 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-09-06 19:33:55 (GMT)
commit9eeb6e7a4f32a9f04cd022da83bea178402826a0 (patch)
tree4aebeffff53b38e3d8e3842c7690bccefd435a3c /generic
parent3ef61115ff6c1802994c2c0e59e140cf7f628220 (diff)
downloadtk-9eeb6e7a4f32a9f04cd022da83bea178402826a0.zip
tk-9eeb6e7a4f32a9f04cd022da83bea178402826a0.tar.gz
tk-9eeb6e7a4f32a9f04cd022da83bea178402826a0.tar.bz2
* 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].
Diffstat (limited to 'generic')
-rw-r--r--generic/tkInitScript.h54
-rw-r--r--generic/tkWindow.c24
2 files changed, 23 insertions, 55 deletions
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