Selaa lähdekoodia

check for shellscalingapi.h presence instead of WINVER >= 0x0603

Ozkan Sezer 2 vuotta sitten
vanhempi
commit
a8d41b3b45

+ 1 - 0
CMakeLists.txt

@@ -1651,6 +1651,7 @@ elseif(WINDOWS)
   check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
   check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
   check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
+  check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H)
 
   if(SDL_AUDIO)
     if(NOT WINDOWS_STORE)

+ 15 - 4
configure

@@ -14084,11 +14084,11 @@ if test x$ac_prog_cxx_stdcxx = xno
 then :
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
 printf %s "checking for $CXX option to enable C++11 features... " >&6; }
-if test ${ac_cv_prog_cxx_11+y}
+if test ${ac_cv_prog_cxx_cxx11+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  ac_cv_prog_cxx_11=no
+  ac_cv_prog_cxx_cxx11=no
 ac_save_CXX=$CXX
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -14130,11 +14130,11 @@ if test x$ac_prog_cxx_stdcxx = xno
 then :
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
 printf %s "checking for $CXX option to enable C++98 features... " >&6; }
-if test ${ac_cv_prog_cxx_98+y}
+if test ${ac_cv_prog_cxx_cxx98+y}
 then :
   printf %s "(cached) " >&6
 else $as_nop
-  ac_cv_prog_cxx_98=no
+  ac_cv_prog_cxx_cxx98=no
 ac_save_CXX=$CXX
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -27103,6 +27103,17 @@ fi
 
 printf "%s\n" "#define HAVE_ROAPI_H 1" >>confdefs.h
 
+    fi
+    ac_fn_c_check_header_compile "$LINENO" "shellscalingapi.h" "ac_cv_header_shellscalingapi_h" "$ac_includes_default"
+if test "x$ac_cv_header_shellscalingapi_h" = xyes
+then :
+  have_shellscalingapi_h=yes
+fi
+
+    if test x$shellscalingapi_h = xyes; then
+
+printf "%s\n" "#define HAVE_SHELLSCALINGAPI_H 1" >>confdefs.h
+
     fi
 }
 

+ 4 - 0
configure.ac

@@ -3242,6 +3242,10 @@ CheckWINDOWS()
     if test x$have_roapi_h = xyes; then
         AC_DEFINE(HAVE_ROAPI_H, 1, [ ])
     fi
+    AC_CHECK_HEADER(shellscalingapi.h,have_shellscalingapi_h=yes)
+    if test x$shellscalingapi_h = xyes; then
+        AC_DEFINE(HAVE_SHELLSCALINGAPI_H, 1, [ ])
+    fi
 }
 
 dnl Determine whether the compiler can produce OS/2 executables

+ 1 - 0
include/SDL_config.h.cmake

@@ -256,6 +256,7 @@
 #cmakedefine HAVE_TPCSHRD_H @HAVE_TPCSHRD_H@
 #cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@
 #cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@
+#cmakedefine HAVE_SHELLSCALINGAPI_H @HAVE_SHELLSCALINGAPI_H@
 
 #cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
 #cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@

+ 1 - 0
include/SDL_config.h.in

@@ -246,6 +246,7 @@
 #undef HAVE_TPCSHRD_H
 #undef HAVE_SENSORSAPI_H
 #undef HAVE_ROAPI_H
+#undef HAVE_SHELLSCALINGAPI_H
 
 /* SDL internal assertion support */
 #undef SDL_DEFAULT_ASSERT_LEVEL

+ 3 - 0
include/SDL_config_windows.h

@@ -122,6 +122,9 @@ typedef unsigned int uintptr_t;
 #if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */
 #define HAVE_D3D12_H 1
 #endif
+#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603  /* Windows 8.1 SDK */
+#define HAVE_SHELLSCALINGAPI_H 1
+#endif
 #define HAVE_MMDEVICEAPI_H 1
 #define HAVE_AUDIOCLIENT_H 1
 #define HAVE_TPCSHRD_H 1

+ 2 - 2
src/video/windows/SDL_windowsvideo.h

@@ -274,7 +274,7 @@ typedef struct DISPLAYCONFIG_TARGET_DEVICE_NAME
 
 #endif /* WINVER < 0x0601 */
 
-#if WINVER < 0x0603
+#ifndef HAVE_SHELLSCALINGAPI_H
 
 typedef enum MONITOR_DPI_TYPE {
     MDT_EFFECTIVE_DPI = 0,
@@ -291,7 +291,7 @@ typedef enum PROCESS_DPI_AWARENESS {
 
 #else
 #include <shellscalingapi.h>
-#endif /* WINVER < 0x0603 */
+#endif
 
 #ifndef _DPI_AWARENESS_CONTEXTS_