From c4ec5e4d7ef306781f10ea05fa4c94a509cab623 Mon Sep 17 00:00:00 2001 From: "danm%netscape.com" Date: Mon, 18 Oct 1999 15:08:45 +0000 Subject: [PATCH] moving Push/PopThreadEventQueue to nsIEventQueueService. r:hyatt@netscape.com git-svn-id: svn://10.0.0.236/trunk@50991 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/public/nsIAppShell.idl | 10 -- mozilla/widget/src/beos/nsAppShell.cpp | 40 ------ mozilla/widget/src/beos/nsAppShell.h | 2 - mozilla/widget/src/gtk/nsAppShell.cpp | 157 ++++++++++++--------- mozilla/widget/src/gtk/nsAppShell.h | 22 +-- mozilla/widget/src/gtk/nsWidgetFactory.cpp | 2 +- mozilla/widget/src/mac/nsAppShell.cpp | 36 ----- mozilla/widget/src/mac/nsAppShell.h | 2 - mozilla/widget/src/motif/nsAppShell.cpp | 40 ------ mozilla/widget/src/motif/nsAppShell.h | 2 - mozilla/widget/src/os2/nsAppShell.cpp | 40 ------ mozilla/widget/src/os2/nsAppShell.h | 2 - mozilla/widget/src/qt/nsAppShell.cpp | 56 -------- mozilla/widget/src/qt/nsAppShell.h | 2 - mozilla/widget/src/windows/nsAppShell.cpp | 38 ----- mozilla/widget/src/windows/nsAppShell.h | 2 - mozilla/widget/src/xlib/nsAppShell.cpp | 39 ----- mozilla/widget/src/xlib/nsAppShell.h | 2 - 18 files changed, 102 insertions(+), 392 deletions(-) diff --git a/mozilla/widget/public/nsIAppShell.idl b/mozilla/widget/public/nsIAppShell.idl index e390e76311d..d2e00ee4eb3 100644 --- a/mozilla/widget/public/nsIAppShell.idl +++ b/mozilla/widget/public/nsIAppShell.idl @@ -81,16 +81,6 @@ interface nsIAppShell : nsISupports void Spindown(); - /** - * Push event queue onto current thread and begin processing events from it - */ - void PushThreadEventQueue(); - - /** - * Pop event queue from current thread's stack - */ - void PopThreadEventQueue(); - /** * After event dispatch execute app specific code */ diff --git a/mozilla/widget/src/beos/nsAppShell.cpp b/mozilla/widget/src/beos/nsAppShell.cpp index 2c463088ecc..0b7a3e60297 100644 --- a/mozilla/widget/src/beos/nsAppShell.cpp +++ b/mozilla/widget/src/beos/nsAppShell.cpp @@ -271,46 +271,6 @@ NS_METHOD nsAppShell::Spindown() return NS_OK; } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// note this is the Windows implementation and may suffice, but -// this is untested on beos. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PushThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// note this is the Windows implementation and may suffice, but -// this is untested on beos. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PopThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) { printf("nsAppShell::GetNativeEvent - FIXME: not implemented\n"); diff --git a/mozilla/widget/src/beos/nsAppShell.h b/mozilla/widget/src/beos/nsAppShell.h index c904677db6d..5ab76d6c8e4 100644 --- a/mozilla/widget/src/beos/nsAppShell.h +++ b/mozilla/widget/src/beos/nsAppShell.h @@ -41,8 +41,6 @@ class nsAppShell : public nsIAppShell virtual nsresult Run(); NS_IMETHOD Spinup(); NS_IMETHOD Spindown(); - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, diff --git a/mozilla/widget/src/gtk/nsAppShell.cpp b/mozilla/widget/src/gtk/nsAppShell.cpp index d2d1c4f9ccd..5e1219dbe00 100644 --- a/mozilla/widget/src/gtk/nsAppShell.cpp +++ b/mozilla/widget/src/gtk/nsAppShell.cpp @@ -17,11 +17,13 @@ */ #include "prmon.h" +#include "nsCOMPtr.h" #include "nsAppShell.h" #include "nsIAppShell.h" #include "nsIServiceManager.h" #include "nsIEventQueueService.h" #include "nsICmdLineService.h" +#include "nsIObserverService.h" #include #ifdef MOZ_GLE @@ -40,6 +42,10 @@ static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID); static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); +// copied from nsEventQueue.cpp +static char *gEQActivatedNotification = "nsIEventQueueActivated"; +static char *gEQDestroyedNotification = "nsIEventQueueDestroyed"; + // a linked, ordered list of event queues and their tokens class EventQueueToken { public: @@ -59,7 +65,7 @@ class EventQueueTokenQueue { public: EventQueueTokenQueue(); virtual ~EventQueueTokenQueue(); - void PushToken(nsIEventQueue *aQueue, gint aToken); + nsresult PushToken(nsIEventQueue *aQueue, gint aToken); PRBool PopToken(nsIEventQueue *aQueue, gint *aToken); private: @@ -75,13 +81,15 @@ EventQueueTokenQueue::~EventQueueTokenQueue() { // and leak. it's an error, anyway } -void EventQueueTokenQueue::PushToken(nsIEventQueue *aQueue, gint aToken) { +nsresult EventQueueTokenQueue::PushToken(nsIEventQueue *aQueue, gint aToken) { EventQueueToken *newToken = new EventQueueToken(aQueue, aToken); NS_ASSERTION(newToken, "couldn't allocate token queue element"); - if (newToken) { - newToken->next = mHead; - mHead = newToken; - } + if (!newToken) + return NS_ERROR_OUT_OF_MEMORY; + + newToken->next = mHead; + mHead = newToken; + return NS_OK; } PRBool EventQueueTokenQueue::PopToken(nsIEventQueue *aQueue, gint *aToken) { @@ -118,11 +126,10 @@ nsAppShell::nsAppShell() { NS_INIT_REFCNT(); mDispatchListener = 0; - mLock = PR_NewLock(); mEventQueueTokens = new EventQueueTokenQueue(); // throw on error would really be civilized here - NS_ASSERTION(mLock, "couldn't obtain lock in appshell"); NS_ASSERTION(mEventQueueTokens, "couldn't allocate event queue token queue"); + RegisterObserver(PR_TRUE); } //------------------------------------------------------------------------- @@ -132,8 +139,8 @@ nsAppShell::nsAppShell() //------------------------------------------------------------------------- nsAppShell::~nsAppShell() { - PR_DestroyLock(mLock); delete mEventQueueTokens; + RegisterObserver(PR_FALSE); } //------------------------------------------------------------------------- @@ -142,7 +149,7 @@ nsAppShell::~nsAppShell() // //------------------------------------------------------------------------- -NS_IMPL_ISUPPORTS1(nsAppShell, nsIAppShell) +NS_IMPL_ISUPPORTS2(nsAppShell, nsIAppShell, nsIObserver) //------------------------------------------------------------------------- NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener) @@ -270,64 +277,6 @@ NS_IMETHODIMP nsAppShell::Spindown() return NS_OK; } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue -// -//------------------------------------------------------------------------- -NS_IMETHODIMP -nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - gint inputToken; - nsIEventQueue *eQueue; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) { - PR_Lock(mLock); - rv = eventQService->PushThreadEventQueue(); - if (NS_SUCCEEDED(rv)) { - eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &eQueue); - inputToken = gdk_input_add(eQueue->GetEventQueueSelectFD(), - GDK_INPUT_READ, - event_processor_callback, - eQueue); - mEventQueueTokens->PushToken(eQueue, inputToken); - } - PR_Unlock(mLock); - } else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue -// -//------------------------------------------------------------------------- -NS_IMETHODIMP -nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - nsIEventQueue *eQueue; - - NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) { - gint queueToken; - PR_Lock(mLock); - eventQService->GetThreadEventQueue(PR_GetCurrentThread(), &eQueue); - eventQService->PopThreadEventQueue(); - if (mEventQueueTokens->PopToken(eQueue, &queueToken)) - gdk_input_remove(queueToken); - PR_Unlock(mLock); - NS_IF_RELEASE(eQueue); - } else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - //------------------------------------------------------------------------- // // Run @@ -474,3 +423,75 @@ NS_IMETHODIMP nsAppShell::EventIsForModalWindow(PRBool aRealEvent, return NS_OK; } +//------------------------------------------------------------------------- +// nsIObserver interface +//------------------------------------------------------------------------- + +//------------------------------------------------------------------------- +// +// Observe +// +//------------------------------------------------------------------------- + +NS_IMETHODIMP nsAppShell::Observe(nsISupports *aSubject, + const PRUnichar *aTopic, + const PRUnichar *) +{ + // tell gdk to listen to the event queue or not. what happens + // if multiple appshells (horrors, but it happens) repeat the same + // instruction, one wonders. + + gint queueToken; + nsAutoString topic(aTopic); + + if (topic.Equals(gEQActivatedNotification)) { + nsCOMPtr eq(do_QueryInterface(aSubject)); + if (eq) { + queueToken = gdk_input_add(eq->GetEventQueueSelectFD(), + GDK_INPUT_READ, + event_processor_callback, + eq); + mEventQueueTokens->PushToken(eq, queueToken); + } + } else if (topic.Equals(gEQDestroyedNotification)) { + nsCOMPtr eq(do_QueryInterface(aSubject)); + if (eq) { + if (mEventQueueTokens->PopToken(eq, &queueToken)) + gdk_input_remove(queueToken); + } + } + return NS_OK; +} + +//------------------------------------------------------------------------- +// +// Observe +// +//------------------------------------------------------------------------- +void nsAppShell::RegisterObserver(PRBool aRegister) +{ + nsresult rv; + nsAutoString topicA(gEQActivatedNotification); + nsAutoString topicB(gEQDestroyedNotification); + + NS_WITH_SERVICE(nsIObserverService, os, NS_OBSERVERSERVICE_PROGID, &rv); + if (NS_SUCCEEDED(rv)) { +#if 0 + nsCOMPtr us(do_QueryInterface(this)); + if (us) { +#else + nsIObserver *us; + if (NS_SUCCEEDED(QueryInterface(nsIObserver::GetIID(), (void **) &us)) && us) { +#endif + if (aRegister) { + os->AddObserver(us, topicA.GetUnicode()); + os->AddObserver(us, topicB.GetUnicode()); + } else { + os->RemoveObserver(us, topicA.GetUnicode()); + os->RemoveObserver(us, topicB.GetUnicode()); + } + NS_RELEASE(us); + } + } +} + diff --git a/mozilla/widget/src/gtk/nsAppShell.h b/mozilla/widget/src/gtk/nsAppShell.h index 6f13adb864f..fffb6ea1dd7 100644 --- a/mozilla/widget/src/gtk/nsAppShell.h +++ b/mozilla/widget/src/gtk/nsAppShell.h @@ -20,17 +20,18 @@ #define nsAppShell_h__ #include "nsIAppShell.h" +#include "nsIObserver.h" #include /** * Native GTK+ Application shell wrapper */ -class nsIEventQueueService; +class nsIEventQueue; class EventQueueTokenQueue; -struct PRLock; -class nsAppShell : public nsIAppShell +class nsAppShell : public nsIAppShell, + public nsIObserver { public: nsAppShell(); @@ -38,23 +39,24 @@ public: NS_DECL_ISUPPORTS + NS_DECL_NSIOBSERVER + // nsIAppShellInterface - NS_IMETHOD Create(int* argc, char ** argv); - NS_IMETHOD Run(); + NS_IMETHOD Create(int* argc, char ** argv); + NS_IMETHOD Run(); NS_IMETHOD Spinup(); NS_IMETHOD Spindown(); - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget, PRBool *aForWindow); - NS_IMETHOD Exit(); - NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener); + NS_IMETHOD Exit(); + NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener); private: + void RegisterObserver(PRBool aRegister); + nsDispatchListener *mDispatchListener; - PRLock *mLock; EventQueueTokenQueue *mEventQueueTokens; }; diff --git a/mozilla/widget/src/gtk/nsWidgetFactory.cpp b/mozilla/widget/src/gtk/nsWidgetFactory.cpp index 2a941a5d977..29940644077 100644 --- a/mozilla/widget/src/gtk/nsWidgetFactory.cpp +++ b/mozilla/widget/src/gtk/nsWidgetFactory.cpp @@ -204,7 +204,7 @@ nsresult nsWidgetFactory::CreateInstance(nsISupports *aOuter, inst = (nsISupports*)(nsWidget *)new nsTextWidget(); } else if (mClassID.Equals(kCAppShell)) { - inst = (nsISupports*)new nsAppShell(); + inst = (nsISupports*)(nsIAppShell*)new nsAppShell(); } else if (mClassID.Equals(kCToolkit)) { inst = (nsISupports*)(nsWidget *)new nsToolkit(); diff --git a/mozilla/widget/src/mac/nsAppShell.cpp b/mozilla/widget/src/mac/nsAppShell.cpp index db8cde88bdb..d56d380a04e 100644 --- a/mozilla/widget/src/mac/nsAppShell.cpp +++ b/mozilla/widget/src/mac/nsAppShell.cpp @@ -178,42 +178,6 @@ nsAppShell::~nsAppShell() { } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PushThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PopThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) { diff --git a/mozilla/widget/src/mac/nsAppShell.h b/mozilla/widget/src/mac/nsAppShell.h index 3edc90e0d57..efdef112b49 100644 --- a/mozilla/widget/src/mac/nsAppShell.h +++ b/mozilla/widget/src/mac/nsAppShell.h @@ -51,8 +51,6 @@ class nsAppShell : public nsIAppShell NS_IMETHOD Run(); NS_IMETHOD Spinup(); NS_IMETHOD Spindown(); - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD Exit(); NS_IMETHOD SetDispatchListener(nsDispatchListener* aDispatchListener); diff --git a/mozilla/widget/src/motif/nsAppShell.cpp b/mozilla/widget/src/motif/nsAppShell.cpp index ef825ce617a..e5c635386fd 100644 --- a/mozilla/widget/src/motif/nsAppShell.cpp +++ b/mozilla/widget/src/motif/nsAppShell.cpp @@ -213,46 +213,6 @@ NS_METHOD nsAppShell::Spindown() return NS_OK; } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// note this is the Windows implementation and may suffice, but -// this is untested on motif. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PushThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// note this is the Windows implementation and may suffice, but -// this is untested on motif. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PopThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) { //XXX:Implement this. diff --git a/mozilla/widget/src/motif/nsAppShell.h b/mozilla/widget/src/motif/nsAppShell.h index 1ed7ad01e93..80498a8b008 100644 --- a/mozilla/widget/src/motif/nsAppShell.h +++ b/mozilla/widget/src/motif/nsAppShell.h @@ -44,8 +44,6 @@ class nsAppShell : public nsIAppShell NS_IMETHOD Run(); NS_IMETHOD Spinup(); NS_IMETHOD Spindown(); - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD Exit(); diff --git a/mozilla/widget/src/os2/nsAppShell.cpp b/mozilla/widget/src/os2/nsAppShell.cpp index 95f01aa15a5..6a5675c7392 100644 --- a/mozilla/widget/src/os2/nsAppShell.cpp +++ b/mozilla/widget/src/os2/nsAppShell.cpp @@ -207,46 +207,6 @@ nsAppShell::~nsAppShell() WinTerminate( mHab); } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// note this is the Windows implementation and may suffice, but -// this is untested on os/2. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PushThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// note this is the Windows implementation and may suffice, but -// this is untested on os/2. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PopThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - // These are for modal dialogs and also tres weird. // // XXX must handle WM_QUIT sensibly (close window) diff --git a/mozilla/widget/src/os2/nsAppShell.h b/mozilla/widget/src/os2/nsAppShell.h index cb43dc1607b..7ab61de0c92 100644 --- a/mozilla/widget/src/os2/nsAppShell.h +++ b/mozilla/widget/src/os2/nsAppShell.h @@ -41,8 +41,6 @@ class nsAppShell : public nsIAppShell NS_IMETHOD Spinup() { return NS_OK; } NS_IMETHOD Run(); NS_IMETHOD Spindown() { return NS_OK; } - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD Exit(); NS_IMETHOD GetNativeEvent( PRBool &aRealEvent, void *&aEvent); diff --git a/mozilla/widget/src/qt/nsAppShell.cpp b/mozilla/widget/src/qt/nsAppShell.cpp index 30c2b76b599..d582fa8a98c 100644 --- a/mozilla/widget/src/qt/nsAppShell.cpp +++ b/mozilla/widget/src/qt/nsAppShell.cpp @@ -261,62 +261,6 @@ done: return NS_OK; } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// note this is the Windows implementation and may suffice, but -// this is untested with Qt. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - PR_LOG(QtWidgetsLM, - PR_LOG_DEBUG, - ("nsAppShell::PushThreadEventQueue()\n")); - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - { - rv = eQueueService->PushThreadEventQueue(); - } - else - { - NS_ERROR("Appshell unable to obtain eventqueue service."); - } - - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// note this is the Windows implementation and may suffice, but -// this is untested with Qt. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - PR_LOG(QtWidgetsLM, - PR_LOG_DEBUG, - ("nsAppShell::PopThreadEventQueue()\n")); - nsresult rv; - - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - { - rv = eQueueService->PopThreadEventQueue(); - } - else - { - NS_ERROR("Appshell unable to obtain eventqueue service."); - } - - return rv; -} - //------------------------------------------------------------------------- // // Exit a message handler loop diff --git a/mozilla/widget/src/qt/nsAppShell.h b/mozilla/widget/src/qt/nsAppShell.h index 41c5ad1e3f9..a43717c4501 100644 --- a/mozilla/widget/src/qt/nsAppShell.h +++ b/mozilla/widget/src/qt/nsAppShell.h @@ -44,8 +44,6 @@ public: NS_IMETHOD Run(); NS_IMETHOD Spinup(); NS_IMETHOD Spindown(); - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, diff --git a/mozilla/widget/src/windows/nsAppShell.cpp b/mozilla/widget/src/windows/nsAppShell.cpp index 6442b76af98..0fa3087f2a3 100644 --- a/mozilla/widget/src/windows/nsAppShell.cpp +++ b/mozilla/widget/src/windows/nsAppShell.cpp @@ -78,44 +78,6 @@ NS_METHOD nsAppShell::Run() return msg.wParam; } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// (simple wrapper function on Windows) -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PushThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// (simple wrapper function on Windows) -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PopThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) { diff --git a/mozilla/widget/src/windows/nsAppShell.h b/mozilla/widget/src/windows/nsAppShell.h index c93b2475992..a94420ce56c 100644 --- a/mozilla/widget/src/windows/nsAppShell.h +++ b/mozilla/widget/src/windows/nsAppShell.h @@ -41,8 +41,6 @@ class nsAppShell : public nsIAppShell NS_IMETHOD Run(); NS_IMETHOD Spinup() { return NS_OK; } NS_IMETHOD Spindown() { return NS_OK; } - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, diff --git a/mozilla/widget/src/xlib/nsAppShell.cpp b/mozilla/widget/src/xlib/nsAppShell.cpp index 187d60d0931..68432c2b413 100644 --- a/mozilla/widget/src/xlib/nsAppShell.cpp +++ b/mozilla/widget/src/xlib/nsAppShell.cpp @@ -384,45 +384,6 @@ nsresult nsAppShell::Run() return rv; } -//------------------------------------------------------------------------- -// -// PushThreadEventQueue - begin processing events from a new queue -// note this is the Windows implementation and may suffice, but -// this is untested on xlib. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PushThreadEventQueue() -{ - nsresult rv; - - // push a nested event queue for event processing from netlib - // onto our UI thread queue stack. - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PushThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - -//------------------------------------------------------------------------- -// -// PopThreadEventQueue - stop processing on a previously pushed event queue -// note this is the Windows implementation and may suffice, but -// this is untested on xlib. -// -//------------------------------------------------------------------------- -NS_METHOD nsAppShell::PopThreadEventQueue() -{ - nsresult rv; - NS_WITH_SERVICE(nsIEventQueueService, eQueueService, kEventQueueServiceCID, &rv); - if (NS_SUCCEEDED(rv)) - rv = eQueueService->PopThreadEventQueue(); - else - NS_ERROR("Appshell unable to obtain eventqueue service."); - return rv; -} - NS_METHOD nsAppShell::GetNativeEvent(PRBool &aRealEvent, void *&aEvent) { diff --git a/mozilla/widget/src/xlib/nsAppShell.h b/mozilla/widget/src/xlib/nsAppShell.h index 65189493c88..60349b4d0ee 100644 --- a/mozilla/widget/src/xlib/nsAppShell.h +++ b/mozilla/widget/src/xlib/nsAppShell.h @@ -36,8 +36,6 @@ class nsAppShell : public nsIAppShell virtual nsresult Run(); NS_IMETHOD Spinup() { return NS_OK; } NS_IMETHOD Spindown() { return NS_OK; } - NS_IMETHOD PushThreadEventQueue(); - NS_IMETHOD PopThreadEventQueue(); NS_IMETHOD GetNativeEvent(PRBool &aRealEvent, void *&aEvent); NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void * aEvent); NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent,