summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorhobbs <hobbs>2006-11-24 19:03:50 (GMT)
committerhobbs <hobbs>2006-11-24 19:03:50 (GMT)
commitc436a58bde358e41f6c12f08c112a2b52754fd58 (patch)
treec4dd4bb1b1b95fa4b1f6d03510c4dcbb6e0addb8 /macosx
parent97b9a81b9a7c013a7e2f45ec81b6767f7055b467 (diff)
downloadtk-c436a58bde358e41f6c12f08c112a2b52754fd58.zip
tk-c436a58bde358e41f6c12f08c112a2b52754fd58.tar.gz
tk-c436a58bde358e41f6c12f08c112a2b52754fd58.tar.bz2
* macosx/tkMacOSXInit.c (TkpInit): only set tcl_interactive 1 if
it isn't already defined. Allows embedders to set it to 0 to prevent the console appearing on OS X. [Bug 1487701]
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXInit.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index cc4f062..d3492c4 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.24 2006/10/16 15:35:28 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.25 2006/11/24 19:03:50 hobbs Exp $
*/
#include "tkMacOSXInt.h"
@@ -224,12 +224,6 @@ TkpInit(interp)
}
}
- /*
- * If we don't have a TTY and stdin is a special character file of length 0,
- * (e.g. /dev/null, which is what Finder sets when double clicking Wish)
- * then use the Tk based console interpreter.
- */
-
/* REMOVE ME: Close stdin & stdout for remote debugging otherwise we
* will fight with gdb for stdin & stdout
*/
@@ -239,6 +233,12 @@ TkpInit(interp)
close (1);
}
+ /*
+ * If we don't have a TTY and stdin is a special character file of
+ * length 0, (e.g. /dev/null, which is what Finder sets when double
+ * clicking Wish) then use the Tk based console interpreter.
+ */
+
if (!isatty(0)) {
struct stat st;
if (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)) {
@@ -246,9 +246,17 @@ TkpInit(interp)
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
- /* Only show the console if we don't have a startup script */
+ /*
+ * Only show the console if we don't have a startup script
+ * and tcl_interactive hasn't been set already.
+ */
if (Tcl_GetStartupScript(NULL) == NULL) {
- Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
+ CONST char *intvar =
+ Tcl_GetVar(interp, "tcl_interactive", TCL_GLOBAL_ONLY);
+ if (intvar == NULL) {
+ Tcl_SetVar(interp, "tcl_interactive", "1",
+ TCL_GLOBAL_ONLY);
+ }
}
if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
return TCL_ERROR;
@@ -257,10 +265,10 @@ TkpInit(interp)
}
/*
- * If we are loaded into an executable that is not a bundled application,
- * the window server does not let us come to the foreground.
- * For such an executable, notify the window server that we are now a
- * full GUI application.
+ * If we are loaded into an executable that is not a bundled
+ * application, the window server does not let us come to the
+ * foreground. For such an executable, notify the window server that
+ * we are now a full GUI application.
*/
{
/* Check whether we are a bundled executable: */