aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/win.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-22 16:53:36 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:32:16 +0200
commit496f17c3804c79d304aa6095b92768593d1cc700 (patch)
treec8a9f9b831ae838f2005dd459abf3a65162fac4f /pugl/detail/win.c
parentdacaaa5f328ac2598123aa1f0744ddd68c87e9cc (diff)
downloadpugl-496f17c3804c79d304aa6095b92768593d1cc700.tar.gz
pugl-496f17c3804c79d304aa6095b92768593d1cc700.tar.bz2
pugl-496f17c3804c79d304aa6095b92768593d1cc700.zip
Add puglPollEvents()
This allows waiting for events for any view in the world. It also improves on puglWaitForEvent() by the addition of a time parameter that allows indefinite blocking, non-blocking polling, and blocking polling with a timeout.
Diffstat (limited to 'pugl/detail/win.c')
-rw-r--r--pugl/detail/win.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 6a0825a..9d0d0e5 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -120,6 +120,20 @@ puglInitViewInternals(void)
return (PuglInternals*)calloc(1, sizeof(PuglInternals));
}
+PuglStatus
+puglPollEvents(PuglWorld* world, const double timeout)
+{
+ (void)world;
+
+ if (timeout < 0) {
+ WaitMessage();
+ } else {
+ MsgWaitForMultipleObjects(
+ 0, NULL, FALSE, (DWORD)(timeout * 1e3), QS_ALLEVENTS);
+ }
+ return PUGL_SUCCESS;
+}
+
int
puglCreateWindow(PuglView* view, const char* title)
{