diff options
author | Guido van Rossum <guido@python.org> | 1997-08-01 19:29:02 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-08-01 19:29:02 (GMT) |
commit | 3e819a7aa8cf604b76b34c038799bd6efb343779 (patch) | |
tree | 16fcd38f8502ede598d995c80ad74baceb17d3c8 /Modules/_tkinter.c | |
parent | f4e32c729bae45db02e74d7b873316b3f61d7507 (diff) | |
download | cpython-3e819a7aa8cf604b76b34c038799bd6efb343779.zip cpython-3e819a7aa8cf604b76b34c038799bd6efb343779.tar.gz cpython-3e819a7aa8cf604b76b34c038799bd6efb343779.tar.bz2 |
Compatibility with Tcl/Tk 8.0b*.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r-- | Modules/_tkinter.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 1de3372..556b0ac 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -56,21 +56,23 @@ PERFORMANCE OF THIS SOFTWARE. #include <tcl.h> #include <tk.h> +#if TK_MAJOR_VERSION < 4 +#error "Tk 3.x is not supported" +#endif + +#define TKMAJORMINOR (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) + extern char *Py_GetProgramName (); -/* Internal declarations from tkInt.h. */ -#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 +#if TKMAJORMINOR >= 4001 extern int Tk_GetNumMainWindows(); #else +/* Internal declarations from tkInt.h. */ extern int tk_NumMainWindows; #define Tk_GetNumMainWindows() (tk_NumMainWindows) #define NEED_TKCREATEMAINWINDOW 1 #endif -#if TK_MAJOR_VERSION < 4 -#error "Tk 3.x is not supported" -#endif - #ifdef macintosh /* @@ -1018,9 +1020,11 @@ Tkapp_CreateFileHandler (self, args) PyObject *file, *func, *data; PyObject *idkey; int mask, id; -#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 +#if TKMAJORMINOR < 8000 +#if TKMAJORMINOR >= 4001 Tcl_File tfile; #endif +#endif if (!Tkapp_ClientDataDict) { if (!(Tkapp_ClientDataDict = PyDict_New())) @@ -1049,18 +1053,22 @@ Tkapp_CreateFileHandler (self, args) } Py_DECREF(idkey); -#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 +#if TKMAJORMINOR < 8000 +#if TKMAJORMINOR >= 4001 #ifdef MS_WINDOWS /* We assume this is a socket... */ tfile = Tcl_GetFile((ClientData)id, TCL_WIN_SOCKET); -#else +#else /* !MS_WINDOWS */ tfile = Tcl_GetFile((ClientData)id, TCL_UNIX_FD); -#endif +#endif /* !MS_WINDOWS */ /* Ought to check for null Tcl_File object... */ Tcl_CreateFileHandler(tfile, mask, FileHandler, (ClientData) data); -#else +#else /* ! >= 4001 */ Tk_CreateFileHandler(id, mask, FileHandler, (ClientData) data); -#endif +#endif /* ! >= 4001 */ +#else /* ! < 8000 */ + Tcl_CreateFileHandler(id, mask, FileHandler, (ClientData) data); +#endif /* < 8000 */ /* XXX fileHandlerDict */ Py_INCREF (Py_None); return Py_None; @@ -1076,9 +1084,11 @@ Tkapp_DeleteFileHandler (self, args) PyObject *idkey; PyObject *data; int id; -#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 +#if TKMAJORMINOR < 8000 +#if TKMAJORMINOR >= 4001 Tcl_File tfile; #endif +#endif if (!PyArg_Parse(args, "O", &file)) return NULL; @@ -1097,7 +1107,8 @@ Tkapp_DeleteFileHandler (self, args) PyDict_DelItem(Tkapp_ClientDataDict, idkey); Py_DECREF(idkey); -#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001 +#if TKMAJORMINOR < 8000 +#if TKMAJORMINOR >= 4001 #ifdef MS_WINDOWS /* We assume this is a socket... */ tfile = Tcl_GetFile((ClientData)id, TCL_WIN_SOCKET); @@ -1109,6 +1120,9 @@ Tkapp_DeleteFileHandler (self, args) #else Tk_DeleteFileHandler(id); #endif +#else + Tcl_DeleteFileHandler(id); +#endif /* XXX fileHandlerDict */ Py_INCREF (Py_None); return Py_None; |