From bdb46d4142dc90f224576fb6540eecbd911fb0dd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 28 Mar 2020 15:03:05 +0100 Subject: Tolerate puglPostRedisplay() in configure handlers --- pugl/detail/x11.c | 21 +++++++++++---------- 1 file 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); } } } -- cgit v1.2.1