зеркало из https://github.com/mozilla/gecko-dev.git
moving Push/PopThreadEventQueue to nsIEventQueueService. r:hyatt@netscape.com
This commit is contained in:
Родитель
a448bf8e64
Коммит
fdd0fccc59
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 <stdlib.h>
|
||||
|
||||
#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<nsIEventQueue> 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<nsIEventQueue> 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<nsIObserver> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,17 +20,18 @@
|
|||
#define nsAppShell_h__
|
||||
|
||||
#include "nsIAppShell.h"
|
||||
#include "nsIObserver.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/**
|
||||
* 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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче