summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkAboutDlg.r4
-rw-r--r--macosx/tkMacOSXAppInit.c35
-rw-r--r--macosx/tkMacOSXApplication.r4
-rw-r--r--macosx/tkMacOSXHLEvents.c16
-rw-r--r--macosx/tkMacOSXLibrary.r4
-rw-r--r--macosx/tkMacOSXResource.r4
6 files changed, 42 insertions, 25 deletions
diff --git a/macosx/tkAboutDlg.r b/macosx/tkAboutDlg.r
index 13f0679..b60f09a 100644
--- a/macosx/tkAboutDlg.r
+++ b/macosx/tkAboutDlg.r
@@ -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: tkAboutDlg.r,v 1.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkAboutDlg.r,v 1.3 2002/09/12 17:34:16 das Exp $
*/
@@ -28,7 +28,7 @@
* the version string for Tcl.
*/
-#define RESOURCE_INCLUDED
+#define RC_INVOKED
#include <Carbon.r>
#include <tcl.h>
#include "tk.h"
diff --git a/macosx/tkMacOSXAppInit.c b/macosx/tkMacOSXAppInit.c
index 422546b..55863a1 100644
--- a/macosx/tkMacOSXAppInit.c
+++ b/macosx/tkMacOSXAppInit.c
@@ -11,9 +11,10 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXAppInit.c,v 1.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkMacOSXAppInit.c,v 1.3 2002/09/12 17:34:16 das Exp $
*/
#include <pthread.h>
+#include <sys/stat.h>
#include "tk.h"
#include "tclInt.h"
#include "locale.h"
@@ -190,22 +191,26 @@ Tcl_AppInit(interp)
#endif /* TK_TEST */
/*
- * If we don't have a TTY, then use the Tk based console
- * interpreter instead.
+ * 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 (ttyname(0) == NULL) {
- Tk_InitConsoleChannels(interp);
- Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
- Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
- Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
- if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
- goto error;
- }
- /* Only show the console if we don't have a startup script */
- if (TclGetStartupScriptPath() == NULL) {
- Tcl_Eval(interp, "console show");
- }
+ if (!isatty(0)) {
+ struct stat st;
+ if (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)) {
+ Tk_InitConsoleChannels(interp);
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
+ Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
+ if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
+ goto error;
+ }
+ /* Only show the console if we don't have a startup script */
+ if (TclGetStartupScriptPath() == NULL) {
+ Tcl_Eval(interp, "console show");
+ }
+ }
}
/*
diff --git a/macosx/tkMacOSXApplication.r b/macosx/tkMacOSXApplication.r
index 0012f29..ece3891 100644
--- a/macosx/tkMacOSXApplication.r
+++ b/macosx/tkMacOSXApplication.r
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXApplication.r,v 1.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkMacOSXApplication.r,v 1.3 2002/09/12 17:34:16 das Exp $
*/
#include <Carbon/Carbon.r>
@@ -18,7 +18,7 @@
* the version string for Tcl.
*/
-#define RESOURCE_INCLUDED
+#define RC_INVOKED
#include "tk.h"
#if (TK_RELEASE_LEVEL == 0)
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 4a1d30c..41b707f 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.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXHLEvents.c,v 1.3 2002/09/12 17:34:16 das Exp $
*/
#include "tkMacOSXUtil.h"
@@ -36,6 +36,7 @@ typedef struct KillEvent {
static OSErr QuitHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon);
static OSErr OappHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon);
+static OSErr RappHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon);
static OSErr OdocHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon);
static OSErr PrintHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon);
static OSErr ScriptHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon);
@@ -66,7 +67,7 @@ TkMacOSXInitAppleEvents(
Tcl_Interp *interp) /* Interp to handle basic events. */
{
OSErr err;
- AEEventHandlerUPP OappHandlerUPP, OdocHandlerUPP,
+ AEEventHandlerUPP OappHandlerUPP, RappHandlerUPP, OdocHandlerUPP,
PrintHandlerUPP, QuitHandlerUPP, ScriptHandlerUPP,
PrefsHandlerUPP;
@@ -81,6 +82,10 @@ TkMacOSXInitAppleEvents(
err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
OappHandlerUPP, (long) interp, false);
+ RappHandlerUPP = NewAEEventHandlerUPP(RappHandler);
+ err = AEInstallEventHandler(kCoreEventClass, kAEReopenApplication,
+ RappHandlerUPP, (long) interp, false);
+
OdocHandlerUPP = NewAEEventHandlerUPP(OdocHandler);
err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
OdocHandlerUPP, (long) interp, false);
@@ -165,6 +170,13 @@ OappHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon)
return noErr;
}
+static OSErr
+RappHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon)
+{
+ ProcessSerialNumber thePSN = {0, kCurrentProcess};
+ return SetFrontProcess(&thePSN);
+}
+
/* Called when the user selects 'Preferences...' in MacOS X */
static OSErr
PrefsHandler (const AppleEvent * event, AppleEvent * reply, long handlerRefcon)
diff --git a/macosx/tkMacOSXLibrary.r b/macosx/tkMacOSXLibrary.r
index 4baf9b5..61f3b86 100644
--- a/macosx/tkMacOSXLibrary.r
+++ b/macosx/tkMacOSXLibrary.r
@@ -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: tkMacOSXLibrary.r,v 1.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXLibrary.r,v 1.3 2002/09/12 17:34:16 das Exp $
*/
/*
@@ -32,7 +32,7 @@
* the version string for Tcl.
*/
-#define RESOURCE_INCLUDED
+#define RC_INVOKED
#include <tcl.h>
#include "tk.h"
diff --git a/macosx/tkMacOSXResource.r b/macosx/tkMacOSXResource.r
index 51a19c1..ace7df1 100644
--- a/macosx/tkMacOSXResource.r
+++ b/macosx/tkMacOSXResource.r
@@ -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: tkMacOSXResource.r,v 1.2 2002/08/31 06:12:30 das Exp $
+ * RCS: @(#) $Id: tkMacOSXResource.r,v 1.3 2002/09/12 17:34:16 das Exp $
*/
/*
@@ -28,7 +28,7 @@
* the version string for Tcl.
*/
-#define RESOURCE_INCLUDED
+#define RC_INVOKED
#include "tcl.h"
#include "tk.h"