Fix __MAC_OS_X_VERSION_MAX_ALLOWED comparison in dark theme function

Version comparison needs to be numeric, in case __MAC_10_10_4 is not
defined, e.g. some pre-10.14 SDKs

Forward port of #8938
This commit is contained in:
Larry Shaffer 2019-06-26 14:45:25 -06:00 committed by Nyall Dawson
parent f4348259c9
commit 5bed72760f

View File

@ -121,7 +121,11 @@ QgsNative::NotificationResult QgsMacNative::showDesktopNotification( const QStri
bool QgsMacNative::hasDarkTheme()
{
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_14
#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
// Version comparison needs to be numeric, in case __MAC_10_10_4 is not defined, e.g. some pre-10.14 SDKs
// See: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Using/using.html
// Section "Conditionally Compiling for Different SDKs"
if ( [NSApp respondsToSelector:@selector( effectiveAppearance )] )
{
// compiled on macos 10.14+ AND running on macos 10.14+
@ -135,6 +139,7 @@ bool QgsMacNative::hasDarkTheme()
// DarkTheme was introduced in MacOS 10.14, fallback to light theme
return false;
}
#endif
#endif
// compiled on macos 10.13-
// NSAppearanceNameDarkAqua is not in SDK headers