This is a hack to service the PLEventQueue that nsWebShell posts events to

such as anchor clicking.  This is only a temporary fix.  We need some other
way to do this.
This commit is contained in:
msw%gimp.org 1998-11-19 21:12:02 +00:00
Родитель b5b7c842bb
Коммит b7e208be32
1 изменённых файлов: 37 добавлений и 4 удалений

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

@ -18,8 +18,13 @@
#include "nsAppShell.h"
#include "nsIAppShell.h"
#include "plevent.h"
#include <stdlib.h>
// XXX -- This is a HACK
PLEventQueue* gUnixMainEventQueue = nsnull;
//-------------------------------------------------------------------------
//
// nsISupports implementation macro
@ -59,14 +64,44 @@ NS_METHOD nsAppShell::Create(int* argc, char ** argv)
return NS_OK;
}
//-------------------------------------------------------------------------
//
// PLEventQueue Processor
//
//-------------------------------------------------------------------------
static void nsUnixEventProcessorCallback(gpointer data,
gint source,
GdkInputCondition condition)
{
NS_ASSERTION(source==PR_GetEventQueueSelectFD(gUnixMainEventQueue),
"Error in nsUnixMain.cpp:nsUnixEventProcessCallback");
PR_ProcessPendingEvents(gUnixMainEventQueue);
}
//-------------------------------------------------------------------------
//
// Enter a message handler loop
//
//-------------------------------------------------------------------------
// XXX This comes from nsWebShell. If we don't link against nsWebShell
// this will break. FIX ME FIX ME Please!
extern void nsWebShell_SetUnixEventQueue(PLEventQueue* aEventQueue);
NS_METHOD nsAppShell::Run()
{
gUnixMainEventQueue = PR_CreateEventQueue("viewer-event-queue", PR_GetCurrentThread());
// XXX Setup webshell's event queue. This must be changed
nsWebShell_SetUnixEventQueue(gUnixMainEventQueue);
gdk_input_add(PR_GetEventQueueSelectFD(gUnixMainEventQueue),
GDK_INPUT_READ,
nsUnixEventProcessorCallback,
NULL);
gtk_main();
@ -84,7 +119,7 @@ NS_METHOD nsAppShell::Exit()
// gtk_widget_destroy (mTopLevel);
gtk_main_quit ();
gtk_exit(0);
return NS_OK;
}
@ -94,7 +129,7 @@ NS_METHOD nsAppShell::Exit()
//
//-------------------------------------------------------------------------
nsAppShell::nsAppShell()
{
{
mRefCnt = 0;
mDispatchListener = 0;
}
@ -120,5 +155,3 @@ void* nsAppShell::GetNativeData(PRUint32 aDataType)
}
return nsnull;
}