summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-02-25 04:50:29 (GMT)
committerGuido van Rossum <guido@python.org>1996-02-25 04:50:29 (GMT)
commitec22c92e367db0af8c147d388b6a4d0e6b480326 (patch)
tree6f14358be2cbd93e5492be249ab2868fd4164773 /Modules
parentdfd428dd7ed94fb0e9ce22ebebbdca6e635081f2 (diff)
downloadcpython-ec22c92e367db0af8c147d388b6a4d0e6b480326.zip
cpython-ec22c92e367db0af8c147d388b6a4d0e6b480326.tar.gz
cpython-ec22c92e367db0af8c147d388b6a4d0e6b480326.tar.bz2
Changes needed to build with Tcl/Tk beta 2!
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_tkinter.c54
1 files changed, 38 insertions, 16 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 18fc7ba..d5bc9ac 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -21,6 +21,24 @@ extern int tk_NumMainWindows;
extern struct { Tk_Window win; } *tkMainWindowList;
#endif
+#ifdef macintosh
+
+/*
+** Additional cruft needed by Tcl/Tk on the Mac.
+** Unfortunately this changes with each beta.
+** This is for beta 2 of Tcl 7.5 and Tk 4.1.
+*/
+
+#include <Events.h> /* For EventRecord */
+
+typedef int (*TclMacConvertEventPtr) Py_PROTO((EventRecord *eventPtr));
+void TclMacSetEventProc Py_PROTO((TclMacConvertEventPtr procPtr));
+int TkMacConvertEvent Py_PROTO((EventRecord *eventPtr));
+
+staticforward int PyMacConvertEvent Py_PROTO((EventRecord *eventPtr));
+
+#endif /* macintosh */
+
/**** Tkapp Object Declaration ****/
staticforward PyTypeObject Tkapp_Type;
@@ -205,6 +223,9 @@ int
Tcl_AppInit (interp)
Tcl_Interp *interp;
{
+ Tk_Window main;
+
+ main = Tk_MainWindow(interp);
if (Tcl_Init (interp) == TCL_ERROR) {
fprintf(stderr, "Tcl_Init error: %s\n", interp->result);
return TCL_ERROR;
@@ -1272,22 +1293,23 @@ init_tkinter ()
if (Py_AtExit (Tkinter_Cleanup) != 0)
fprintf(stderr,
"Tkinter: warning: cleanup procedure not registered\n");
-#ifdef __MWERKS__
-// PyTk_InitGUSI();
-#endif
}
if (PyErr_Occurred ())
Py_FatalError ("can't initialize module _tkinter");
#ifdef macintosh
+ TclMacSetEventProc(PyMacConvertEvent);
+#if GENERATINGCFM
mac_addlibresources();
-#endif
+#endif /* GENERATINGCFM */
+#endif /* macintosh */
}
+
#ifdef macintosh
/*
-** Three functions that anyone who embeds Tcl/Tk on the Mac must export.
+** Anyone who embeds Tcl/Tk on the Mac must define panic().
*/
void
@@ -1305,20 +1327,20 @@ panic(char * format, ...)
Py_FatalError("Tcl/Tk panic");
}
-#include <Events.h>
+/*
+** Pass events to SIOUX before passing them to Tk.
+*/
-int
-TclMacConvertEvent(eventPtr)
+static int
+PyMacConvertEvent(eventPtr)
EventRecord *eventPtr;
{
- return TkMacConvertEvent(eventPtr);
+ if (SIOUXHandleOneEvent(eventPtr))
+ return 0; /* Nothing happened to the Tcl event queue */
+ return TkMacConvertEvent(eventPtr);
}
-int
-TclGeneratePollingEvents()
-{
- return TkGeneratePollingEvents();
-}
+#if GENERATINGCFM
/*
** Additional Mac specific code for dealing with shared libraries.
@@ -1362,5 +1384,5 @@ mac_addlibresources()
(void)FSpOpenResFile(&library_fss, fsRdPerm);
}
-
-#endif
+#endif /* GENERATINGCFM */
+#endif /* macintosh */