Separate the event loop in the client from the nglayout/widget provided code. Now creates a message pump (client side) and a message sink (nglayout side) for event handling.

git-svn-id: svn://10.0.0.236/trunk@14526 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pinkerton%netscape.com
1998-11-12 21:24:16 +00:00
parent f073c1311e
commit 21d40ad4ca
2 changed files with 20 additions and 18 deletions

View File

@@ -18,11 +18,13 @@
#include "nsAppShell.h"
#include "nsIAppShell.h"
#include "nsWindow.h"
#include <stdlib.h>
#include "nsMacMessagePump.h"
//XtAppContext gAppContext;
#include "nsMacMessageSink.h" //¥¥¥ until this is moved into XP
#include "nsMacMessagePump.h"
#include "nsToolKit.h"
#include <stdlib.h>
//-------------------------------------------------------------------------
//
@@ -46,7 +48,7 @@ NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListe
NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv)
{
mToolKit = new nsToolkit();
mToolKit = auto_ptr<nsToolkit>( new nsToolkit() );
return NS_OK;
}
@@ -57,12 +59,10 @@ NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv)
//-------------------------------------------------------------------------
nsresult nsAppShell::Run()
{
mMacPump = new nsMacMessagePump(mToolKit);
mMacSink = new nsMacMessageSink();
mMacPump = auto_ptr<nsMacMessagePump>( new nsMacMessagePump(mToolKit.get(), mMacSink) );
mMacPump->DoMessagePump();
delete mMacPump;
mMacPump = nsnull;
//if (mDispatchListener)
//mDispatchListener->AfterDispatch();
@@ -83,7 +83,7 @@ nsresult nsAppShell::Run()
//-------------------------------------------------------------------------
NS_IMETHODIMP nsAppShell::Exit()
{
if (mMacPump)
if (mMacPump.get())
{
mMacPump->StopRunning();
@@ -104,8 +104,6 @@ NS_IMETHODIMP nsAppShell::Exit()
nsAppShell::nsAppShell()
{
mRefCnt = 0;
mDispatchListener = 0;
mMacPump = nsnull;
mExitCalled = PR_FALSE;
}