aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-15 21:24:18 +0100
committerDavid Robillard <d@drobilla.net>2020-03-15 21:24:18 +0100
commit1463f6b44b19ef2778747c0d48f2b29daa00c67c (patch)
treeb129483ecbb866ac4cc07b9f6a751d57baa46dc5 /doc
parentefc053fe5a38a4928fbfd3780f5665dd43bc7f95 (diff)
downloadpugl-1463f6b44b19ef2778747c0d48f2b29daa00c67c.tar.gz
pugl-1463f6b44b19ef2778747c0d48f2b29daa00c67c.tar.bz2
pugl-1463f6b44b19ef2778747c0d48f2b29daa00c67c.zip
Update event loop documentation
Diffstat (limited to 'doc')
-rw-r--r--doc/mainpage.md18
1 files changed, 14 insertions, 4 deletions
diff --git a/doc/mainpage.md b/doc/mainpage.md
index 3c4bab6..d7a96fa 100644
--- a/doc/mainpage.md
+++ b/doc/mainpage.md
@@ -50,13 +50,23 @@ and system events like window resizing and exposure.
## Event Loop
-Two functions are used to drive the event loop:
+The event loop is driven by repeatedly calling #puglUpdate which processes events from the window system,
+and dispatches them to views when necessary.
- * #puglPollEvents waits for events to become available.
- * #puglDispatchEvents processes all pending events.
+Typically, a plugin calls #puglUpdate with timeout 0 in some callback driven by the host.
+A program can use whatever timeout is appropriate:
+event-driven applications may wait forever,
+or for continuous animation,
+use a timeout that is a significant fraction of the frame period
+(with enough time left over to render).
-Redrawing is accomplished by calling #puglPostRedisplay or #puglPostRedisplayRect,
+Redrawing can be requested by calling #puglPostRedisplay or #puglPostRedisplayRect,
which post expose events to the queue.
+Note, however, that this will not wake up a blocked #puglUpdate call on MacOS
+(which does not handle drawing via events).
+For continuous redrawing, call #puglPostRedisplay when a #PUGL_UPDATE event is received.
+This event is sent before views are redrawn,
+so can be used as a hook to expand the update region right before the view is exposed.
## Error Handling