diff options
author | falkTX <falktx@falktx.com> | 2022-10-30 20:49:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-10-30 18:21:18 -0400 |
commit | decde99974f4d879329837d2f8ceb6a556895127 (patch) | |
tree | 3a4a5be8af2e72d60737f164597d53600bbfcef0 | |
parent | 53061d96e91e779ab523dc09248eb09a2a4c01bb (diff) | |
download | pugl-decde99974f4d879329837d2f8ceb6a556895127.tar.gz pugl-decde99974f4d879329837d2f8ceb6a556895127.tar.bz2 pugl-decde99974f4d879329837d2f8ceb6a556895127.zip |
Windows: Fix missing field initializers when building as C++
-rw-r--r-- | src/win.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -35,6 +35,16 @@ #define PUGL_LOCAL_CLIENT_MSG (WM_USER + 52) #define PUGL_USER_TIMER_MIN 9470 +#ifdef __cplusplus +# define PUGL_INIT_STRUCT \ + {} +#else +# define PUGL_INIT_STRUCT \ + { \ + 0 \ + } +#endif + typedef BOOL(WINAPI* PFN_SetProcessDPIAware)(void); typedef HRESULT(WINAPI* PFN_GetProcessDpiAwareness)(HANDLE, DWORD*); typedef HRESULT(WINAPI* PFN_GetScaleFactorForMonitor)(HMONITOR, DWORD*); @@ -80,7 +90,7 @@ puglRegisterWindowClass(const char* name) module = GetModuleHandle(NULL); } - WNDCLASSEX wc = {0}; + WNDCLASSEX wc = PUGL_INIT_STRUCT; if (GetClassInfoEx(module, name, &wc)) { return true; // Already registered } @@ -472,8 +482,8 @@ initKeyEvent(PuglKeyEvent* event, } } else if (!dead) { // Translate unshifted key - BYTE keyboardState[256] = {0}; - wchar_t buf[5] = {0}; + BYTE keyboardState[256] = PUGL_INIT_STRUCT; + wchar_t buf[5] = PUGL_INIT_STRUCT; event->key = puglDecodeUTF16( buf, ToUnicode(vkey, vcode, keyboardState, buf, 4, 1 << 2)); @@ -689,7 +699,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) pt.y = GET_Y_LPARAM(lParam); if (!view->impl->mouseTracked) { - TRACKMOUSEEVENT tme = {0}; + TRACKMOUSEEVENT tme = PUGL_INIT_STRUCT; tme.cbSize = sizeof(tme); tme.dwFlags = TME_LEAVE; |