source/lib/sysdep/os/win/wsdl.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/source/lib/sysdep/os/win/wsdl.cpp b/source/lib/sysdep/os/win/wsdl.cpp
index e2cb3fa..26c8567 100644
a
|
b
|
static HWND g_hWnd = (HWND)INVALID_HANDLE_VALUE;
|
70 | 70 | // mostly safe via CS_OWNDC. |
71 | 71 | static HDC g_hDC = (HDC)INVALID_HANDLE_VALUE; |
72 | 72 | |
| 73 | static ATOM g_ClassAtom = INVALID_ATOM; |
73 | 74 | |
74 | 75 | //---------------------------------------------------------------------------- |
75 | 76 | // gamma |
… |
… |
static HWND wnd_CreateWindow(int w, int h)
|
246 | 247 | wc.lpfnWndProc = OnMessage; |
247 | 248 | wc.lpszClassName = L"WSDL{55752F43-0241-492C-8648-C7243397FCE4}"; |
248 | 249 | wc.hInstance = hInst; |
249 | | ATOM class_atom = RegisterClassW(&wc); |
| 250 | g_ClassAtom = RegisterClassW(&wc); |
250 | 251 | // ignore failure, which is probably caused by not unregistering the class |
251 | 252 | // (does not happen automatically when called from a DLL). just re-use |
252 | 253 | // the existing class, which is safe because our class name is unique. |
… |
… |
static HWND wnd_CreateWindow(int w, int h)
|
255 | 256 | wnd_UpdateWindowDimensions(windowStyle, w, h); |
256 | 257 | |
257 | 258 | // note: you can override the hard-coded window name via SDL_WM_SetCaption. |
258 | | HWND hWnd = CreateWindowExW(WS_EX_APPWINDOW, (LPCWSTR)(uintptr_t)class_atom, L"wsdl", windowStyle, 0, 0, w, h, 0, 0, hInst, 0); |
| 259 | HWND hWnd = CreateWindowExW(WS_EX_APPWINDOW, (LPCWSTR)(uintptr_t)g_ClassAtom, L"wsdl", windowStyle, 0, 0, w, h, 0, 0, hInst, 0); |
259 | 260 | if(!wutil_IsValidHandle(hWnd)) |
260 | 261 | DEBUG_WARN_ERR(ERR::FAIL); |
261 | 262 | return hWnd; |
… |
… |
static ModuleInitState initState;
|
1495 | 1496 | |
1496 | 1497 | static Status Init() |
1497 | 1498 | { |
| 1499 | is_quitting = false; |
1498 | 1500 | key_Init(); |
1499 | 1501 | return INFO::OK; |
1500 | 1502 | } |
… |
… |
static void Shutdown()
|
1510 | 1512 | WARN_IF_FALSE(DestroyWindow(g_hWnd)); |
1511 | 1513 | |
1512 | 1514 | video_Shutdown(); |
| 1515 | |
| 1516 | if (g_ClassAtom != INVALID_ATOM) |
| 1517 | { |
| 1518 | UnregisterClassW((LPCWSTR)(uintptr_t)g_ClassAtom, GetModuleHandle(0)); |
| 1519 | g_ClassAtom = INVALID_ATOM; |
| 1520 | } |
1513 | 1521 | } |
1514 | 1522 | |
1515 | 1523 | int SDL_Init(Uint32 UNUSED(flags)) |