From a978fd6a78baeb920e676cfef0d96877778c80ab Mon Sep 17 00:00:00 2001 From: Stefan Westerfeld Date: Sun, 23 Jun 2019 17:41:43 +0200 Subject: Make event processing non-blocking on MacOS --- pugl/pugl_osx.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'pugl/pugl_osx.m') diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index aaae212..be900f1 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -677,8 +677,8 @@ puglWaitForEvent(PuglView* view) unsupported selector error at runtime. I have no idea why, so just get the event and keep it around until the call to puglProcessEvents. */ if (!view->impl->nextEvent) { - view->impl->nextEvent = [view->impl->window - nextEventMatchingMask: NSAnyEventMask]; + view->impl->nextEvent = + [view->impl->window nextEventMatchingMask:NSAnyEventMask]; } return PUGL_SUCCESS; @@ -690,8 +690,12 @@ puglProcessEvents(PuglView* view) while (true) { // Get the next event, or use the cached one from puglWaitForEvent if (!view->impl->nextEvent) { - view->impl->nextEvent = [view->impl->window - nextEventMatchingMask: NSAnyEventMask]; + view->impl->nextEvent = + [view->impl->window nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSDefaultRunLoopMode + dequeue:YES]; + } if (!view->impl->nextEvent) { -- cgit v1.2.1