WaitForNextTick: make closer to cocoa version

This commit is contained in:
Jesús A. Álvarez 2016-05-31 23:16:07 +02:00
parent 90f6f77f8b
commit ce0bf30189
1 changed files with 8 additions and 3 deletions

View File

@ -1704,10 +1704,9 @@ GLOBALFUNC blnr ExtraTimeNotOver(void) {
GLOBALPROC WaitForNextTick(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSRunLoop *mainRunLoop = [NSRunLoop mainRunLoop];
NSDate *until = [NSDate distantPast];
label_retry:
while (ExtraTimeNotOver()) {
[mainRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceReferenceDate:NextTickChangeTime]];
}
[mainRunLoop runMode:NSDefaultRunLoopMode beforeDate:until];
CheckForSavedTasks();
@ -1717,6 +1716,12 @@ label_retry:
if (CurSpeedStopped) {
DoneWithDrawingForTick();
until = [NSDate distantFuture];
goto label_retry;
}
if (ExtraTimeNotOver()) {
until = [NSDate dateWithTimeIntervalSinceReferenceDate:NextTickChangeTime];
goto label_retry;
}