aboutsummaryrefslogtreecommitdiffstats
path: root/src/win.c
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/win.c
parent0da2b2695face3321e0e39c50b47f6156dfed4e2 (diff)
downloadpugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.tar.gz
pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.tar.bz2
pugl-2e8e543725e7e3b375321b93c0f5a2e684b60911.zip
Add puglUnrealize()
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;