summaryrefslogtreecommitdiffstats
path: root/generic/tkMain.c
diff options
context:
space:
mode:
authordas <das>2007-03-07 23:46:33 (GMT)
committerdas <das>2007-03-07 23:46:33 (GMT)
commit3288ca4931072f874190455b686106df2d756cbd (patch)
treeb327533aebd6e8b2b22cd04e1e847fddbe5de52d /generic/tkMain.c
parent377fc83bb085523c857545603b7cd054ef49f160 (diff)
downloadtk-3288ca4931072f874190455b686106df2d756cbd.zip
tk-3288ca4931072f874190455b686106df2d756cbd.tar.gz
tk-3288ca4931072f874190455b686106df2d756cbd.tar.bz2
* generic/tkMain.c (Tk_MainEx): replicate macosx-specific code from
TkpInit() that ensures the console window appears when wish is started from the OS X Finder (i.e. with stdin == /dev/null), jeffh's 2006-11-24 change rendered the corresponding code in TkpInit() ineffective in wish because Tk_MainEx() sets tcl_interactive before calling TkpInit(). * generic/ttk/ttkGenStubs.tcl (new): add ttk-specific genstubs.tcl from * unix/Makefile.in (genstubs): tile and run it from 'genstubs' target, restores ability to generate all of Tk's stub sources. * generic/ttk/ttkTreeview.c: #ifdef out unused declaration. * macosx/tkMacOSXDebug.c (TkMacOSXGetNamedDebugSymbol): add fix for libraries loaded with a DYLD_IMAGE_SUFFIX. * macosx/Wish.xcodeproj/project.pbxproj: ensure gcc version used by * macosx/Wish.xcodeproj/default.pbxuser: Xcode and configure/make are * macosx/Wish-Common.xcconfig: consistent and independent of gcc_select default and CC env var; fixes for Xcode 3.0. * unix/tcl.m4 (Darwin): s/CFLAGS/CPPFLAGS/ in macosx-version-min check. * unix/configure: autoconf-2.59
Diffstat (limited to 'generic/tkMain.c')
-rw-r--r--generic/tkMain.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 813343a..bf478fc 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.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: tkMain.c,v 1.22 2006/09/22 19:02:07 andreas_kupries Exp $
+ * RCS: @(#) $Id: tkMain.c,v 1.23 2007/03/07 23:46:33 das Exp $
*/
#include <ctype.h>
@@ -99,7 +99,7 @@ Tk_MainEx(
{
Tcl_Obj *path, *argvPtr;
CONST char *encodingName;
- int code;
+ int code, nullStdin = 0;
Tcl_Channel inChannel, outChannel;
ThreadSpecificData *tsdPtr;
#ifdef __WIN32__
@@ -206,6 +206,7 @@ Tk_MainEx(
* Set the "tcl_interactive" variable.
*/
+#ifdef __WIN32__
/*
* For now, under Windows, we assume we are not running as a console mode
* app, so we need to use the GUI console. In order to enable this, we
@@ -213,7 +214,6 @@ Tk_MainEx(
* to do it.
*/
-#ifdef __WIN32__
handle = GetStdHandle(STD_INPUT_HANDLE);
if ((handle == INVALID_HANDLE_VALUE) || (handle == 0)
@@ -237,8 +237,22 @@ Tk_MainEx(
#else
tsdPtr->tty = isatty(0);
#endif
+#if defined(MAC_OSX_TK)
+ /*
+ * On TkAqua, 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 GUI console.
+ */
+
+ if (!tsdPtr->tty) {
+ struct stat st;
+
+ nullStdin = fstat(0, &st) || (S_ISCHR(st.st_mode) && !st.st_blocks);
+ }
+#endif
Tcl_SetVar(interp, "tcl_interactive",
- ((path == NULL) && tsdPtr->tty) ? "1" : "0", TCL_GLOBAL_ONLY);
+ ((path == NULL) && (tsdPtr->tty || nullStdin)) ? "1" : "0",
+ TCL_GLOBAL_ONLY);
/*
* Invoke application-specific initialization.