diff options
author | David Robillard <d@drobilla.net> | 2015-09-12 19:45:02 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-09-12 19:45:02 -0400 |
commit | 809ead2220f5a9ed66f88b1ae84a93e334e2717f (patch) | |
tree | 64ef3ffc307e8d6b8847e2daf878e6e2997bb87d /pugl/pugl_osx.m | |
parent | 6b4a5a128ef5d87374dfef017cd20e069c068a4b (diff) | |
download | pugl-809ead2220f5a9ed66f88b1ae84a93e334e2717f.tar.gz pugl-809ead2220f5a9ed66f88b1ae84a93e334e2717f.tar.bz2 pugl-809ead2220f5a9ed66f88b1ae84a93e334e2717f.zip |
Add puglWaitForEvent for blocking main loops.
Diffstat (limited to 'pugl/pugl_osx.m')
-rw-r--r-- | pugl/pugl_osx.m | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 85e71a8..47c8138 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -525,10 +525,24 @@ puglGrabFocus(PuglView* view) } PuglStatus +puglWaitForEvent(PuglView* view) +{ + [view->impl->window nextEventMatchingMask: NSAnyEventMask + untilDate: [NSDate distantFuture] + dequeue: NO]; + + return PUGL_SUCCESS; +} + +PuglStatus puglProcessEvents(PuglView* view) { - NSEvent* ev = [view->impl->window nextEventMatchingMask: NSAnyEventMask]; - [view->impl->app sendEvent: ev]; + NSEvent* ev = [view->impl->window nextEventMatchingMask: NSAnyEventMask + untilDate: [NSDate distantPast]]; + + if (ev) { + [view->impl->app sendEvent: ev]; + } return PUGL_SUCCESS; } |