mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Backport 6796f2337ee31b4b4f07eaa54d868b999c39233a from Qt
The detection of Windows 10 is broken in Qt 4.8.6 and in Qt 5.2 through 5.4.1 (see QTBUG-43413). The commit above fixed it. I backported only half of the solution, since the other half requires the private class QSystemLibrary. Signed-off-by: Thiago Macieira <thiago@macieira.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8a5f4455ac
commit
2843dc38c9
1 changed files with 39 additions and 21 deletions
|
@ -131,6 +131,7 @@
|
||||||
#define ARCH_FULL ARCH_PROCESSOR "-" ARCH_ENDIANNESS "-" ARCH_POINTER ARCH_ABI
|
#define ARCH_FULL ARCH_PROCESSOR "-" ARCH_ENDIANNESS "-" ARCH_POINTER ARCH_ABI
|
||||||
|
|
||||||
// --- end of archdetect.cpp ---
|
// --- end of archdetect.cpp ---
|
||||||
|
// copied from Qt 5.4.1's src/corelib/global/qglobal.cpp
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||||
|
|
||||||
|
@ -139,33 +140,50 @@ QT_BEGIN_INCLUDE_NAMESPACE
|
||||||
QT_END_INCLUDE_NAMESPACE
|
QT_END_INCLUDE_NAMESPACE
|
||||||
|
|
||||||
#ifndef Q_OS_WINRT
|
#ifndef Q_OS_WINRT
|
||||||
|
# ifndef Q_OS_WINCE
|
||||||
|
// Fallback for determining Windows versions >= 8 by looping using the
|
||||||
|
// version check macros. Note that it will return build number=0 to avoid
|
||||||
|
// inefficient looping.
|
||||||
|
static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result)
|
||||||
|
{
|
||||||
|
result->dwBuildNumber = 0;
|
||||||
|
DWORDLONG conditionMask = 0;
|
||||||
|
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||||
|
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
|
||||||
|
OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0,
|
||||||
|
result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
|
||||||
|
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion)
|
||||||
|
result->dwMajorVersion = checkVersion.dwMajorVersion;
|
||||||
|
conditionMask = 0;
|
||||||
|
checkVersion.dwMajorVersion = result->dwMajorVersion;
|
||||||
|
checkVersion.dwMinorVersion = 0;
|
||||||
|
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL);
|
||||||
|
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||||
|
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
|
||||||
|
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
|
||||||
|
result->dwMinorVersion = checkVersion.dwMinorVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif // !Q_OS_WINCE
|
||||||
|
|
||||||
static inline OSVERSIONINFO winOsVersion()
|
static inline OSVERSIONINFO winOsVersion()
|
||||||
{
|
{
|
||||||
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
|
OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}};
|
||||||
// GetVersionEx() has been deprecated in Windows 8.1 and will return
|
// GetVersionEx() has been deprecated in Windows 8.1 and will return
|
||||||
// only Windows 8 from that version on.
|
// only Windows 8 from that version on.
|
||||||
# if defined(_MSC_VER) && _MSC_VER >= 1800
|
# if defined(_MSC_VER) && _MSC_VER >= 1800
|
||||||
# pragma warning( push )
|
# pragma warning( push )
|
||||||
# pragma warning( disable : 4996 )
|
# pragma warning( disable : 4996 )
|
||||||
# endif
|
# endif
|
||||||
GetVersionEx(&result);
|
GetVersionEx(&result);
|
||||||
# if defined(_MSC_VER) && _MSC_VER >= 1800
|
# if defined(_MSC_VER) && _MSC_VER >= 1800
|
||||||
# pragma warning( pop )
|
# pragma warning( pop )
|
||||||
# endif
|
# endif
|
||||||
# ifndef Q_OS_WINCE
|
# ifndef Q_OS_WINCE
|
||||||
if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
|
if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) {
|
||||||
// This could be Windows 8.1 or higher. Note that as of Windows 9,
|
determineWinOsVersionFallbackPost8(&result);
|
||||||
// the major version needs to be checked as well.
|
}
|
||||||
DWORDLONG conditionMask = 0;
|
# endif // !Q_OS_WINCE
|
||||||
VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
|
||||||
VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
|
||||||
VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL);
|
|
||||||
OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion,
|
|
||||||
result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 };
|
|
||||||
for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion)
|
|
||||||
result.dwMinorVersion = checkVersion.dwMinorVersion;
|
|
||||||
}
|
|
||||||
# endif // !Q_OS_WINCE
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif // !Q_OS_WINRT
|
#endif // !Q_OS_WINRT
|
||||||
|
|
Loading…
Add table
Reference in a new issue