diff options
author | das <das> | 2002-04-08 09:00:11 (GMT) |
---|---|---|
committer | das <das> | 2002-04-08 09:00:11 (GMT) |
commit | e7fcb44797d1a3c8687c4084a0fc9e5fdc93aee6 (patch) | |
tree | 5ca9f5997b821e02e175aa92091913c4436e9267 | |
parent | 3c091cc5f0f0506b93eee9456fb49b41c5fb312c (diff) | |
download | tk-e7fcb44797d1a3c8687c4084a0fc9e5fdc93aee6.zip tk-e7fcb44797d1a3c8687c4084a0fc9e5fdc93aee6.tar.gz tk-e7fcb44797d1a3c8687c4084a0fc9e5fdc93aee6.tar.bz2 |
2002-04-08 Daniel Steffen <das@users.sourceforge.net>
* generic/tkInt.h:
* mac/tkMacAppInit.c: fixes to MSL stdin/stdout hookup to the
TkConsole when using shared MSL libraries; fix for crashing
bug on exit: writing to stdin/sterr when console has already
been destroyed. (both fixes need support in MSL, see
'CW Pro6 changes' in tcl/mac/tcltkMacBuildSupport.sea.hqx)
* mac/tkMacDialog.c: fixes to Navigation Services Dialog filter.
* mac/tkMacDraw.c: add panic for overwide TkImages that would
crash Tk on mac otherwise.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | generic/tkInt.h | 4 | ||||
-rw-r--r-- | mac/tkMacAppInit.c | 59 | ||||
-rw-r--r-- | mac/tkMacDialog.c | 9 | ||||
-rw-r--r-- | mac/tkMacDraw.c | 5 |
5 files changed, 69 insertions, 20 deletions
@@ -1,3 +1,15 @@ +2002-04-08 Daniel Steffen <das@users.sourceforge.net> + + * generic/tkInt.h: + * mac/tkMacAppInit.c: fixes to MSL stdin/stdout hookup to the + TkConsole when using shared MSL libraries; fix for crashing + bug on exit: writing to stdin/sterr when console has already + been destroyed. (both fixes need support in MSL, see + 'CW Pro6 changes' in tcl/mac/tcltkMacBuildSupport.sea.hqx) + * mac/tkMacDialog.c: fixes to Navigation Services Dialog filter. + * mac/tkMacDraw.c: add panic for overwide TkImages that would + crash Tk on mac otherwise. + 2002-03-26 Andreas Kupries <andreask_kupries@users.sourceforge.net> * unix/tkUnixFont.c: Added inclusion of <arpa/inet.h>. This fixes diff --git a/generic/tkInt.h b/generic/tkInt.h index a944e38..a696ab5 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -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: tkInt.h,v 1.23 2000/04/19 01:06:51 ericm Exp $ + * RCS: $Id: tkInt.h,v 1.23.2.1 2002/04/08 09:00:18 das Exp $ */ #ifndef _TKINT @@ -1009,7 +1009,7 @@ EXTERN int Tk_WinfoObjCmd _ANSI_ARGS_((ClientData clientData, EXTERN int Tk_WmCmd _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, int argc, char **argv)); -void TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp, +EXTERN void TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp, int devId, char *buffer, long size)); EXTERN void TkEventInit _ANSI_ARGS_((void)); diff --git a/mac/tkMacAppInit.c b/mac/tkMacAppInit.c index 670e8fa..4b630f7 100644 --- a/mac/tkMacAppInit.c +++ b/mac/tkMacAppInit.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacAppInit.c,v 1.12 2000/02/10 08:53:06 jingham Exp $ + * RCS: @(#) $Id: tkMacAppInit.c,v 1.12.2.1 2002/04/08 09:00:22 das Exp $ */ #include <Gestalt.h> @@ -25,6 +25,7 @@ #include "tkMacInt.h" #include "tclInt.h" #include "tclMac.h" +#include "tclMacInt.h" #ifdef TK_TEST extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp)); @@ -49,20 +50,21 @@ void RemoveConsole _ANSI_ARGS_((void)); long WriteCharsToConsole _ANSI_ARGS_((char *buff, long n)); long ReadCharsFromConsole _ANSI_ARGS_((char *buff, long n)); extern char * __ttyname _ANSI_ARGS_((long fildes)); +int kbhit _ANSI_ARGS_((void)); +int getch _ANSI_ARGS_((void)); +void clrscr _ANSI_ARGS_((void)); short SIOUXHandleOneEvent _ANSI_ARGS_((EventRecord *event)); /* - * Prototypes for functions from the tkConsole.c file. - */ - -EXTERN void TkConsolePrint _ANSI_ARGS_((Tcl_Interp *interp, - int devId, char *buffer, long size)); -/* * Forward declarations for procedures defined later in this file: */ static int MacintoshInit _ANSI_ARGS_((void)); static int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp)); +static void SetupSIOUX _ANSI_ARGS_((void)); + +static int inMacExit = 0; +static pascal void NoMoreOutput() { inMacExit = 1; } /* *---------------------------------------------------------------------- @@ -325,6 +327,8 @@ SetupMainInterp( if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { goto error; } + SetupSIOUX(); + TclMacInstallExitToShellPatch(NoMoreOutput); } /* @@ -374,8 +378,15 @@ RemoveConsole(void) long WriteCharsToConsole(char *buffer, long n) { - TkConsolePrint(gStdoutInterp, TCL_STDOUT, buffer, n); - return n; + if (!inMacExit) { + Tcl_DString ds; + Tcl_ExternalToUtfDString(NULL, buffer, n, &ds); + TkConsolePrint(gStdoutInterp, TCL_STDOUT, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); + Tcl_DStringFree(&ds); + return n; + } else { + return 0; + } } long @@ -396,8 +407,38 @@ __ttyname(long fildes) return (0L); } +int kbhit(void) +{ + return 0; +} + +int getch(void) +{ + return 0; +} + +void clrscr(void) +{ + return; +} + short SIOUXHandleOneEvent(EventRecord *event) { return 0; } + +static void SetupSIOUX(void) { +#ifndef STATIC_BUILD + extern DLLIMPORT void SetupConsolePlugins(void*, void*, void*, void*, + void*, void*, void*, void*); + SetupConsolePlugins( &InstallConsole, + &RemoveConsole, + &WriteCharsToConsole, + &ReadCharsFromConsole, + &__ttyname, + &kbhit, + &getch, + &clrscr); +#endif +} diff --git a/mac/tkMacDialog.c b/mac/tkMacDialog.c index a807483..bdc436e 100644 --- a/mac/tkMacDialog.c +++ b/mac/tkMacDialog.c @@ -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: tkMacDialog.c,v 1.6.2.1 2001/04/04 21:39:48 hobbs Exp $ + * RCS: @(#) $Id: tkMacDialog.c,v 1.6.2.2 2002/04/08 09:00:28 das Exp $ */ #include <Gestalt.h> @@ -1050,17 +1050,10 @@ OpenEventProc( { NavMenuItemSpec *chosenItem; OpenFileData *ofd = (OpenFileData *) callBackUD; - static SInt32 otherEvent = ~(kNavCBCustomize|kNavCBStart|kNavCBTerminate - |kNavCBNewLocation|kNavCBShowDesktop|kNavCBSelectEntry|kNavCBAccept - |kNavCBCancel|kNavCBAdjustPreview); if (callBackSelector == kNavCBPopupMenuSelect) { chosenItem = (NavMenuItemSpec *) callBackParams->eventData.eventDataParms.param; ofd->curType = chosenItem->menuType; - } else if ( callBackSelector & otherEvent != 0) { - while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_DONT_WAIT|TCL_WINDOW_EVENTS)) { - /* Empty Body */ - } } else if (callBackSelector == kNavCBEvent) { if (callBackParams->eventData.eventDataParms.event->what == updateEvt) { if (TkMacConvertEvent( callBackParams->eventData.eventDataParms.event)) { diff --git a/mac/tkMacDraw.c b/mac/tkMacDraw.c index f684976..b030db9 100644 --- a/mac/tkMacDraw.c +++ b/mac/tkMacDraw.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: tkMacDraw.c,v 1.8 1999/12/14 06:52:56 hobbs Exp $ + * RCS: @(#) $Id: tkMacDraw.c,v 1.8.2.1 2002/04/08 09:00:32 das Exp $ */ #include "tkInt.h" @@ -370,6 +370,9 @@ TkPutImage( pixmap.pmTable = NULL; pixmap.pmReserved = 0; pixmap.baseAddr = image->data; + if (image->bytes_per_line >= 0x4000) { + panic("TkImage too wide!"); + } pixmap.rowBytes = image->bytes_per_line | 0x8000; CopyBits((BitMap *) &pixmap, &((GrafPtr) destPort)->portBits, |