use nsIEventQueueService rather than our own private event queue. Leads to the removal of a bunch of #ifdef mac code.

This commit is contained in:
davidm%netscape.com 1999-04-12 22:52:52 +00:00
Родитель 66a58a43bb
Коммит a7e8bce3f0
2 изменённых файлов: 18 добавлений и 15 удалений

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

@ -19,19 +19,20 @@
#include "nsToolkit.h"
#include "nsWindow.h"
#include "nsGUIEvent.h"
#include "plevent.h"
#include "prinrval.h"
#include <Gestalt.h>
#include <Appearance.h>
#include "nsIEventQueueService.h"
#include "nsIServiceManager.h"
#include "nsXPComCIID.h"
// Class IDs...
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
// Interface IDs...
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
nsWindow* nsToolkit::mFocusedWidget = nsnull;
PLEventQueue* nsToolkit::sPLEventQueue = nsnull;
extern "C" NS_EXPORT PLEventQueue* GetMacPLEventQueue()
{
return nsToolkit::GetEventQueue();
}
//=================================================================
/* Constructor
* @update dc 08/31/98
@ -119,15 +120,13 @@ NS_IMPL_ISUPPORTS(nsToolkit,kIToolkitIID);
*/
NS_IMETHODIMP nsToolkit::Init(PRThread *aThread)
{
// Create the NSPR event Queue and start the repeater
if ( sPLEventQueue == NULL )
sPLEventQueue = PL_CreateEventQueue("toolkit", aThread);
StartRepeating();
return NS_OK;
}
//=================================================================
/* Process the NSPR event queue.
* @update dc 08/31/98
@ -137,7 +136,14 @@ NS_IMETHODIMP nsToolkit::Init(PRThread *aThread)
void nsToolkit::RepeatAction(const EventRecord& /*inMacEvent*/)
{
// Handle pending NSPR events
PL_ProcessPendingEvents( sPLEventQueue );
nsIEventQueueService* eventQService = NULL;
if ( NS_SUCCEEDED( nsServiceManager::GetService(kEventQueueServiceCID,
kIEventQueueServiceIID,
(nsISupports **)&eventQService) ) )
{
eventQService->ProcessEvents();
nsServiceManager::ReleaseService(kEventQueueServiceCID, eventQService);
}
}

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

@ -48,8 +48,6 @@ public:
void SetFocus(nsWindow *aFocusWidget);
nsWindow* GetFocus() {return(mFocusedWidget);}
// Event Queue
static PLEventQueue* GetEventQueue(){ return sPLEventQueue; }
// Appearance Mgr
static bool HasAppearanceManager();
@ -62,7 +60,6 @@ public:
private:
static nsWindow* mFocusedWidget;
static PLEventQueue* sPLEventQueue;
};