From 21d40ad4ca2897e8a8e77c67cd5f3d2e02d37c41 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Thu, 12 Nov 1998 21:24:16 +0000 Subject: [PATCH] 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 --- mozilla/widget/src/mac/nsAppShell.cpp | 22 ++++++++++------------ mozilla/widget/src/mac/nsAppShell.h | 16 ++++++++++------ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/mozilla/widget/src/mac/nsAppShell.cpp b/mozilla/widget/src/mac/nsAppShell.cpp index 16b7515832d..cb57750227a 100644 --- a/mozilla/widget/src/mac/nsAppShell.cpp +++ b/mozilla/widget/src/mac/nsAppShell.cpp @@ -18,11 +18,13 @@ #include "nsAppShell.h" #include "nsIAppShell.h" -#include "nsWindow.h" -#include -#include "nsMacMessagePump.h" -//XtAppContext gAppContext; +#include "nsMacMessageSink.h" //еее until this is moved into XP +#include "nsMacMessagePump.h" +#include "nsToolKit.h" + +#include + //------------------------------------------------------------------------- // @@ -46,7 +48,7 @@ NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListe NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv) { - mToolKit = new nsToolkit(); + mToolKit = auto_ptr( 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( 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; } diff --git a/mozilla/widget/src/mac/nsAppShell.h b/mozilla/widget/src/mac/nsAppShell.h index 2525465619e..4e0d6ed4aaf 100644 --- a/mozilla/widget/src/mac/nsAppShell.h +++ b/mozilla/widget/src/mac/nsAppShell.h @@ -20,8 +20,6 @@ #define nsAppShell_h__ #include "nsIAppShell.h" -#include "nsMacMessagePump.h" -#include "nsToolKit.h" #include #include #include @@ -29,6 +27,11 @@ #include #include +#include + +class nsMacMessagePump; +class nsMacMessageSink; +class nsToolkit; /** * Native MAC Application shell wrapper @@ -37,10 +40,11 @@ class nsAppShell : public nsIAppShell { private: - nsDispatchListener *mDispatchListener; - nsToolkit *mToolKit; - nsMacMessagePump *mMacPump; - PRBool mExitCalled; + nsDispatchListener *mDispatchListener; + auto_ptr mToolKit; + auto_ptr mMacPump; + nsMacMessageSink *mMacSink; //еее this will be COM, so use scc's COM_auto_ptr + PRBool mExitCalled; // CLASS METHODS private: