aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-15 18:19:15 +0100
committerDavid Robillard <d@drobilla.net>2020-03-15 20:53:37 +0100
commit3b9e8287fd4c1096a2d6244aa07bc28cacb4da8d (patch)
tree00175b0ed16b513f1385971e4dec797d6d0f97d1
parent87351f2a8aaaad988b44e985ac5240af43d331e3 (diff)
X11: Factor out flushing pending exposures
-rw-r--r--pugl/detail/x11.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 7edc1ed..780213d 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -741,6 +741,27 @@ handleSelectionRequest(const PuglWorld* world,
XSendEvent(world->impl->display, note.requestor, True, 0, (XEvent*)&note);
}
+/// Flush pending configure and expose events for all views
+static void
+flushExposures(PuglWorld* world)
+{
+ for (size_t i = 0; i < world->numViews; ++i) {
+ PuglView* const view = world->views[i];
+ PuglEvent* const configure = &view->impl->pendingConfigure;
+ PuglEvent* const expose = &view->impl->pendingExpose;
+
+ if (configure->type || expose->type) {
+ view->backend->enter(view, expose->type ? &expose->expose : NULL);
+ view->eventFunc(view, configure);
+ view->eventFunc(view, expose);
+ view->backend->leave(view, expose->type ? &expose->expose : NULL);
+
+ configure->type = 0;
+ expose->type = 0;
+ }
+ }
+}
+
PuglStatus
puglDispatchEvents(PuglWorld* world)
{
@@ -806,22 +827,7 @@ puglDispatchEvents(PuglWorld* world)
}
}
- // Flush pending configure and expose events for all views
- for (size_t i = 0; i < world->numViews; ++i) {
- PuglView* const view = world->views[i];
- PuglEvent* const configure = &view->impl->pendingConfigure;
- PuglEvent* const expose = &view->impl->pendingExpose;
-
- if (configure->type || expose->type) {
- view->backend->enter(view, expose->type ? &expose->expose : NULL);
- view->eventFunc(view, configure);
- view->eventFunc(view, expose);
- view->backend->leave(view, expose->type ? &expose->expose : NULL);
-
- configure->type = 0;
- expose->type = 0;
- }
- }
+ flushExposures(world);
world->impl->dispatchingEvents = false;