diff options
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXColor.c | 57 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 16 |
2 files changed, 46 insertions, 27 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index e89d42d..8372ccc 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -207,13 +207,14 @@ static const struct SystemColorMapEntry systemColorMap[] = { { "LabelColor", semantic, 2 }, /* 176 */ { "ControlTextColor", semantic, 3 }, /* 177 */ { "DisabledControlTextColor", semantic, 4 }, /* 178 */ - { "TextBackgroundColor", semantic, 5 }, /* 179 */ - { "SelectedTextBackgroundColor", semantic, 6 }, /* 180 */ - { "ControlAccentColor", semantic, 7 }, /* 181 */ + { "SelectedTabTextColor", semantic, 5 }, /* 179 */ + { "TextBackgroundColor", semantic, 6 }, /* 180 */ + { "SelectedTextBackgroundColor", semantic, 7 }, /* 181 */ + { "ControlAccentColor", semantic, 8 }, /* 182 */ { NULL, 0, 0 } }; #define FIRST_SEMANTIC_COLOR 166 -#define MAX_PIXELCODE 181 +#define MAX_PIXELCODE 182 /* *---------------------------------------------------------------------- @@ -349,31 +350,47 @@ SetCGColorComponents( deviceRGB]; break; case 5: + if ([NSApp macMinorVersion] > 6) { + color = [[NSColor whiteColor] colorUsingColorSpace: + deviceRGB]; + } else { + color = [[NSColor blackColor] colorUsingColorSpace: + deviceRGB]; + } + break; + case 6: color = [[NSColor textBackgroundColor] colorUsingColorSpace: deviceRGB]; break; - case 6: + case 7: color = [[NSColor selectedTextBackgroundColor] colorUsingColorSpace: deviceRGB]; break; - case 7: -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 + case 8: if ([NSApp macMinorVersion] >= 14) { - color = [[NSColor controlAccentColor] colorUsingColorSpace: - deviceRGB]; - break; - } +#if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 + if (@available(macOS 10.14, *)) { + color = [[NSColor controlAccentColor] colorUsingColorSpace: + deviceRGB]; + break; + } else { + color = [NSColor colorWithColorSpace: deviceRGB + components: blueAccentRGBA + count: 4]; + } #endif - colorVariant = [[NSUserDefaults standardUserDefaults] - integerForKey:@"AppleAquaColorVariant"]; - if (colorVariant == 6) { - color = [NSColor colorWithColorSpace: deviceRGB - components: graphiteAccentRGBA - count: 4]; } else { - color = [NSColor colorWithColorSpace: deviceRGB - components: blueAccentRGBA - count: 4]; + colorVariant = [[NSUserDefaults standardUserDefaults] + integerForKey:@"AppleAquaColorVariant"]; + if (colorVariant == 6) { + color = [NSColor colorWithColorSpace: deviceRGB + components: graphiteAccentRGBA + count: 4]; + } else { + color = [NSColor colorWithColorSpace: deviceRGB + components: blueAccentRGBA + count: 4]; + } } break; default: diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 18bbf21..8c30fe7 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -5927,11 +5927,12 @@ WmWinAppearance( } else if (appearance == NSAppearanceNameAqua) { resultString = appearanceStrings[APPEARANCE_AQUA]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - } else if (@available(macOS 10.14, *) && - appearance == NSAppearanceNameDarkAqua) { - resultString = appearanceStrings[APPEARANCE_DARKAQUA]; -#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 + } else if (@available(macOS 10.14, *)) { + if (appearance == NSAppearanceNameDarkAqua) { + resultString = appearanceStrings[APPEARANCE_DARKAQUA]; + } } +#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 result = Tcl_NewStringObj(resultString, strlen(resultString)); } if (result == NULL) { @@ -5943,27 +5944,28 @@ WmWinAppearance( sizeof(char *), "appearancename", 0, &index) != TCL_OK) { return TCL_ERROR; } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 switch ((enum appearances) index) { case APPEARANCE_AQUA: win.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua]; break; case APPEARANCE_DARKAQUA: +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { win.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua]; } +#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 break; default: win.appearance = nil; } -#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 } Tcl_SetObjResult(interp, result); return TCL_OK; -#endif // MAC_OS_X_VERSION_MAX_ALLOWED > 1090 +#else // MAC_OS_X_VERSION_MAX_ALLOWED > 1090 return TCL_ERROR; +#endif } /* |