|
| 1 | +Accepted upstream for release in Tk 8.6.14: |
| 2 | +https://core.tcl-lang.org/tk/info/cf3830280b |
| 3 | + |
| 4 | +--- tk8.6.13/macosx/tkMacOSXWindowEvent.c.orig |
| 5 | ++++ tk8.6.13-patched/macosx/tkMacOSXWindowEvent.c |
| 6 | +@@ -239,8 +239,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; |
| 7 | + if (winPtr) { |
| 8 | + TKContentView *view = [window contentView]; |
| 9 | + |
| 10 | +-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 |
| 11 | +- if (@available(macOS 10.15, *)) { |
| 12 | ++#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 |
| 13 | ++ if (@available(macOS 10.14, *)) { |
| 14 | + [view viewDidChangeEffectiveAppearance]; |
| 15 | + } |
| 16 | + #endif |
| 17 | +@@ -1237,29 +1237,8 @@ static const char *const accentNames[] = { |
| 18 | + } else if (effectiveAppearanceName == NSAppearanceNameDarkAqua) { |
| 19 | + TkSendVirtualEvent(tkwin, "DarkAqua", NULL); |
| 20 | + } |
| 21 | +- if ([NSApp macOSVersion] < 101500) { |
| 22 | +- |
| 23 | +- /* |
| 24 | +- * Mojave cannot handle the KVO shenanigans that we need for the |
| 25 | +- * highlight and accent color notifications. |
| 26 | +- */ |
| 27 | +- |
| 28 | +- return; |
| 29 | +- } |
| 30 | + if (!defaultColor) { |
| 31 | + defaultColor = [NSApp macOSVersion] < 110000 ? "Blue" : "Multicolor"; |
| 32 | +- preferences = [[NSUserDefaults standardUserDefaults] retain]; |
| 33 | +- |
| 34 | +- /* |
| 35 | +- * AppKit calls this method when the user changes the Accent Color |
| 36 | +- * but not when the user changes the Highlight Color. So we register |
| 37 | +- * to receive KVO notifications for Highlight Color as well. |
| 38 | +- */ |
| 39 | +- |
| 40 | +- [preferences addObserver:self |
| 41 | +- forKeyPath:@"AppleHighlightColor" |
| 42 | +- options:NSKeyValueObservingOptionNew |
| 43 | +- context:NULL]; |
| 44 | + } |
| 45 | + NSString *accent = [preferences stringForKey:@"AppleAccentColor"]; |
| 46 | + NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"] |
| 47 | +--- tk8.6.13/macosx/tkMacOSXWm.c.orig |
| 48 | ++++ tk8.6.13-patched/macosx/tkMacOSXWm.c |
| 49 | +@@ -1289,6 +1289,11 @@ TkWmDeadWindow( |
| 50 | + [NSApp _setMainWindow:nil]; |
| 51 | + } |
| 52 | + [deadNSWindow close]; |
| 53 | ++#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 |
| 54 | ++ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; |
| 55 | ++ [preferences removeObserver:deadNSWindow.contentView |
| 56 | ++ forKeyPath:@"AppleHighlightColor"]; |
| 57 | ++#endif |
| 58 | + [deadNSWindow release]; |
| 59 | + |
| 60 | + #if DEBUG_ZOMBIES > 1 |
| 61 | +@@ -6763,6 +6768,21 @@ TkMacOSXMakeRealWindowExist( |
| 62 | + } |
| 63 | + TKContentView *contentView = [[TKContentView alloc] |
| 64 | + initWithFrame:NSZeroRect]; |
| 65 | ++#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 |
| 66 | ++ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; |
| 67 | ++ |
| 68 | ++ /* |
| 69 | ++ * AppKit calls the viewDidChangeEffectiveAppearance method when the |
| 70 | ++ * user changes the Accent Color but not when the user changes the |
| 71 | ++ * Highlight Color. So we register to receive KVO notifications for |
| 72 | ++ * Highlight Color as well. |
| 73 | ++ */ |
| 74 | ++ |
| 75 | ++ [preferences addObserver:contentView |
| 76 | ++ forKeyPath:@"AppleHighlightColor" |
| 77 | ++ options:NSKeyValueObservingOptionNew |
| 78 | ++ context:NULL]; |
8000
| 79 | ++#endif |
| 80 | + [window setContentView:contentView]; |
| 81 | + [contentView release]; |
| 82 | + [window setDelegate:NSApp]; |
0 commit comments