summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWindowEvent.c
diff options
context:
space:
mode:
authorculler <culler>2020-05-12 12:25:40 (GMT)
committerculler <culler>2020-05-12 12:25:40 (GMT)
commit81efacd24cdb3ae469b8dd7a6d9b8524ead62dc7 (patch)
tree9af43e69d4c07f6d434dd7afe9a0e50de41a2702 /macosx/tkMacOSXWindowEvent.c
parentedeeece7a1d441c68a4fd5669a7fc0de31fc213d (diff)
downloadtk-81efacd24cdb3ae469b8dd7a6d9b8524ead62dc7.zip
tk-81efacd24cdb3ae469b8dd7a6d9b8524ead62dc7.tar.gz
tk-81efacd24cdb3ae469b8dd7a6d9b8524ead62dc7.tar.bz2
Better way to handle closed key windows on deactivation.
Diffstat (limited to 'macosx/tkMacOSXWindowEvent.c')
-rw-r--r--macosx/tkMacOSXWindowEvent.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 8864eab..cb4ffd1 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -317,12 +317,14 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
#endif
/*
- * To prevent zombie windows on systems with a TouchBar we set
- * our key window to nil if it does not belong to a Tk window.
+ * To prevent zombie windows on systems with a TouchBar, set the key window
+ * to nil if the current key window is not visible. This allows a closed
+ * Help or About window to be deallocated so it will not reappear as a
+ * zombie when the app is reactivated.
*/
- TkWindow *winPtr = TkMacOSXGetTkWindow([NSApp keyWindow]);
- if (!winPtr) {
+ NSWindow *keywindow = [NSApp keyWindow];
+ if (keywindow && ![keywindow isVisible]) {
[NSApp _setKeyWindow:nil];
[NSApp _setMainWindow:nil];
}