diff options
author | culler <culler> | 2020-08-24 17:00:57 (GMT) |
---|---|---|
committer | culler <culler> | 2020-08-24 17:00:57 (GMT) |
commit | e98f41ec7f422fce9089b087b6ca9bfd73697988 (patch) | |
tree | 35c730b2b7317684cbb81c5c6b9fd6a57f55c18a | |
parent | f65c94115a3cb2fee74dd75d503d2da365fca0f4 (diff) | |
parent | 5fce3b6e1af2cae22198a50413ae9712e42422b9 (diff) | |
download | tk-e98f41ec7f422fce9089b087b6ca9bfd73697988.zip tk-e98f41ec7f422fce9089b087b6ca9bfd73697988.tar.gz tk-e98f41ec7f422fce9089b087b6ca9bfd73697988.tar.bz2 |
Fix [bc62f78191]: compilation issues on macOS when targeting older OS versions.
-rw-r--r-- | macosx/tkMacOSXColor.c | 26 | ||||
-rw-r--r-- | macosx/tkMacOSXDraw.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 8 |
3 files changed, 22 insertions, 14 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/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 24eb380..87bd90c 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -17,7 +17,7 @@ #include "tkMacOSXDebug.h" #include "tkButton.h" -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 +#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 #define GET_CGCONTEXT [[NSGraphicsContext currentContext] CGContext] #else #define GET_CGCONTEXT [[NSGraphicsContext currentContext] graphicsPort] diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index acea6f0..7437891 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -208,7 +208,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification; if (winPtr) { TKContentView *view = [window contentView]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - [view viewDidChangeEffectiveAppearance]; + if (@available(macOS 10.14, *)) { + [view viewDidChangeEffectiveAppearance]; + } #endif [view addTkDirtyRect:[view bounds]]; Tcl_CancelIdleCall(TkMacOSXDrawAllViews, NULL); @@ -1142,7 +1144,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]; + } } } |