diff options
author | David Robillard <d@drobilla.net> | 2020-03-28 15:03:05 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-28 15:03:05 +0100 |
commit | bdb46d4142dc90f224576fb6540eecbd911fb0dd (patch) | |
tree | 0cc45ae19a2a7c3a18055caa2aa7452b52ae0623 | |
parent | 3754f6708093519211aae1073eb60ea5bb88bcbf (diff) |
Tolerate puglPostRedisplay() in configure handlers
-rw-r--r-- | pugl/detail/x11.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 1511b7b..6f85215 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -856,22 +856,23 @@ 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; + PuglView* const view = world->views[i]; if (view->visible) { puglDispatchSimpleEvent(view, PUGL_UPDATE); } - if (configure->type || expose->type) { - view->backend->enter(view, expose->type ? &expose->expose : NULL); - puglDispatchEventInContext(view, configure); - puglDispatchEventInContext(view, expose); - view->backend->leave(view, expose->type ? &expose->expose : NULL); + const PuglEvent configure = view->impl->pendingConfigure; + const PuglEvent expose = view->impl->pendingExpose; - configure->type = 0; - expose->type = 0; + view->impl->pendingConfigure.type = PUGL_NOTHING; + view->impl->pendingExpose.type = PUGL_NOTHING; + + if (configure.type || expose.type) { + view->backend->enter(view, expose.type ? &expose.expose : NULL); + puglDispatchEventInContext(view, &configure); + puglDispatchEventInContext(view, &expose); + view->backend->leave(view, expose.type ? &expose.expose : NULL); } } } |