Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-110950: add upstream Tk fixes to macOS installer.#111041
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
2cae8a5 gh-110950: add upstream fix to macOS installer
chrstphrchvz37ecff3 Update backport_gh110950_fix.patch
chrstphrchvz745ebbe Add missing newline at end of NEWS
chrstphrchvzb220624 Merge branch 'main' into patch-gh110950
ned-deily36cee17 Include Tk patches from gh-71383 and gh-92603
ned-deily5c93794 Merge branch 'main' into patch-gh110950
ned-deilyFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| From https://core.tcl-lang.org/tk/info/ed7cfbac8db11aa0 | ||
| Note: the diff here is hand-tweaked so that it applies cleanly to both Tk 8.6.8 and 8.6.13. | ||
| diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c | ||
| index 71d7c3385..e6a68356c 100644 | ||
| --- a/macosx/tkMacOSXInit.c | ||
| +++ b/macosx/tkMacOSXInit.c | ||
| @@ -128,6 +128,16 @@ static intTkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, | ||
| observe(NSApplicationDidChangeScreenParametersNotification, displayChanged:); | ||
| observe(NSTextInputContextKeyboardSelectionDidChangeNotification, keyboardChanged:); | ||
| #undef observe | ||
| +} | ||
| + | ||
| + | ||
| +/* | ||
| + * Fix for 10b38a7a7c. | ||
| + */ | ||
| + | ||
| +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app | ||
| +{ | ||
| + return YES; | ||
| } | ||
| -(void)applicationWillFinishLaunching:(NSNotification *)aNotification |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| Adapted from https://core.tcl-lang.org/tk/info/b1876b9ebc4b | ||
| Index: generic/tkInt.h | ||
| ================================================================== | ||
| --- a/generic/tkInt.h.orig | ||
| +++ b/generic/tkInt.h | ||
| @@ -1094,10 +1094,11 @@ | ||
| /* | ||
| * Themed widget set init function: | ||
| */ | ||
| MODULE_SCOPE intTtk_Init(Tcl_Interp *interp); | ||
| +MODULE_SCOPE voidTtk_TkDestroyedHandler(Tcl_Interp *interp); | ||
| /* | ||
| * Internal functions shared among Tk modules but not exported to the outside | ||
| * world: | ||
| */ | ||
| Index: generic/tkWindow.c | ||
| ================================================================== | ||
| --- a/generic/tkWindow.c.orig | ||
| +++ b/generic/tkWindow.c | ||
| @@ -1619,10 +1619,11 @@ | ||
| TkBindFree(winPtr->mainPtr); | ||
| TkDeleteAllImages(winPtr->mainPtr); | ||
| TkFontPkgFree(winPtr->mainPtr); | ||
| TkFocusFree(winPtr->mainPtr); | ||
| TkStylePkgFree(winPtr->mainPtr); | ||
| + Ttk_TkDestroyedHandler(winPtr->mainPtr->interp); | ||
| /* | ||
| * When embedding Tk into other applications, make sure that all | ||
| * destroy events reach the server. Otherwise the embedding | ||
| * application may also attempt to destroy the windows, resulting | ||
| Index: generic/ttk/ttkTheme.c | ||
| ================================================================== | ||
| --- a/generic/ttk/ttkTheme.c.orig | ||
| +++ b/generic/ttk/ttkTheme.c | ||
| @@ -415,17 +415,10 @@ | ||
| StylePackageData *pkgPtr = (StylePackageData *)clientData; | ||
| Tcl_HashSearch search; | ||
| Tcl_HashEntry *entryPtr; | ||
| Cleanup *cleanup; | ||
| - /* | ||
| - * Cancel any pending ThemeChanged calls: | ||
| - */ | ||
| - if (pkgPtr->themeChangePending) { | ||
| -Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr); | ||
| - } | ||
| - | ||
| /* | ||
| * Free themes. | ||
| */ | ||
| entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); | ||
| while (entryPtr != NULL) { | ||
| @@ -528,10 +521,29 @@ | ||
| if (!pkgPtr->themeChangePending) { | ||
| Tcl_DoWhenIdle(ThemeChangedProc, pkgPtr); | ||
| pkgPtr->themeChangePending = 1; | ||
| } | ||
| } | ||
| + | ||
| +/* Ttk_TkDestroyedHandler -- | ||
| + *See bug [310c74ecf440]: idle calls to ThemeChangedProc() | ||
| + *need to be canceled when Tk is destroyed, since the interp | ||
| + *may still be active afterward; canceling them from | ||
| + *Ttk_StylePkgFree() would be too late. | ||
| + */ | ||
| +void Ttk_TkDestroyedHandler( | ||
| + Tcl_Interp* interp) | ||
| +{ | ||
| + StylePackageData* pkgPtr = GetStylePackageData(interp); | ||
| + | ||
| + /* | ||
| + * Cancel any pending ThemeChanged calls: | ||
| + */ | ||
| + if (pkgPtr->themeChangePending) { | ||
| +Tcl_CancelIdleCall(ThemeChangedProc, pkgPtr); | ||
| + } | ||
| +} | ||
| /* | ||
| * Ttk_CreateTheme -- | ||
| *Create a new theme and register it in the global theme table. | ||
| * | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletionsMisc/NEWS.d/next/macOS/2023-08-30-16-33-57.gh-issue-92603.ATkKVO.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| 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. |
2 changes: 2 additions & 0 deletionsMisc/NEWS.d/next/macOS/2023-09-02-08-49-57.gh-issue-71383.Ttkchg.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Update macOS installer to include an upstream Tcl/Tk fix | ||
| for the ``ttk::ThemeChanged`` error encountered in Tkinter. |
3 changes: 3 additions & 0 deletionsMisc/NEWS.d/next/macOS/2023-10-18-17-26-36.gh-issue-110950.sonoma.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Update macOS installer to include an upstream Tcl/Tk fix for the | ||
| ``Secure coding is not enabled for restorable state!`` warning | ||
| encountered in Tkinter on macOS 14 Sonoma. |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.