Browse Source

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.

(cherry picked from commit 6323779596dea0db7f58afef7d3d3d5588ef20cb)
Rémi Verschelde 8 years ago
parent
commit
d66740175e

+ 3 - 9
drivers/unix/ip_unix.cpp

@@ -37,19 +37,13 @@
   #ifndef AI_ADDRCONFIG
   #ifndef AI_ADDRCONFIG
     #define AI_ADDRCONFIG 0x00000400
     #define AI_ADDRCONFIG 0x00000400
   #endif
   #endif
- #ifdef WINRT_ENABLED
   #include <ws2tcpip.h>
   #include <ws2tcpip.h>
   #include <winsock2.h>
   #include <winsock2.h>
   #include <windows.h>
   #include <windows.h>
   #include <stdio.h>
   #include <stdio.h>
- #else
-  #define WINVER 0x0600
-  #include <ws2tcpip.h>
-  #include <winsock2.h>
-  #include <windows.h>
-  #include <stdio.h>
-  #include <iphlpapi.h>
- #endif
+  #ifndef WINRT_ENABLED
+    #include <iphlpapi.h>
+  #endif
 #else
 #else
  #include <netdb.h>
  #include <netdb.h>
  #ifdef ANDROID_ENABLED
  #ifdef ANDROID_ENABLED

+ 0 - 2
drivers/windows/file_access_windows.cpp

@@ -28,8 +28,6 @@
 /*************************************************************************/
 /*************************************************************************/
 #ifdef WINDOWS_ENABLED
 #ifdef WINDOWS_ENABLED
 
 
-#define WINVER 0x0500
-
 #include <windows.h>
 #include <windows.h>
 #include "shlwapi.h"
 #include "shlwapi.h"
 #include "file_access_windows.h"
 #include "file_access_windows.h"

+ 0 - 1
platform/windows/context_gl_win.cpp

@@ -40,7 +40,6 @@
 //
 //
 //
 //
 
 
-#define WINVER 0x0500
 #include "context_gl_win.h"
 #include "context_gl_win.h"
 
 
 //#include "drivers/opengl/glwrapper.h"
 //#include "drivers/opengl/glwrapper.h"

+ 4 - 0
platform/windows/detect.py

@@ -198,6 +198,10 @@ def build_res_file(target, source, env):
 def configure(env):
 def configure(env):
 
 
     env.Append(CPPPATH=['#platform/windows'])
     env.Append(CPPPATH=['#platform/windows'])
+
+    # Targeted Windows version: Vista (and later)
+    env.Append(CPPFLAGS=['-D_WIN32_WINNT=0x0600'])
+
     env['is_mingw'] = False
     env['is_mingw'] = False
     if (os.name == "nt" and os.getenv("VSINSTALLDIR") != None):
     if (os.name == "nt" and os.getenv("VSINSTALLDIR") != None):
         # build using visual studio
         # build using visual studio

+ 1 - 1
platform/windows/key_mapping_win.cpp

@@ -26,8 +26,8 @@
 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
 /*************************************************************************/
 /*************************************************************************/
-#define WINVER 0x0500
 #include "key_mapping_win.h"
 #include "key_mapping_win.h"
+
 #include <stdio.h>
 #include <stdio.h>
 
 
 struct _WinTranslatePair {
 struct _WinTranslatePair {

+ 1 - 1
platform/windows/os_windows.cpp

@@ -686,7 +686,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM	wParam,	LPARAM	lParam) {
 			print_line("input lang change");
 			print_line("input lang change");
 		} break;
 		} break;
 
 
-		#if WINVER >= 0x0700 // for windows 7
+		#if WINVER >= 0x0601 // for windows 7
 		case WM_TOUCH: {
 		case WM_TOUCH: {
 
 
 			BOOL bHandled = FALSE;
 			BOOL bHandled = FALSE;

+ 0 - 2
platform/windows/os_windows.h

@@ -29,8 +29,6 @@
 #ifndef OS_WINDOWS_H
 #ifndef OS_WINDOWS_H
 #define OS_WINDOWS_H
 #define OS_WINDOWS_H
 
 
-#define WINVER 0x0600
-
 #include "os/input.h"
 #include "os/input.h"
 #include "os/os.h"
 #include "os/os.h"
 #include "context_gl_win.h"
 #include "context_gl_win.h"