@@ -33,10 +33,6 @@ Copyright (C) 1994 Steen Lumholt.
3333#include <windows.h>
3434#endif
3535
36- #ifdef macintosh
37- #define MAC_TCL
38- #endif
39-
4036/* Allow using this code in Python 2.[12] */
4137#ifndef PyDoc_STRVAR
4238#define PyDoc_STRVAR (name ,str ) static char name[] = str
@@ -96,15 +92,7 @@ Copyright (C) 1994 Steen Lumholt.
9692#error "unsupported Tcl configuration"
9793#endif
9894
99- #if defined(macintosh )
100- /* Sigh, we have to include this to get at the tcl qd pointer */
101- #include <tkMac.h>
102- /* And this one we need to clear the menu bar */
103- #include <Menus.h>
104- #endif
105-
106- #if !(defined(MS_WINDOWS ) || defined(__CYGWIN__ ) || defined(macintosh ))
107- /* Mac has it, but it doesn't really work:-( */
95+ #if !(defined(MS_WINDOWS ) || defined(__CYGWIN__ ))
10896#define HAVE_CREATEFILEHANDLER
10997#endif
11098
@@ -238,29 +226,6 @@ static PyThreadState *tcl_tstate = NULL;
238226
239227#endif
240228
241- #ifdef macintosh
242-
243- /*
244- ** Additional cruft needed by Tcl/Tk on the Mac.
245- ** This is for Tcl 7.5 and Tk 4.1 (patch release 1).
246- */
247-
248- /* ckfree() expects a char* */
249- #define FREECAST (char *)
250-
251- #include <Events.h> /* For EventRecord */
252-
253- typedef int (* TclMacConvertEventPtr ) (EventRecord * eventPtr );
254- void Tcl_MacSetEventProc (TclMacConvertEventPtr procPtr );
255- int TkMacConvertEvent (EventRecord * eventPtr );
256-
257- static int PyMacConvertEvent (EventRecord * eventPtr );
258-
259- #include <SIOUX.h>
260- extern int SIOUXIsAppWindow (WindowPtr );
261-
262- #endif /* macintosh */
263-
264229#ifndef FREECAST
265230#define FREECAST (char *)
266231#endif
@@ -646,12 +611,6 @@ Tkapp_New(char *screenName, char *baseName, char *className,
646611 v -> ProcBodyType = Tcl_GetObjType ("procbody" );
647612 v -> StringType = Tcl_GetObjType ("string" );
648613
649- #if defined(macintosh )
650- /* This seems to be needed */
651- ClearMenuBar ();
652- TkMacInitMenus (v -> interp );
653- #endif
654-
655614 /* Delete the 'exit' command, which can screw things up */
656615 Tcl_DeleteCommand (v -> interp , "exit" );
657616
@@ -3092,112 +3051,4 @@ init_tkinter(void)
30923051 Py_AtExit (Tcl_Finalize );
30933052#endif
30943053
3095- #ifdef macintosh
3096- /*
3097- ** Part of this code is stolen from MacintoshInit in tkMacAppInit.
3098- ** Most of the initializations in that routine (toolbox init calls and
3099- ** such) have already been done for us, so we only need these.
3100- */
3101- tcl_macQdPtr = & qd ;
3102-
3103- Tcl_MacSetEventProc (PyMacConvertEvent );
3104- #if GENERATINGCFM
3105- mac_addlibresources ();
3106- #endif /* GENERATINGCFM */
3107- #endif /* macintosh */
31083054}
3109-
3110-
3111-
3112- #ifdef macintosh
3113-
3114- /*
3115- ** Anyone who embeds Tcl/Tk on the Mac must define panic().
3116- */
3117-
3118- void
3119- panic (char * format , ...)
3120- {
3121- va_list varg ;
3122-
3123- va_start (varg , format );
3124-
3125- vfprintf (stderr , format , varg );
3126- (void ) fflush (stderr );
3127-
3128- va_end (varg );
3129-
3130- Py_FatalError ("Tcl/Tk panic" );
3131- }
3132-
3133- /*
3134- ** Pass events to SIOUX before passing them to Tk.
3135- */
3136-
3137- static int
3138- PyMacConvertEvent (EventRecord * eventPtr )
3139- {
3140- WindowPtr frontwin ;
3141- /*
3142- ** Sioux eats too many events, so we don't pass it everything. We
3143- ** always pass update events to Sioux, and we only pass other events if
3144- ** the Sioux window is frontmost. This means that Tk menus don't work
3145- ** in that case, but at least we can scroll the sioux window.
3146- ** Note that the SIOUXIsAppWindow() routine we use here is not really
3147- ** part of the external interface of Sioux...
3148- */
3149- frontwin = FrontWindow ();
3150- if ( eventPtr -> what == updateEvt || SIOUXIsAppWindow (frontwin ) ) {
3151- if (SIOUXHandleOneEvent (eventPtr ))
3152- return 0 ; /* Nothing happened to the Tcl event queue */
3153- }
3154- return TkMacConvertEvent (eventPtr );
3155- }
3156-
3157- #if GENERATINGCFM
3158-
3159- /*
3160- ** Additional Mac specific code for dealing with shared libraries.
3161- */
3162-
3163- #include <Resources.h>
3164- #include <CodeFragments.h>
3165-
3166- static int loaded_from_shlib = 0 ;
3167- static FSSpec library_fss ;
3168-
3169- /*
3170- ** If this module is dynamically loaded the following routine should
3171- ** be the init routine. It takes care of adding the shared library to
3172- ** the resource-file chain, so that the tk routines can find their
3173- ** resources.
3174- */
3175- OSErr pascal
3176- init_tkinter_shlib (CFragInitBlockPtr data )
3177- {
3178- __initialize ();
3179- if ( data == nil ) return noErr ;
3180- if ( data -> fragLocator .where == kDataForkCFragLocator ) {
3181- library_fss = * data -> fragLocator .u .onDisk .fileSpec ;
3182- loaded_from_shlib = 1 ;
3183- } else if ( data -> fragLocator .where == kResourceCFragLocator ) {
3184- library_fss = * data -> fragLocator .u .inSegs .fileSpec ;
3185- loaded_from_shlib = 1 ;
3186- }
3187- return noErr ;
3188- }
3189-
3190- /*
3191- ** Insert the library resources into the search path. Put them after
3192- ** the resources from the application. Again, we ignore errors.
3193- */
3194- static
3195- mac_addlibresources (void )
3196- {
3197- if ( !loaded_from_shlib )
3198- return ;
3199- (void )FSpOpenResFile (& library_fss , fsRdPerm );
3200- }
3201-
3202- #endif /* GENERATINGCFM */
3203- #endif /* macintosh */
0 commit comments