Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-92603: add upstream fix to macOS installer #108693

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions Mac/BuildScript/backport_gh92603_fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
Accepted upstream for release in Tk 8.6.14:
https://core.tcl-lang.org/tk/info/cf3830280b

--- tk8.6.13/macosx/tkMacOSXWindowEvent.c.orig
+++ tk8.6.13-patched/macosx/tkMacOSXWindowEvent.c
@@ -239,8 +239,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
if (winPtr) {
TKContentView *view = [window contentView];

-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
- if (@available(macOS 10.15, *)) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ if (@available(macOS 10.14, *)) {
[view viewDidChangeEffectiveAppearance];
}
#endif
@@ -1237,29 +1237,8 @@ static const char *const accentNames[] = {
} 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";
- preferences = [[NSUserDefaults standardUserDefaults] retain];
-
- /*
- * AppKit calls this method when the user changes the Accent Color
- * but not when the user changes the Highlight Color. So we register
- * to receive KVO notifications for Highlight Color as well.
- */
-
- [preferences addObserver:self
- forKeyPath:@"AppleHighlightColor"
- options:NSKeyValueObservingOptionNew
- context:NULL];
}
NSString *accent = [preferences stringForKey:@"AppleAccentColor"];
NSArray *words = [[preferences stringForKey:@"AppleHighlightColor"]
--- tk8.6.13/macosx/tkMacOSXWm.c.orig
+++ tk8.6.13-patched/macosx/tkMacOSXWm.c
@@ -1289,6 +1289,11 @@ TkWmDeadWindow(
[NSApp _setMainWindow:nil];
}
[deadNSWindow close];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
+ [preferences removeObserver:deadNSWindow.contentView
+ forKeyPath:@"AppleHighlightColor"];
+#endif
[deadNSWindow release];

#if DEBUG_ZOMBIES > 1
@@ -6763,6 +6768,21 @@ TkMacOSXMakeRealWindowExist(
}
TKContentView *contentView = [[TKContentView alloc]
initWithFrame:NSZeroRect];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
+ NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
+
+ /*
+ * AppKit calls the viewDidChangeEffectiveAppearance method when the
+ * user changes the Accent Color but not when the user changes the
+ * Highlight Color. So we register to receive KVO notifications for
+ * Highlight Color as well.
+ */
+
+ [preferences addObserver:contentView
+ forKeyPath:@"AppleHighlightColor"
+ options:NSKeyValueObservingOptionNew
+ context:NULL];
+#endif
[window setContentView:contentView];
[contentView release];
[window setDelegate:NSApp];
2 changes: 1 addition & 1 deletion Mac/BuildScript/build-installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def library_recipes():
tcl_checksum='43a1fae7412f61ff11de2cfd05d28cfc3a73762f354a417c62370a54e2caf066'

tk_checksum='2e65fa069a23365440a3c56c556b8673b5e32a283800d8d9b257e3f584ce0675'
tk_patches = [ ]
tk_patches = ['backport_gh92603_fix.patch']


base_url = "https://prdownloads.sourceforge.net/tcl/{what}{version}-src.tar.gz"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Update macOS installer to include a fix accepted by upstream Tcl/Tk
for a crash encountered after the first :meth:`tkinter.Tk` instance
is destroyed.
Loading