summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXColor.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-11-02 08:07:41 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-11-02 08:07:41 (GMT)
commit1c055ce56efa3c3f23a627238525b871d770ed6e (patch)
tree06700e17082ffe0a6e793a54f4663aba2fded552 /macosx/tkMacOSXColor.c
parent4702f656ba869c0cba56459ee489744e035fa9a6 (diff)
parent288cea6827428e424632326901e73d2807cb2135 (diff)
downloadtk-1c055ce56efa3c3f23a627238525b871d770ed6e.zip
tk-1c055ce56efa3c3f23a627238525b871d770ed6e.tar.gz
tk-1c055ce56efa3c3f23a627238525b871d770ed6e.tar.bz2
Merge 8.6
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r--macosx/tkMacOSXColor.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index a59de22..135003d 100644
--- a/macosx/tkMacOSXColor.c
+++ b/macosx/tkMacOSXColor.c
@@ -24,6 +24,7 @@ static int numSystemColors;
static int rgbColorIndex;
static int controlAccentIndex;
static int selectedTabTextIndex;
+static int pressedButtonTextIndex;
static Bool useFakeAccentColor = NO;
static SystemColorDatum **systemColorIndex;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
@@ -67,7 +68,8 @@ void initColorTable()
if (![NSColor respondsToSelector:colorSelector]) {
if ([colorName isEqualToString:@"controlAccentColor"]) {
useFakeAccentColor = YES;
- } else if (![colorName isEqualToString:@"selectedTabTextColor"]) {
+ } else if ( ![colorName isEqualToString:@"selectedTabTextColor"]
+ && ![colorName isEqualToString:@"pressedButtonTextColor"]) {
/* Uncomment to print all unsupported colors: */
/* printf("Unsupported color %s\n", colorName.UTF8String); */
continue;
@@ -147,6 +149,9 @@ void initColorTable()
hPtr = Tcl_FindHashEntry(&systemColors, "SelectedTabTextColor");
entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
selectedTabTextIndex = entry->index;
+ hPtr = Tcl_FindHashEntry(&systemColors, "PressedButtonTextColor");
+ entry = (SystemColorDatum *) Tcl_GetHashValue(hPtr);
+ pressedButtonTextIndex = entry->index;
[pool drain];
}
@@ -278,6 +283,7 @@ GetRGBA(
CGFloat *rgba)
{
NSColor *bgColor, *color = nil;
+ int OSVersion = [NSApp macOSVersion];
if (!sRGB) {
sRGB = [NSColorSpace sRGBColorSpace];
@@ -325,12 +331,17 @@ GetRGBA(
colorUsingColorSpace:sRGB];
#endif
} else if (entry->index == selectedTabTextIndex) {
- int OSVersion = [NSApp macOSVersion];
if (OSVersion > 100600 && OSVersion < 110000) {
color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
} else {
color = [[NSColor textColor] colorUsingColorSpace:sRGB];
}
+ } else if (entry->index == pressedButtonTextIndex) {
+ if (OSVersion < 120000) {
+ color = [[NSColor whiteColor] colorUsingColorSpace:sRGB];
+ } else {
+ color = [[NSColor blackColor] colorUsingColorSpace:sRGB];
+ }
} else {
color = [[NSColor valueForKey:entry->selector] colorUsingColorSpace:sRGB];
}