Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation of macOS-10.13 (High Sierra) #9754

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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