8000 gh-92603: add upstream fix to macOS installer · python/cpython@0b0a8a1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0b0a8a1

Browse files
committed
gh-92603: add upstream fix to macOS installer
1 parent add8d45 commit 0b0a8a1

File tree

3 files changed

+86
-1
lines changed

3 files changed

+86
-1
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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];

Mac/BuildScript/build-installer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def library_recipes():
268268
tcl_checksum='43a1fae7412f61ff11de2cfd05d28cfc3a73762f354a417c62370a54e2caf066'
269269

270270
tk_checksum='2e65fa069a23365440a3c56c556b8673b5e32a283800d8d9b257e3f584ce0675'
271-
tk_patches = [ ]
271+
tk_patches = ['backport_gh92603_fix.patch']
272272

273273

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

0 commit comments

Comments
 (0)
0