Skip to content

Commit

Permalink
support for compilation on macos10.14, but running on macos10.13 or e…
Browse files Browse the repository at this point in the history
…arlier
  • Loading branch information
PeterPetrik committed Nov 13, 2018
1 parent 798155c commit b2ba38d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/native/mac/qgsmacnative.mm
Expand Up @@ -121,9 +121,19 @@ - ( BOOL )userNotificationCenter:( NSUserNotificationCenter * )center shouldPres

bool QgsMacNative::hasDarkTheme()
{
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
return ( NSApp.effectiveAppearance.name == NSAppearanceNameDarkAqua );
#else
return false;
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= __MAC_10_14
if (@available(macOS 10.14, *)) {
// compiled on macos 10.14+ AND running on macos 10.14+
// check the settings of effective apperance of the user
return ( NSApp.effectiveAppearance.name == NSAppearanceNameDarkAqua );
} else {
// compiled on macos 10.14+ BUT running on macos 10.13-
// DarkTheme was introduced in MacOS 10.14, fallback to light theme
return false;
}
#endif
// compiled on macos 10.13- AND running anywhere
// NSAppearanceNameDarkAqua is not in SDK headers
// fallback to light theme
return false;
}

0 comments on commit b2ba38d

Please sign in to comment.