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

View File

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