From b0ac6dcb492b68404d800fe8ed0c7393d487fa4b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Aug 2019 20:19:01 +0200 Subject: Add puglSetClassName() --- pugl/detail/win.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'pugl/detail/win.c') 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); } -- cgit v1.2.1