Skip to content

Commit

Permalink
Fix compilation of macOS-10.13 (High Sierra)
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Tkachuk <andriy.tkachuk@gmail.com>
  • Loading branch information
andriytk committed Aug 17, 2023
1 parent 6f14bec commit 779fd94
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/osutils/macutils/AppKitImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,17 @@ - (void) observeValueForKeyPath:(NSString *)keyPath
emit m_appkit->interfaceThemeChanged();
};

#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000)
if(@available(macOS 11.0, *)) {
// Not sure why exactly this call is needed, but Apple sample code uses it so it's best to use it here too
[NSApp.effectiveAppearance performAsCurrentDrawingAppearance:emitBlock];
}
else {
emitBlock();
}
#else
emitBlock();
#endif
}
}
}
Expand Down Expand Up @@ -139,7 +143,14 @@ - (bool) isHidden:(pid_t) pid
//
- (bool) isDarkMode
{
#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000)
return [NSApp.effectiveAppearance.name isEqualToString:NSAppearanceNameDarkAqua];
#else
NSDictionary* dict = [[NSUserDefaults standardUserDefaults] persistentDomainForName:NSGlobalDomain];
id style = [dict objectForKey:@"AppleInterfaceStyle"];
return ( style && [style isKindOfClass:[NSString class]]
&& NSOrderedSame == [style caseInsensitiveCompare:@"dark"] );
#endif
}


Expand Down

0 comments on commit 779fd94

Please sign in to comment.