From 252421757e4e8ca9f482f2885ef9c09492c06757 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 1 Sep 2016 22:25:07 -0400 Subject: Enter context before dispatching expose/configure --- pugl/pugl_internal.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index d9dfdfa..23abebf 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -293,7 +293,15 @@ puglDispatchEvent(PuglView* view, const PuglEvent* event) if (event->type == PUGL_NOTHING) { return; } else if (view->eventFunc) { + const bool is_draw = (event->type == PUGL_CONFIGURE || + event->type == PUGL_EXPOSE); + if (is_draw) { + puglEnterContext(view); + } view->eventFunc(view, event); + if (is_draw) { + puglLeaveContext(view, event->type == PUGL_EXPOSE); + } } switch (event->type) { -- cgit v1.2.1