summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXColor.c
diff options
context:
space:
mode:
authorculler <culler>2020-08-04 14:47:00 (GMT)
committerculler <culler>2020-08-04 14:47:00 (GMT)
commit24bb9dda59ff526f18fee2b721f9cb5edb845297 (patch)
tree6f824ebac9edab22d8f89b7caee62ee580884eba /macosx/tkMacOSXColor.c
parent82fa36590eab7415072e7d56195fca78277676c7 (diff)
parent6115c6c774ebf6d95e16b18fd3378d691f26722d (diff)
downloadtk-24bb9dda59ff526f18fee2b721f9cb5edb845297.zip
tk-24bb9dda59ff526f18fee2b721f9cb5edb845297.tar.gz
tk-24bb9dda59ff526f18fee2b721f9cb5edb845297.tar.bz2
Merge 8.6 but remove HITheme and HIBackground colors which are only supported on 32-bit systems
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r--macosx/tkMacOSXColor.c54
1 files changed, 8 insertions, 46 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index fe16d53..a2024fd 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -40,9 +40,12 @@ void initColorTable()
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
int newPtr, index = 0;
+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
- darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
- lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+ if (@available(macOS 10.14, *)) {
+ darkAqua = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua];
+ lightAqua = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
+ }
#endif
/*
@@ -279,27 +282,6 @@ GetRGBA(
break;
case clearColor:
rgba[3] = 0;
- case HIText:
-#ifdef __LP64__
- color = [[NSColor textColor] colorUsingColorSpace:sRGB];
- [color getComponents: rgba];
-#else
- {
- RGBColor rgb;
- err = GetThemeTextColor(kThemeTextColorPushButtonActive, 32,
- true, &rgb);
- if (err == noErr) {
- rgba[0] = (CGFLoat) rgb.red / 65535;
- rgba[1] = (CGFLoat) rgb.green / 65535;
- rgba[2] = (CGFLoat) rgb.blue / 65535;
- }
- }
-#endif
- break;
- case HIBackground:
- color = [[NSColor windowBackgroundColor] colorUsingColorSpace:sRGB];
- [color getComponents: rgba];
- break;
default:
break;
}
@@ -316,12 +298,6 @@ GetRGBA(
* values are copied into the CGColorRef. Otherwise the components are
* computed from the SystemColorDatum.
*
- * In 64 bit macOS systems there are no HITheme functions which convert
- * HIText or HIBackground colors to CGColors. (GetThemeTextColor was
- * removed, and it was never possible with backgrounds.) On 64-bit systems
- * we replace all HIText colors by systemTextColor and all HIBackground
- * colors by systemWindowBackgroundColor.
- *
* Results:
* True if the function succeeds, false otherwise.
*
@@ -378,21 +354,19 @@ TkMacOSXInDarkMode(Tk_Window tkwin)
int result = false;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
-
- if ([NSApp macOSVersion] >= 101400) {
+ if (@available(macOS 10.14, *)) {
TkWindow *winPtr = (TkWindow*) tkwin;
NSView *view = nil;
if (winPtr && winPtr->privatePtr) {
view = TkMacOSXDrawableView(winPtr->privatePtr);
}
if (view) {
- result = (view.effectiveAppearance.name == NSAppearanceNameDarkAqua);
+ result = (view.effectiveAppearance == darkAqua);
} else {
- result = ([NSAppearance currentAppearance].name == NSAppearanceNameDarkAqua);
+ result = ([NSAppearance currentAppearance] == darkAqua);
}
}
#endif
-
return result;
}
@@ -608,8 +582,6 @@ TkMacOSXSetColorInContext(
OSStatus err = noErr;
CGColorRef cgColor = nil;
SystemColorDatum *entry = GetEntryFromPixel(pixel);
- CGRect rect;
- HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};;
if (entry) {
switch (entry->type) {
@@ -621,16 +593,6 @@ TkMacOSXSetColorInContext(
kHIThemeOrientationNormal);
}
break;
- case HIText:
- err = ChkErr(HIThemeSetTextFill, entry->value, NULL, context,
- kHIThemeOrientationNormal);
- break;
- case HIBackground:
- info.kind = entry->value;
- rect = CGContextGetClipBoundingBox(context);
- err = ChkErr(HIThemeApplyBackground, &rect, &info,
- context, kHIThemeOrientationNormal);
- break;
default:
if (SetCGColorComponents(entry, pixel, &cgColor)){
SetCachedColor(gc, pixel, cgColor);