From bf647de1f00390816cf463d421e2d6b27ea1b428 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 23 Aug 2001 00:23:30 +0000 Subject: [PATCH] rollup popups when a toplevel window hides. makes popups go away about the same time in destruction sequences as on win32. r=pchen/sr=sfraser/a=asa. bug 89373. git-svn-id: svn://10.0.0.236/trunk@101674 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/mac/nsMacWindow.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mozilla/widget/src/mac/nsMacWindow.cpp b/mozilla/widget/src/mac/nsMacWindow.cpp index 66c1196a0cf..56652e0c0a7 100644 --- a/mozilla/widget/src/mac/nsMacWindow.cpp +++ b/mozilla/widget/src/mac/nsMacWindow.cpp @@ -38,6 +38,7 @@ #include "DefProcFakery.h" #include "nsMacResources.h" #include "nsRegionMac.h" +#include "nsIRollupListener.h" #if TARGET_CARBON #include #include @@ -65,6 +66,9 @@ static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1" #define botRight(r) (((Point *) &(r))[1]) #endif +// externs defined in nsWindow.cpp +extern nsIRollupListener * gRollupListener; +extern nsIWidget * gRollupWidget; #if !TARGET_CARBON pascal long BorderlessWDEF ( short inCode, WindowPtr inWindow, short inMessage, long inParam ) ; @@ -803,9 +807,20 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool bState) } ComeToFront(); } - else + else { + // when a toplevel window goes away, make sure we rollup any popups that may + // be lurking. We want to catch this here because we're guaranteed that + // we hide a window before we destroy it, and doing it here more closely + // approximates where we do the same thing on windows. + if ( mWindowType == eWindowType_toplevel ) { + if ( gRollupListener ) + gRollupListener->Rollup(); + NS_IF_RELEASE(gRollupListener); + NS_IF_RELEASE(gRollupWidget); + } ::HideWindow(mWindowPtr); - + } + return NS_OK; }