From cf419872caf5c9833949e81e378a741ccbe02d45 Mon Sep 17 00:00:00 2001 From: "danm-moz%comcast.net" Date: Fri, 7 Nov 2003 02:13:32 +0000 Subject: [PATCH] don't focus the parent of the window being closed if that parent is the hidden window. this reinstates rev 1.52, bug 22658. now bug 224058. r=ere, roc --- xpfe/appshell/src/nsXULWindow.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 7d3e1e612de..8d9e9cab8d5 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -466,10 +466,21 @@ NS_IMETHODIMP nsXULWindow::Destroy() // We need to explicitly set the focus on Windows nsCOMPtr parent(do_QueryReferent(mParentWindow)); if (parent) { - nsCOMPtr parentWidget; - parent->GetMainWidget(getter_AddRefs(parentWidget)); - if (parentWidget) - parentWidget->PlaceBehind(eZPlacementTop, 0, PR_TRUE); + nsCOMPtr baseHiddenWindow; + if (appShell) { + nsCOMPtr hiddenWindow; + appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow)); + if (hiddenWindow) + baseHiddenWindow = do_GetInterface(hiddenWindow); + } + // somebody screwed up somewhere. hiddenwindow shouldn't be anybody's + // parent. still, when it happens, skip activating it. + if (baseHiddenWindow != parent) { + nsCOMPtr parentWidget; + parent->GetMainWidget(getter_AddRefs(parentWidget)); + if (parentWidget) + parentWidget->PlaceBehind(eZPlacementTop, 0, PR_TRUE); + } } #endif