summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-05-16 17:17:31 (GMT)
committerGuido van Rossum <guido@python.org>1996-05-16 17:17:31 (GMT)
commit68784363669529361bf2c6cf4dbd52c70f4600c0 (patch)
tree7e8f7d0a0e7689362092d3a4219c511246575328
parent54ac1891fb986847061b14ed2961222c9d8d1485 (diff)
downloadcpython-68784363669529361bf2c6cf4dbd52c70f4600c0.zip
cpython-68784363669529361bf2c6cf4dbd52c70f4600c0.tar.gz
cpython-68784363669529361bf2c6cf4dbd52c70f4600c0.tar.bz2
Patch from the net for 4.1 file handler changes.
-rw-r--r--Modules/_tkinter.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 6a05f1a..8df8c4a 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -852,6 +852,9 @@ Tkapp_CreateFileHandler (self, args)
{
PyObject *file, *func, *data;
int mask, id;
+#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001
+ Tcl_File tfile;
+#endif
if (!PyArg_Parse (args, "(OiO)", &file, &mask, &func))
return NULL;
@@ -867,7 +870,13 @@ Tkapp_CreateFileHandler (self, args)
/* ClientData is: (func, file) */
data = Py_BuildValue ("(OO)", func, file);
+#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001
+ tfile = Tcl_GetFile((ClientData)id, TCL_UNIX_FD);
+ /* Oughtta check for null Tcl_File object... */
+ Tcl_CreateFileHandler (tfile, mask, FileHandler, (ClientData) data);
+#else
Tk_CreateFileHandler ((ClientData) id, mask, FileHandler, (ClientData) data);
+#endif
/* XXX fileHandlerDict */
Py_INCREF (Py_None);
@@ -881,14 +890,23 @@ Tkapp_DeleteFileHandler (self, args)
{
PyObject *file;
int id;
-
+#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001
+ Tcl_File tfile;
+#endif
+
if (!PyArg_Parse (args, "O", &file))
return NULL;
id = GetFileNo (file);
if (id < 0)
return NULL;
+#if (TK_MAJOR_VERSION*1000 + TK_MINOR_VERSION) >= 4001
+ tfile = Tcl_GetFile((ClientData) id, TCL_UNIX_FD);
+ /* Oughtta check for null Tcl_File object... */
+ Tcl_DeleteFileHandler(tfile);
+#else
Tk_DeleteFileHandler ((ClientData) id);
+#endif
/* XXX fileHandlerDict */
Py_INCREF (Py_None);
return Py_None;