aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/win.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-08-04 20:19:01 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:39 +0200
commitb0ac6dcb492b68404d800fe8ed0c7393d487fa4b (patch)
tree41d0050ef6d33bfe9f2186195168e36f8a8b8f3a /pugl/detail/win.c
parent075c5c5927e511dd03d9608a285ed58ef395120b (diff)
downloadpugl-b0ac6dcb492b68404d800fe8ed0c7393d487fa4b.tar.gz
pugl-b0ac6dcb492b68404d800fe8ed0c7393d487fa4b.tar.bz2
pugl-b0ac6dcb492b68404d800fe8ed0c7393d487fa4b.zip
Add puglSetClassName()
Diffstat (limited to 'pugl/detail/win.c')
-rw-r--r--pugl/detail/win.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 96642cc..efd6070 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -51,8 +51,6 @@
typedef BOOL (WINAPI *PFN_SetProcessDPIAware)(void);
-static const TCHAR* DEFAULT_CLASSNAME = "Pugl";
-
LRESULT CALLBACK
wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
@@ -140,9 +138,7 @@ puglCreateWindow(PuglView* view, const char* title)
{
PuglInternals* impl = view->impl;
- const char* className = view->windowClass ? view->windowClass : DEFAULT_CLASSNAME;
-
- title = title ? title : "Window";
+ title = title ? title : view->world->className;
// Get refresh rate for resize draw timer
DEVMODEA devMode = {0};
@@ -150,7 +146,7 @@ puglCreateWindow(PuglView* view, const char* title)
view->impl->refreshRate = devMode.dmDisplayFrequency;
// Register window class if necessary
- if (!puglRegisterWindowClass(className)) {
+ if (!puglRegisterWindowClass(view->world->className)) {
return 1;
}
@@ -202,7 +198,6 @@ puglFreeViewInternals(PuglView* view)
view->backend->destroy(view);
ReleaseDC(view->impl->hwnd, view->impl->hdc);
DestroyWindow(view->impl->hwnd);
- UnregisterClass(view->windowClass ? view->windowClass : DEFAULT_CLASSNAME, NULL);
free(view->impl);
}
}
@@ -210,6 +205,7 @@ puglFreeViewInternals(PuglView* view)
void
puglFreeWorldInternals(PuglWorld* world)
{
+ UnregisterClass(world->className, NULL);
free(world->impl);
}