summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorculler <culler>2020-08-24 17:07:04 (GMT)
committerculler <culler>2020-08-24 17:07:04 (GMT)
commit0a55a8cb5333b7fdbb29273ca364102c7a7f743e (patch)
tree6aadc7e5ce6550364882b31a874a52dea3a59c2f
parented5dd16c2ee4779451651a8edade91ecca229538 (diff)
parente98f41ec7f422fce9089b087b6ca9bfd73697988 (diff)
downloadtk-0a55a8cb5333b7fdbb29273ca364102c7a7f743e.zip
tk-0a55a8cb5333b7fdbb29273ca364102c7a7f743e.tar.gz
tk-0a55a8cb5333b7fdbb29273ca364102c7a7f743e.tar.bz2
Fix [bc62f78191]: compilation issues on macOS when targeting older OS versions.
-rw-r--r--macosx/tkMacOSXColor.c26
-rw-r--r--macosx/tkMacOSXDraw.c2
-rw-r--r--macosx/tkMacOSXWindowEvent.c8
3 files changed, 22 insertions, 14 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
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index aabe103..19dc9c7 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 d582d75..aa3fa6b 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -211,7 +211,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);
@@ -1155,7 +1157,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];
+ }
}
}