From 3d2e242f10eb499e845c3b3227040514748cc0de Mon Sep 17 00:00:00 2001 From: culler Date: Sat, 23 Feb 2019 05:44:41 +0000 Subject: Fix bug [9771ae0f0b]: In Aqua, deiconifying a transient of a withdrawn window can create a zombie --- macosx/tkMacOSXWm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index ab5cd8d..67d6ecb 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6871,7 +6871,6 @@ ApplyMasterOverrideChanges( TkDisplay *dispPtr = TkGetDisplayList(); TkWindow *masterWinPtr = (TkWindow *) Tk_IdToWindow(dispPtr->display, wmPtr->master); - if (masterWinPtr && masterWinPtr->window != None && TkMacOSXHostToplevelExists(masterWinPtr)) { NSWindow *masterMacWin = @@ -6882,8 +6881,20 @@ ApplyMasterOverrideChanges( if (parentWindow) { [parentWindow removeChildWindow:macWindow]; } - [masterMacWin addChildWindow:macWindow - ordered:NSWindowAbove]; + + /* + * A child NSWindow retains its relative position with + * respect to the parent when the parent is moved. This is + * pointless if the parent is offscreen, and adding a child + * to an offscreen window causes the parent to be displayed + * as a zombie. So we should only do this if the parent is + * visible. + */ + + if ([masterMacWin isVisible]) { + [masterMacWin addChildWindow:macWindow + ordered:NSWindowAbove]; + } if (wmPtr->flags & WM_TOPMOST) { [macWindow setLevel:kCGUtilityWindowLevel]; } -- cgit v0.12