check for shellscalingapi.h presence instead of WINVER >= 0x0603
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a49a581..e56a5f5 100644
--- a/CMakeLists.txt
+++ b/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)
diff --git a/configure b/configure
index b6f9b70..1c1ac2d 100755
--- a/configure
+++ b/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. */
@@ -27104,6 +27104,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
}
CheckOS2()
diff --git a/configure.ac b/configure.ac
index ee8a41e..4420359 100644
--- a/configure.ac
+++ b/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
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 6f448c0..9cc18ab 100644
--- a/include/SDL_config.h.cmake
+++ b/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@
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index c758b45..7b6eb5d 100644
--- a/include/SDL_config.h.in
+++ b/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
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h
index 076bea4..3ad3e8f 100644
--- a/include/SDL_config_windows.h
+++ b/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
diff --git a/src/video/windows/SDL_windowsvideo.h b/src/video/windows/SDL_windowsvideo.h
index 50a4371..b477655 100644
--- a/src/video/windows/SDL_windowsvideo.h
+++ b/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_