diff options
author | culler <culler> | 2019-10-09 19:37:46 (GMT) |
---|---|---|
committer | culler <culler> | 2019-10-09 19:37:46 (GMT) |
commit | a6f45c5bc8e341ee74d43b81f379fdd68ee1a83d (patch) | |
tree | 9b88f8a6fda5ed38a749f95ed76baa645a76a4e5 /macosx/tkMacOSXNotify.c | |
parent | 4a0c791f613041fbc913db7ec31899669515b5df (diff) | |
download | tk-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.c | 15 |
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]; } } } |