diff options
author | David Robillard <d@drobilla.net> | 2020-03-09 21:49:53 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-09 21:49:53 +0100 |
commit | a7cb0cb1506792d6893556bc976822e254a89106 (patch) | |
tree | c6ea552a3fb0fbf711ecbfafc699030eda3f8158 /pugl/detail/implementation.c | |
parent | ed301f0548438692269481096e6ef51c3ead01dc (diff) | |
download | pugl-a7cb0cb1506792d6893556bc976822e254a89106.tar.gz pugl-a7cb0cb1506792d6893556bc976822e254a89106.tar.bz2 pugl-a7cb0cb1506792d6893556bc976822e254a89106.zip |
Add create, destroy, map, and unmap events
These can be used to do things when a view is created or destroyed, in
particular set up the GL context in a more controlled way. Map and unmap
events are also added for when views are shown and hidden so application can
react to this as well.
Towards the deprecation of puglEnterContext() and puglLeaveContext(), which are
prone to abuse.
squash! Remove client event stuff
Diffstat (limited to 'pugl/detail/implementation.c')
-rw-r--r-- | pugl/detail/implementation.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index e9e1ae9..5c3da62 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -159,6 +159,9 @@ puglNewView(PuglWorld* const world) void puglFreeView(PuglView* view) { + const PuglEvent destroyEvent = {{PUGL_DESTROY, 0}}; + puglDispatchEvent(view, &destroyEvent); + // Remove from world view list PuglWorld* world = view->world; for (size_t i = 0; i < world->numViews; ++i) { @@ -309,6 +312,8 @@ puglDispatchEvent(PuglView* view, const PuglEvent* event) switch (event->type) { case PUGL_NOTHING: break; + case PUGL_CREATE: + case PUGL_DESTROY: case PUGL_CONFIGURE: view->backend->enter(view, NULL); view->eventFunc(view, event); |