From 11a3e75f47085fe14da5ff4ca5fe2298092fd937 Mon Sep 17 00:00:00 2001 From: omar Date: Mon, 4 May 2020 20:46:20 +0200 Subject: [PATCH] Backends: Win32: Fix _WIN32_WINNT < 0x0600 (MinGW defaults to 0x502 == Windows 2003). (#3183) --- docs/CHANGELOG.txt | 1 + examples/imgui_impl_win32.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 819abbec..96cadc9b 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -51,6 +51,7 @@ Other Changes: Set to FLT_MAX to only display a close button when selected (merely hovering is not enough). Set to an intermediary value to toggle behavior based on width (same as Firefox). - Backends: Win32: Support for #define NOGDI, won't try to call GetDeviceCaps(). (#3137, #2327) +- Backends: Win32: Fix _WIN32_WINNT < 0x0600 (MinGW defaults to 0x502 == Windows 2003). (#3183) - Backends: OpenGL: Fixed handling of GL 4.5+ glClipControl(GL_UPPER_LEFT) by inverting the projection matrix top and bottom values. (#3143, #3146) [@u3shit] - Backends: Vulkan: Fixed error in if initial frame has no vertices. (#3177) diff --git a/examples/imgui_impl_win32.cpp b/examples/imgui_impl_win32.cpp index aa00a1f9..ae18eb6e 100644 --- a/examples/imgui_impl_win32.cpp +++ b/examples/imgui_impl_win32.cpp @@ -359,7 +359,7 @@ IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARA #if !defined(_versionhelpers_H_INCLUDED_) && !defined(_INC_VERSIONHELPERS) static BOOL IsWindowsVersionOrGreater(WORD major, WORD minor, WORD sp) { - OSVERSIONINFOEXW osvi = { sizeof(osvi), major, minor, 0, 0, { 0 }, sp }; + OSVERSIONINFOEXW osvi = { sizeof(osvi), major, minor, 0, 0, { 0 }, sp, 0, 0, 0, 0 }; DWORD mask = VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR; ULONGLONG cond = ::VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL); cond = ::VerSetConditionMask(cond, VER_MINORVERSION, VER_GREATER_EQUAL); @@ -405,7 +405,9 @@ void ImGui_ImplWin32_EnableDpiAwareness() return; } } - SetProcessDPIAware(); +#if _WIN32_WINNT >= 0x0600 + ::SetProcessDPIAware(); +#endif } #if defined(_MSC_VER) && !defined(NOGDI)