re-enable parent window of modal dialog before dialog is destroyed. part of bug 28467. r=saari a=jar

This commit is contained in:
danm%netscape.com 2000-02-25 03:11:21 +00:00
Родитель 1b042a8bbd
Коммит bc6c995564
2 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -877,11 +877,11 @@ NS_IMETHODIMP nsXULWindow::ShowModal()
appShell->Spinup();
// Store locally so it doesn't die on us
nsCOMPtr<nsIWidget> window = mWindow;
nsCOMPtr<nsIXULWindow> tempRef = this;
nsCOMPtr<nsIXULWindow> tempRef = this;
window->SetModal(PR_TRUE);
mContinueModalLoop = PR_TRUE;
EnableParent(PR_FALSE);
nsCOMPtr<nsIJSContextStack> stack(do_GetService("nsThreadJSContextStack"));
nsresult rv = NS_OK;
@ -918,6 +918,8 @@ NS_IMETHODIMP nsXULWindow::ShowModal()
NS_IMETHODIMP nsXULWindow::ExitModalLoop()
{
if (mContinueModalLoop) // was a modal window
EnableParent(PR_TRUE);
mContinueModalLoop = PR_FALSE;
return NS_OK;
}
@ -1072,6 +1074,18 @@ NS_IMETHODIMP nsXULWindow::NotifyObservers(const PRUnichar* aTopic,
return NS_OK;
}
void nsXULWindow::EnableParent(PRBool aEnable)
{
nsCOMPtr<nsIBaseWindow> parentWindow;
nsCOMPtr<nsIWidget> parentWidget;
parentWindow = do_QueryReferent(mParentWindow);
if (parentWindow)
parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
if (parentWidget)
parentWidget->Enable(aEnable);
}
//*****************************************************************************
// nsXULWindow: Accessors
//*****************************************************************************

Просмотреть файл

@ -31,6 +31,7 @@
#include "nsCOMPtr.h"
#include "nsVoidArray.h"
#include "nsString.h"
#include "nsWeakReference.h"
// Interfaces needed
#include "nsIBaseWindow.h"
@ -44,7 +45,8 @@
// nsXULWindow
class nsXULWindow : public nsIXULWindow, public nsIBaseWindow,
public nsIInterfaceRequestor
public nsIInterfaceRequestor,
public nsSupportsWeakReference
{
friend class nsChromeTreeOwner;
friend class nsContentTreeOwner;
@ -86,11 +88,14 @@ protected:
NS_IMETHOD NotifyObservers(const PRUnichar* aTopic, const PRUnichar* aData);
protected:
void EnableParent(PRBool aEnable);
nsChromeTreeOwner* mChromeTreeOwner;
nsContentTreeOwner* mContentTreeOwner;
nsContentTreeOwner* mPrimaryContentTreeOwner;
nsCOMPtr<nsIWidget> mWindow;
nsCOMPtr<nsIDocShell> mDocShell;
nsCOMPtr<nsIWeakReference> mParentWindow;
nsVoidArray mContentShells;
PRBool mContinueModalLoop;
PRBool mDebuting; // being made visible right now