aboutsummaryrefslogtreecommitdiffstats
path: root/src/win.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/win.c')
-rw-r--r--src/win.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/win.c b/src/win.c
index e41222b..13ad090 100644
--- a/src/win.c
+++ b/src/win.c
@@ -1,4 +1,4 @@
-// Copyright 2012-2022 David Robillard <d@drobilla.net>
+// Copyright 2012-2023 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
#include "win.h"
@@ -275,6 +275,30 @@ puglRealize(PuglView* view)
}
PuglStatus
+puglUnrealize(PuglView* const view)
+{
+ PuglInternals* const impl = view->impl;
+ if (!impl || !impl->hwnd) {
+ return PUGL_FAILURE;
+ }
+
+ puglDispatchSimpleEvent(view, PUGL_DESTROY);
+
+ if (view->backend) {
+ view->backend->destroy(view);
+ }
+
+ ReleaseDC(view->impl->hwnd, view->impl->hdc);
+ view->impl->hdc = NULL;
+
+ DestroyWindow(view->impl->hwnd);
+ view->impl->hwnd = NULL;
+
+ memset(&view->lastConfigure, 0, sizeof(PuglConfigureEvent));
+ return PUGL_SUCCESS;
+}
+
+PuglStatus
puglShow(PuglView* view)
{
PuglInternals* impl = view->impl;