From 809ead2220f5a9ed66f88b1ae84a93e334e2717f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 12 Sep 2015 19:45:02 -0400 Subject: Add puglWaitForEvent for blocking main loops. --- pugl/pugl.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'pugl/pugl.h') diff --git a/pugl/pugl.h b/pugl/pugl.h index 3ff66f9..8dca956 100644 --- a/pugl/pugl.h +++ b/pugl/pugl.h @@ -361,11 +361,23 @@ puglSetReshapeFunc(PuglView* view, PuglReshapeFunc reshapeFunc); PUGL_API void puglGrabFocus(PuglView* view); +/** + Block and wait for an event to be ready. + + This can be used in a loop to only process events via puglProcessEvents when + necessary. This function will block indefinitely if no events are + available, so is not appropriate for use in programs that need to perform + regular updates (e.g. animation). +*/ +PUGL_API PuglStatus +puglWaitForEvent(PuglView* view); + /** Process all pending window events. This handles input events as well as rendering, so it should be called - regularly and rapidly enough to keep the UI responsive. + regularly and rapidly enough to keep the UI responsive. This function does + not block if no events are pending. */ PUGL_API PuglStatus puglProcessEvents(PuglView* view); -- cgit v1.2.3