diff options
author | marc_culler <marc.culler@gmail.com> | 2020-09-07 19:57:03 (GMT) |
---|---|---|
committer | marc_culler <marc.culler@gmail.com> | 2020-09-07 19:57:03 (GMT) |
commit | 79152064c9c4eec29aea266f35af0b6b8cca7213 (patch) | |
tree | 5da732c3b92cdc206cf7243ca41322600ec8f974 /macosx | |
parent | c504b8fc55ded70a21166e2d2c8ee960c4cef962 (diff) | |
download | tk-79152064c9c4eec29aea266f35af0b6b8cca7213.zip tk-79152064c9c4eec29aea266f35af0b6b8cca7213.tar.gz tk-79152064c9c4eec29aea266f35af0b6b8cca7213.tar.bz2 |
Remove virtual events for changes to the accent color in Mojave, because Apple had not completely fixed the bugs with KVOs for NSUserDefaults.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 3d9120f..7977e0f 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -211,8 +211,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; TkWindow *winPtr = TkMacOSXGetTkWindow(window); if (winPtr) { TKContentView *view = [window contentView]; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 - if (@available(macOS 10.14, *)) { +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 + if (@available(macOS 10.15, *)) { [view viewDidChangeEffectiveAppearance]; } #endif @@ -1122,6 +1122,20 @@ static const char *const accentNames[] = { objectAtIndex:3]; static const char *defaultColor = NULL; + if (effectiveAppearanceName == NSAppearanceNameAqua) { + TkSendVirtualEvent(tkwin, "LightAqua", NULL); + } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { + TkSendVirtualEvent(tkwin, "DarkAqua", NULL); + } + if ([NSApp macOSVersion] < 101500) { + + /* + * Mojave cannot handle the KVO shenanigans that we need for the + * highlight and accent color notifications. + */ + + return; + } if (!defaultColor) { defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; @@ -1144,11 +1158,6 @@ static const char *const accentNames[] = { effectiveAppearanceName.UTF8String, accentName, highlightName); TkSendVirtualEvent(tkwin, "AppearanceChanged", Tcl_NewStringObj(data, -1)); - if (effectiveAppearanceName == NSAppearanceNameAqua) { - TkSendVirtualEvent(tkwin, "LightAqua", NULL); - } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { - TkSendVirtualEvent(tkwin, "DarkAqua", NULL); - } } - (void)observeValueForKeyPath:(NSString *)keyPath |