diff options
Diffstat (limited to 'pugl/detail/implementation.c')
-rw-r--r-- | pugl/detail/implementation.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 7d7a54f..17cc6fd 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -21,6 +21,7 @@ #include "pugl/detail/implementation.h" #include "pugl/pugl.h" +#include <assert.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -203,8 +204,7 @@ puglNewView(PuglWorld* const world) void puglFreeView(PuglView* view) { - const PuglEvent destroyEvent = {{PUGL_DESTROY, 0}}; - puglDispatchEvent(view, &destroyEvent); + puglDispatchSimpleEvent(view, PUGL_DESTROY); // Remove from world view list PuglWorld* world = view->world; @@ -366,6 +366,16 @@ puglMustConfigure(PuglView* view, const PuglEventConfigure* configure) } void +puglDispatchSimpleEvent(PuglView* view, const PuglEventType type) +{ + assert(type == PUGL_CREATE || type == PUGL_DESTROY || type == PUGL_MAP || + type == PUGL_UNMAP || type == PUGL_CLOSE); + + const PuglEvent event = {{type, 0}}; + puglDispatchEvent(view, &event); +} + +void puglDispatchEvent(PuglView* view, const PuglEvent* event) { switch (event->type) { |