summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2020-08-23 13:21:39 (GMT)
committerculler <culler>2020-08-23 13:21:39 (GMT)
commit45fc71df26e06074f33babae916d97880a80e9cb (patch)
treee45302acd19b4ba33065888e3af5d406ad266516
parentfaecc793509c834b9b7562b4d549d80585ead2d9 (diff)
downloadtk-45fc71df26e06074f33babae916d97880a80e9cb.zip
tk-45fc71df26e06074f33babae916d97880a80e9cb.tar.gz
tk-45fc71df26e06074f33babae916d97880a80e9cb.tar.bz2
Fix [bc62f78191]: compilation issues when targeting older macOS versions.
-rw-r--r--macosx/tkMacOSXColor.c26
-rw-r--r--macosx/tkMacOSXWindowEvent.c10
2 files changed, 21 insertions, 15 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index e9dbfec..f9d2750 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -769,19 +769,23 @@ TkpGetColor(
if (entry->type == semantic) {
CGFloat rgba[4];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- NSAppearance *savedAppearance = [NSAppearance currentAppearance];
- NSAppearance *windowAppearance = savedAppearance;
- if (view) {
- windowAppearance = [view effectiveAppearance];
- }
- if ([windowAppearance name] == NSAppearanceNameDarkAqua) {
- colormap = darkColormap;
+ if (@available(macOS 10.14, *)) {
+ NSAppearance *savedAppearance = [NSAppearance currentAppearance];
+ NSAppearance *windowAppearance = savedAppearance;
+ if (view) {
+ windowAppearance = [view effectiveAppearance];
+ }
+ if ([windowAppearance name] == NSAppearanceNameDarkAqua) {
+ colormap = darkColormap;
+ } else {
+ colormap = lightColormap;
+ }
+ [NSAppearance setCurrentAppearance:windowAppearance];
+ GetRGBA(entry, p.ulong, rgba);
+ [NSAppearance setCurrentAppearance:savedAppearance];
} else {
- colormap = lightColormap;
+ GetRGBA(entry, p.ulong, rgba);
}
- [NSAppearance setCurrentAppearance:windowAppearance];
- GetRGBA(entry, p.ulong, rgba);
- [NSAppearance setCurrentAppearance:savedAppearance];
#else
GetRGBA(entry, p.ulong, rgba);
#endif
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index acea6f0..e75858d 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -207,9 +207,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(window);
if (winPtr) {
TKContentView *view = [window contentView];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- [view viewDidChangeEffectiveAppearance];
-#endif
+ if (@available(macOS 10.14, *)) {
+ [view viewDidChangeEffectiveAppearance];
+ }
[view addTkDirtyRect:[view bounds]];
Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL);
Tcl_DoWhenIdle(TkMacOSXDrawAllViews, NULL);
@@ -1142,7 +1142,9 @@ static const char *const accentNames[] = {
{
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
if (object == preferences && [keyPath isEqualToString:@"AppleHighlightColor"]) {
- [self viewDidChangeEffectiveAppearance];
+ if (@available(macOS 10.14, *)) {
+ [self viewDidChangeEffectiveAppearance];
+ }
}
}