summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2002-09-12 17:34:15 (GMT)
committerdas <das>2002-09-12 17:34:15 (GMT)
commit3511aff356300b3c67bb9cdea914d9d0680818f9 (patch)
tree5accee31b778ee9409cf319d46f1fab25dc6353b
parentd4c4c3a8f8edcc54b1e28e0ef3eaade3e5f2adce (diff)
downloadtk-3511aff356300b3c67bb9cdea914d9d0680818f9.zip
tk-3511aff356300b3c67bb9cdea914d9d0680818f9.tar.gz
tk-3511aff356300b3c67bb9cdea914d9d0680818f9.tar.bz2
* generic/tk.h:
* mac/tkMacApplication.r: * mac/tkMacLibrary.r: * mac/tkMacResource.r: * macosx/tkAboutDlg.r: * macosx/tkMacOSXApplication.r: * macosx/tkMacOSXLibrary.r: * macosx/tkMacOSXResource.r: unified use of the two equivalent resource compiler header inclusion defines RC_INVOKED and RESOURCE_INCLUDED, now use RC_INVOKED throughout. * macosx/tkMacOSXAppInit.c: improved detection of Wish startup by the finder (by checking if stdin is /dev/null), in which case we want to bring up the Tk console window. * macosx/tkMacOSXHLEvents.c: added 'rapp' apple event handler.
-rw-r--r--ChangeLog19
-rw-r--r--generic/tk.h27
-rw-r--r--mac/tkMacApplication.r4
-rw-r--r--mac/tkMacLibrary.r4
-rw-r--r--mac/tkMacResource.r4
-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
11 files changed, 78 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 70817ea..a46c91f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
2002-09-12 Daniel Steffen <das@users.sourceforge.net>
+ * generic/tk.h:
+ * mac/tkMacApplication.r:
+ * mac/tkMacLibrary.r:
+ * mac/tkMacResource.r:
+ * macosx/tkAboutDlg.r:
+ * macosx/tkMacOSXApplication.r:
+ * macosx/tkMacOSXLibrary.r:
+ * macosx/tkMacOSXResource.r: unified use of the two equivalent
+ resource compiler header inclusion defines RC_INVOKED and
+ RESOURCE_INCLUDED, now use RC_INVOKED throughout.
+
+ * macosx/tkMacOSXAppInit.c: improved detection of Wish startup
+ by the finder (by checking if stdin is /dev/null), in which
+ case we want to bring up the Tk console window.
+
+ * macosx/tkMacOSXHLEvents.c: added 'rapp' apple event handler.
+
+2002-09-12 Daniel Steffen <das@users.sourceforge.net>
+
* macosx/Wish.pbproj/project.pbxproj: reference & install
tk/generic/prolog.ps instead of tk/library/prolog.ps.
diff --git a/generic/tk.h b/generic/tk.h
index 47eb8df..9557eae 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk.h,v 1.69 2002/09/02 20:16:59 hobbs Exp $
+ * RCS: @(#) $Id: tk.h,v 1.70 2002/09/12 17:34:15 das Exp $
*/
#ifndef _TK
@@ -53,13 +53,17 @@ extern "C" {
#define TK_VERSION "8.4"
#define TK_PATCH_LEVEL "8.4.0"
-/*
- * A special define for MacOS & MacOS X, allows us to use the header
- * in the resource compiler without having it choke on the more complex
- * C preprocessor constructs.
+/*
+ * A special definition used to allow this header file to be included
+ * from windows or mac resource files so that they can obtain version
+ * information. RC_INVOKED is defined by default by the windows RC tool
+ * and manually set for macintosh.
+ *
+ * Resource compilers don't like all the C stuff, like typedefs and
+ * procedure declarations, that occur below, so block them out.
*/
-#ifndef RESOURCE_INCLUDED
+#ifndef RC_INVOKED
/*
* The following definitions set up the proper options for Macintosh
@@ -79,13 +83,6 @@ extern "C" {
# endif
#endif
-/*
- * A special definition used to allow this header file to be included
- * in resource files.
- */
-
-#ifndef RC_INVOKED
-
#ifndef _XLIB_H
# if defined (MAC_TCL)
# include <Xlib.h>
@@ -1601,12 +1598,10 @@ typedef int (Tk_SelectionProc) _ANSI_ARGS_((ClientData clientData,
*/
-#endif /* RC_INVOKED */
-
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
-#endif /* RESOURCE_INCLUDED */
+#endif /* RC_INVOKED */
/*
* end block for C++
diff --git a/mac/tkMacApplication.r b/mac/tkMacApplication.r
index 7be4472..9b61a5c 100644
--- a/mac/tkMacApplication.r
+++ b/mac/tkMacApplication.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: tkMacApplication.r,v 1.6 2001/12/27 22:45:07 das Exp $
+ * RCS: @(#) $Id: tkMacApplication.r,v 1.7 2002/09/12 17:34:16 das Exp $
*/
#include <Types.r>
@@ -22,7 +22,7 @@
* the version string for Tcl.
*/
-#define RESOURCE_INCLUDED
+#define RC_INVOKED
#include "tk.h"
#if (TK_RELEASE_LEVEL == 0)
diff --git a/mac/tkMacLibrary.r b/mac/tkMacLibrary.r
index efc3858..88474f2 100644
--- a/mac/tkMacLibrary.r
+++ b/mac/tkMacLibrary.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: tkMacLibrary.r,v 1.7 2001/12/27 22:45:13 das Exp $
+ * RCS: @(#) $Id: tkMacLibrary.r,v 1.8 2002/09/12 17:34:16 das Exp $
*/
#include <Types.r>
@@ -22,7 +22,7 @@
* the version string for Tcl.
*/
-#define RESOURCE_INCLUDED
+#define RC_INVOKED
#include <tcl.h>
#include "tk.h"
diff --git a/mac/tkMacResource.r b/mac/tkMacResource.r
index 6daace7..74f469e 100644
--- a/mac/tkMacResource.r
+++ b/mac/tkMacResource.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: tkMacResource.r,v 1.9 2002/04/23 14:28:02 das Exp $
+ * RCS: @(#) $Id: tkMacResource.r,v 1.10 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"
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"