From 6323779596dea0db7f58afef7d3d3d5588ef20cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 8 Jan 2017 20:41:11 +0100 Subject: [PATCH] Windows: Define _WIN32_WINRT to 0x0600 (Vista) Passed as a compiler define to be sure it is always define before windows.h is loaded. This means that Godot officially requires Vista API or later, it will not work on Windows XP or earlier. Also fix a bogus check for Windows 7 API. --- drivers/unix/ip_unix.cpp | 12 +++--------- drivers/windows/file_access_windows.cpp | 2 -- platform/windows/context_gl_win.cpp | 1 - platform/windows/detect.py | 4 ++++ platform/windows/key_mapping_win.cpp | 2 +- platform/windows/os_windows.cpp | 2 +- platform/windows/os_windows.h | 2 -- 7 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp index 0ebd5939536..e75408e493c 100644 --- a/drivers/unix/ip_unix.cpp +++ b/drivers/unix/ip_unix.cpp @@ -37,19 +37,13 @@ #ifndef AI_ADDRCONFIG #define AI_ADDRCONFIG 0x00000400 #endif - #ifdef UWP_ENABLED #include #include #include #include - #else - #define WINVER 0x0600 - #include - #include - #include - #include - #include - #endif + #ifndef UWP_ENABLED + #include + #endif #else #include #ifdef ANDROID_ENABLED diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 4060e0e83c3..183cec96ec9 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -28,8 +28,6 @@ /*************************************************************************/ #ifdef WINDOWS_ENABLED -#define WINVER 0x0500 - #include #include "shlwapi.h" #include "file_access_windows.h" diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 136ac310f66..6b60ade5f0e 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -40,7 +40,6 @@ // // -#define WINVER 0x0500 #include "context_gl_win.h" //#include "drivers/opengl/glwrapper.h" diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 28030afa82d..2262fae0313 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -207,6 +207,10 @@ def build_res_file(target, source, env): def configure(env): env.Append(CPPPATH=['#platform/windows']) + + # Targeted Windows version: Vista (and later) + env.Append(CPPFLAGS=['-D_WIN32_WINNT=0x0600']) + env['is_mingw'] = False if (os.name == "nt" and os.getenv("VCINSTALLDIR")): # build using visual studio diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp index 00a0ca79c7f..9ab222e9ee9 100644 --- a/platform/windows/key_mapping_win.cpp +++ b/platform/windows/key_mapping_win.cpp @@ -26,8 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#define WINVER 0x0500 #include "key_mapping_win.h" + #include struct _WinTranslatePair { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 971ec25f773..34ea9cd156d 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -677,7 +677,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { print_line("input lang change"); } break; - #if WINVER >= 0x0700 // for windows 7 + #if WINVER >= 0x0601 // for windows 7 case WM_TOUCH: { BOOL bHandled = FALSE; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 19367c758b7..e265313f054 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -29,8 +29,6 @@ #ifndef OS_WINDOWS_H #define OS_WINDOWS_H -#define WINVER 0x0600 - #include "os/input.h" #include "os/os.h" #include "context_gl_win.h"