summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXNotify.c
diff options
context:
space:
mode:
authorculler <culler>2019-10-09 19:37:46 (GMT)
committerculler <culler>2019-10-09 19:37:46 (GMT)
commita6f45c5bc8e341ee74d43b81f379fdd68ee1a83d (patch)
tree9b88f8a6fda5ed38a749f95ed76baa645a76a4e5 /macosx/tkMacOSXNotify.c
parent4a0c791f613041fbc913db7ec31899669515b5df (diff)
downloadtk-a6f45c5bc8e341ee74d43b81f379fdd68ee1a83d.zip
tk-a6f45c5bc8e341ee74d43b81f379fdd68ee1a83d.tar.gz
tk-a6f45c5bc8e341ee74d43b81f379fdd68ee1a83d.tar.bz2
Fix the (almost) hangs that occurred in some calls to vwait when no user
events are being generated.
Diffstat (limited to 'macosx/tkMacOSXNotify.c')
-rw-r--r--macosx/tkMacOSXNotify.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 7267b00..32caccd 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -288,6 +288,7 @@ TkMacOSXEventsSetupProc(
ClientData clientData,
int flags)
{
+ static Bool havePeriodicEvents = NO;
NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode];
/*
@@ -310,7 +311,21 @@ TkMacOSXEventsSetupProc(
if (currentEvent) {
if (currentEvent.type > 0) {
Tcl_SetMaxBlockTime(&zeroBlockTime);
+ if (havePeriodicEvents) {
+ [NSEvent stopPeriodicEvents];
+ havePeriodicEvents = NO;
+ }
}
+ } else if (!havePeriodicEvents){
+
+ /*
+ * When the user is not generating events we schedule a "hearbeat"
+ * event to fire every 0.25 seconds. This helps to make the vwait
+ * command more responsive when there is no user input.
+ */
+
+ havePeriodicEvents = YES;
+ [NSEvent startPeriodicEventsAfterDelay:0.0 withPeriod:0.25];
}
}
}