Subject: | Bug in Tcl_SetTimer and Tcl_WaitForEvent when connecting a another notifier (on Windows) |
We want to connect Tk to our own mainloop. For that, we initialized the new notifier by a call to Tcl_SetNotifier (tclNotify.c). But, because of a directive compilation problem, the new functions initialised to be used instead of Tcl_SetTimer and instead of Tcl_WaitForEvent (tclWinNotify.c) arent called.
The reason is that the appropriate call of these functions is between the directives #ifndef _LANG and #endif, and _LANG is always defined:
#ifndef _LANG
if (tclStubs.tcl_WaitForEvent != tclOriginalNotifier.waitForEventProc) {
return tclStubs.tcl_WaitForEvent(timePtr);
}
#endif
The attached patch seems to correct the problem.
--- tclWinNotify.c Wed Nov 16 16:50:11 2005
+++ tclWinNotify.c Thu Nov 10 12:01:27 2005
@@ -14,8 +14,9 @@
*/
#include <windows.h>
-#include "Lang.h"
+//#include "Lang.h"
#include "tkWin.h"
+#include "tkEvent_f.h"
#if defined(TCL_EVENT_IMPLEMENT)
@@ -273,12 +274,13 @@
* on Windows, but mirrors the UNIX hook.
*/
-#ifndef _LANG
- if (tclStubs.tcl_SetTimer != tclOriginalNotifier.setTimerProc) {
- tclStubs.tcl_SetTimer(timePtr);
+//#ifndef _LANG
+ if (TkeventVptr->V_Tcl_SetTimer != tclOriginalNotifier.setTimerProc) {
+ TkeventVptr->V_Tcl_SetTimer(timePtr);
return;
}
-#endif
+//#endif
+
/*
* We only need to set up an interval timer if we're being called
@@ -441,11 +443,11 @@
* sense on windows, but mirrors the UNIX hook.
*/
-#ifndef _LANG
+//#ifndef _LANG
if (tclStubs.tcl_WaitForEvent != tclOriginalNotifier.waitForEventProc) {
return tclStubs.tcl_WaitForEvent(timePtr);
}
-#endif
+//#endif
/*
* Compute the timeout in milliseconds.