diff options
Diffstat (limited to 'pugl')
-rw-r--r-- | pugl/detail/mac.m | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m index f26cb9e..da1ab35 100644 --- a/pugl/detail/mac.m +++ b/pugl/detail/mac.m @@ -927,11 +927,20 @@ puglWaitForEvent(PuglView* view) PUGL_API PuglStatus puglDispatchEvents(PuglWorld* world) { + const NSTimeInterval startTime = [[NSProcessInfo processInfo] systemUptime]; + for (NSEvent* ev = NULL; (ev = [world->impl->app nextEventMatchingMask:NSAnyEventMask untilDate:nil inMode:NSDefaultRunLoopMode dequeue:YES]);) { + + if ([ev timestamp] > startTime) { + // Event is later, put it back for the next iteration and return + [world->impl->app postEvent:ev atStart:true]; + break; + } + [world->impl->app sendEvent: ev]; } |