diff options
author | culler <culler> | 2020-08-24 17:07:04 (GMT) |
---|---|---|
committer | culler <culler> | 2020-08-24 17:07:04 (GMT) |
commit | 0a55a8cb5333b7fdbb29273ca364102c7a7f743e (patch) | |
tree | 6aadc7e5ce6550364882b31a874a52dea3a59c2f /macosx/tkMacOSXColor.c | |
parent | ed5dd16c2ee4779451651a8edade91ecca229538 (diff) | |
parent | e98f41ec7f422fce9089b087b6ca9bfd73697988 (diff) | |
download | tk-0a55a8cb5333b7fdbb29273ca364102c7a7f743e.zip tk-0a55a8cb5333b7fdbb29273ca364102c7a7f743e.tar.gz tk-0a55a8cb5333b7fdbb29273ca364102c7a7f743e.tar.bz2 |
Fix [bc62f78191]: compilation issues on macOS when targeting older OS versions.
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r-- | macosx/tkMacOSXColor.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index ee333cf..a1baff3 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -730,19 +730,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 |