aboutsummaryrefslogtreecommitdiffstats
path: root/src/mac.m
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-04 11:02:32 -0500
committerDavid Robillard <d@drobilla.net>2023-01-04 13:28:46 -0500
commit2e8e543725e7e3b375321b93c0f5a2e684b60911 (patch)
tree5ed8d077186df5a01c881d764a872f9daaa3060a /src/mac.m
parent0da2b2695face3321e0e39c50b47f6156dfed4e2 (diff)
downloadpugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.tar.gz
pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.tar.bz2
pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.zip
Add puglUnrealize()
Diffstat (limited to 'src/mac.m')
-rw-r--r--src/mac.m39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/mac.m b/src/mac.m
index 0ba95ca..658c807 100644
--- a/src/mac.m
+++ b/src/mac.m
@@ -1,4 +1,4 @@
-// Copyright 2012-2022 David Robillard <d@drobilla.net>
+// Copyright 2012-2023 David Robillard <d@drobilla.net>
// Copyright 2017 Hanspeter Portner <dev@open-music-kontrollers.ch>
// SPDX-License-Identifier: ISC
@@ -1171,6 +1171,43 @@ puglRealize(PuglView* view)
}
PuglStatus
+puglUnrealize(PuglView* const view)
+{
+ PuglInternals* const impl = view->impl;
+ if (!impl || !impl->wrapperView) {
+ return PUGL_FAILURE;
+ }
+
+ puglDispatchSimpleEvent(view, PUGL_DESTROY);
+
+ if (view->backend) {
+ view->backend->destroy(view);
+ }
+
+ if (impl->wrapperView) {
+ [impl->wrapperView removeFromSuperview];
+ impl->wrapperView->puglview = NULL;
+ }
+
+ if (impl->window) {
+ [impl->window close];
+ }
+
+ if (impl->wrapperView) {
+ [impl->wrapperView release];
+ impl->wrapperView = NULL;
+ }
+
+ if (impl->window) {
+ [impl->window release];
+ impl->window = NULL;
+ }
+
+ memset(&view->lastConfigure, 0, sizeof(PuglConfigureEvent));
+ return PUGL_SUCCESS;
+}
+
+PuglStatus
puglShow(PuglView* view)
{
if (!view->impl->wrapperView) {