This commit is contained in:
mark.lin%eng.sun.com 1999-08-13 17:53:43 +00:00
Родитель 4751b9866b
Коммит 284de736fe
4 изменённых файлов: 328 добавлений и 495 удалений

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

@ -94,6 +94,9 @@ struct WebShellInitContext {
int h;
};
void PostEvent (WebShellInitContext * initContext, PLEvent * event);
void * PostSynchronousEvent (WebShellInitContext * initContext, PLEvent * event);
static void
ThrowExceptionToJava (JNIEnv * env, const char * message)
{
@ -264,9 +267,6 @@ EmbeddedEventHandler (void * arg) {
}
}
// PENDING(mark): This is a test
//PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
#if DEBUG_RAPTOR_CANVAS
printf("EmbeddedEventHandler(%lx): Create the WebShell...\n", initContext);
#endif
@ -303,9 +303,6 @@ EmbeddedEventHandler (void * arg) {
printf("EmbeddedEventHandler(%lx): enter event loop\n", initContext);
#endif
// PENDING(mark): This is a test
//PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
do {
if (!processEventLoop(initContext)) {
#ifndef XP_UNIX
@ -347,6 +344,9 @@ InitEmbeddedEventHandler (WebShellInitContext* initContext)
printf("InitEmbeddedEventHandler(%lx): Embedded Thread created...\n", initContext);
#endif
while (initContext->initComplete == FALSE) {
::PR_Sleep(PR_INTERVAL_NO_WAIT);
if (initContext->initFailCode != 0) {
::ThrowExceptionToJava(initContext->env, errorMessages[initContext->initFailCode]);
return;
@ -1171,12 +1171,8 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellLoadURL (
wsLoadURLEvent * actionEvent = new wsLoadURLEvent(initContext->webShell, urlStringChars);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
}
::PostEvent(initContext, event);
}
env->ReleaseStringChars(urlString, urlStringChars);
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellLoadURL()
@ -1207,11 +1203,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop (
wsStopEvent * actionEvent = new wsStopEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellStop()
@ -1241,11 +1233,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow (
wsShowEvent * actionEvent = new wsShowEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellShow()
@ -1275,11 +1263,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellHide (
wsHideEvent * actionEvent = new wsHideEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellHide()
@ -1314,11 +1298,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetBounds (
wsResizeEvent * actionEvent = new wsResizeEvent(initContext->webShell, x, y, width, height);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetBounds()
@ -1351,11 +1331,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellMoveTo (
wsMoveToEvent * actionEvent = new wsMoveToEvent(initContext->webShell, x, y);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellMoveTo()
@ -1386,11 +1362,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetFocus (
wsSetFocusEvent * actionEvent = new wsSetFocusEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellSetFocus()
@ -1421,11 +1393,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRemoveFocus (
wsRemoveFocusEvent * actionEvent = new wsRemoveFocusEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRemoveFocus()
@ -1457,11 +1425,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRepaint (
wsRepaintEvent * actionEvent = new wsRepaintEvent(initContext->webShell, (PRBool) forceRepaint);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PostEvent(initContext, event);
}
} // Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellRepaint()
@ -1493,24 +1457,9 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanBack (
wsCanBackEvent * actionEvent = new wsCanBackEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
voidResult = ::PostSynchronousEvent(initContext, event);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE;
return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE;
}
return JNI_FALSE;
@ -1543,22 +1492,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellCanForward (
wsCanForwardEvent * actionEvent = new wsCanForwardEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE;
}
@ -1593,22 +1527,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellBack (
wsBackEvent * actionEvent = new wsBackEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE;
}
@ -1643,22 +1562,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellForward (
wsForwardEvent * actionEvent = new wsForwardEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE;
}
@ -1694,22 +1598,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGoTo (
wsGoToEvent * actionEvent = new wsGoToEvent(initContext->webShell, historyIndex);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
return (NS_FAILED((nsresult) voidResult)) ? JNI_FALSE : JNI_TRUE;
}
@ -1744,22 +1633,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryLen
wsGetHistoryLengthEvent * actionEvent = new wsGetHistoryLengthEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
return ((jint) voidResult);
}
@ -1794,22 +1668,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetHistoryInd
wsGetHistoryIndexEvent * actionEvent = new wsGetHistoryIndexEvent(initContext->webShell);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
return ((jint) voidResult);
}
@ -1846,22 +1705,7 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL (
wsGetURLEvent * actionEvent = new wsGetURLEvent(initContext->webShell, historyIndex);
PLEvent * event = (PLEvent*) *actionEvent;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
while (actionEvent->isComplete() == PR_FALSE) {
#ifndef XP_UNIX
//PENDING(mark): Why not just use PR_Sleep?
Sleep(0);
#else
::PR_Sleep(PR_INTERVAL_NO_WAIT);
#endif
}
voidResult = actionEvent->getResult();
delete actionEvent;
voidResult = ::PostSynchronousEvent(initContext, event);
if (voidResult != nsnull) {
@ -1900,4 +1744,32 @@ Java_org_mozilla_webclient_BrowserControlMozillaShim_nativeWebShellGetURL (
}// End extern "C"
#endif
void
PostEvent (WebShellInitContext * initContext, PLEvent * event)
{
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
::PL_PostEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
} // PostEvent()
void *
PostSynchronousEvent (WebShellInitContext * initContext, PLEvent * event)
{
void * voidResult = nsnull;
PL_ENTER_EVENT_QUEUE_MONITOR(initContext->actionQueue);
voidResult = ::PL_PostSynchronousEvent(initContext->actionQueue, event);
PL_EXIT_EVENT_QUEUE_MONITOR(initContext->actionQueue);
return voidResult;
} // PostSynchronousEvent()
// EOF

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

@ -23,35 +23,30 @@
void * handleEvent (PLEvent * event);
void destroyEvent (PLEvent * event);
void * handleEvent (PLEvent * event);
void destroyEvent (PLEvent * event);
void *
handleEvent (PLEvent * event)
{
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
void * result = nsnull;
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
void * result = nsnull;
if (actionEvent != NULL) {
actionEvent->setResult(result = actionEvent->handleEvent());
actionEvent->setComplete(PR_TRUE);
}
return result;
result = actionEvent->handleEvent();
return result;
} // handleEvent()
void
destroyEvent (PLEvent * event)
{
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
nsActionEvent * actionEvent = (nsActionEvent*) event->owner;
if (actionEvent != NULL) {
if (!actionEvent->isSynchronous()) {
// Only delete if non-synchronous. Synchronous events are deleted by the event poster.
actionEvent->destroyEvent();
}
}
if (actionEvent != NULL) {
actionEvent->destroyEvent();
}
} // destroyEvent()
@ -60,41 +55,26 @@ destroyEvent (PLEvent * event)
* nsActionEvent
*/
nsActionEvent::nsActionEvent (PRBool synchronous)
nsActionEvent::nsActionEvent ()
{
PL_InitEvent(&mEvent, this,
(PLHandleEventProc ) ::handleEvent,
(PLDestroyEventProc) ::destroyEvent);
mSynchronous = synchronous;
mComplete = PR_FALSE;
mResult = nsnull;
PL_InitEvent(&mEvent, this,
(PLHandleEventProc ) ::handleEvent,
(PLDestroyEventProc) ::destroyEvent);
}
PRBool
nsActionEvent::isComplete (void)
{
if (mSynchronous) {
return mComplete;
}
else {
return PR_TRUE;
}
} // isComplete()
/*
* wsResizeEvent
*/
wsResizeEvent::wsResizeEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mLeft(x),
mBottom(y),
mWidth(w),
mHeight(h)
nsActionEvent(),
mWebShell(webShell),
mLeft(x),
mBottom(y),
mWidth(w),
mHeight(h)
{
}
@ -102,17 +82,17 @@ wsResizeEvent::wsResizeEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt3
void *
wsResizeEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(resize) x = %d y = %d w = %d h = %d\n", mLeft, mBottom, mWidth, mHeight);
if (mWebShell) {
printf("handleEvent(resize(x = %d y = %d w = %d h = %d))\n", mLeft, mBottom, mWidth, mHeight);
nsresult rv = mWebShell->SetBounds(mLeft, mBottom, mWidth, mHeight);
printf("result = %lx\n", rv);
nsresult rv = mWebShell->SetBounds(mLeft, mBottom, mWidth, mHeight);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
return (void *) rv;
}
return NULL;
} // handleEvent()
@ -123,39 +103,33 @@ wsResizeEvent::handleEvent ()
*/
wsLoadURLEvent::wsLoadURLEvent(nsIWebShell* webShell, PRUnichar * urlString) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mURL(nsnull)
nsActionEvent(),
mWebShell(webShell),
mURL(nsnull)
{
#ifdef NECKO
mURL = new nsString(urlString);
#else
mURL = new nsString1(urlString);
#endif
mURL = new nsString(urlString);
}
void *
wsLoadURLEvent::handleEvent ()
{
if (mWebShell && mURL) {
printf("handleEvent(loadURL)\n");
if (mWebShell && mURL) {
printf("handleEvent(loadURL))\n");
nsresult rv = mWebShell->LoadURL(mURL->GetUnicode());
nsresult rv = mWebShell->LoadURL(mURL->GetUnicode());
printf("result = %lx\n", rv);
PR_Sleep(PR_SecondsToInterval(5));
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
wsLoadURLEvent::~wsLoadURLEvent ()
{
if (mURL != nsnull)
delete mURL;
if (mURL != nsnull)
delete mURL;
}
@ -165,8 +139,8 @@ wsLoadURLEvent::~wsLoadURLEvent ()
*/
wsStopEvent::wsStopEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -174,15 +148,15 @@ wsStopEvent::wsStopEvent(nsIWebShell* webShell) :
void *
wsStopEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Stop)\n");
if (mWebShell) {
printf("handleEvent(Stop))\n");
nsresult rv = mWebShell->Stop();
nsresult rv = mWebShell->Stop();
printf("result = %lx\n", rv);
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -192,8 +166,8 @@ wsStopEvent::handleEvent ()
*/
wsShowEvent::wsShowEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -201,15 +175,15 @@ wsShowEvent::wsShowEvent(nsIWebShell* webShell) :
void *
wsShowEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Show)\n");
if (mWebShell) {
printf("handleEvent(Show))\n");
nsresult rv = mWebShell->Show();
printf("result = %lx\n", rv);
}
return NULL;
nsresult rv = mWebShell->Show();
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -219,8 +193,8 @@ wsShowEvent::handleEvent ()
*/
wsHideEvent::wsHideEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -228,15 +202,15 @@ wsHideEvent::wsHideEvent(nsIWebShell* webShell) :
void *
wsHideEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Hide)\n");
if (mWebShell) {
printf("handleEvent(Hide))\n");
nsresult rv = mWebShell->Hide();
nsresult rv = mWebShell->Hide();
printf("result = %lx\n", rv);
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -246,10 +220,10 @@ wsHideEvent::handleEvent ()
*/
wsMoveToEvent::wsMoveToEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mX(x),
mY(y)
nsActionEvent(),
mWebShell(webShell),
mX(x),
mY(y)
{
}
@ -257,15 +231,15 @@ wsMoveToEvent::wsMoveToEvent(nsIWebShell* webShell, PRInt32 x, PRInt32 y) :
void *
wsMoveToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(MoveTo(%ld, %ld)\n", mX, mY);
if (mWebShell) {
printf("handleEvent(MoveTo(%ld, %ld))\n", mX, mY);
nsresult rv = mWebShell->MoveTo(mX, mY);
nsresult rv = mWebShell->MoveTo(mX, mY);
printf("result = %lx\n", rv);
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -274,8 +248,8 @@ wsMoveToEvent::handleEvent ()
*/
wsSetFocusEvent::wsSetFocusEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -283,15 +257,15 @@ wsSetFocusEvent::wsSetFocusEvent(nsIWebShell* webShell) :
void *
wsSetFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(SetFocus()\n");
if (mWebShell) {
printf("handleEvent(SetFocus())\n");
nsresult rv = mWebShell->SetFocus();
nsresult rv = mWebShell->SetFocus();
printf("result = %lx\n", rv);
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -301,8 +275,8 @@ wsSetFocusEvent::handleEvent ()
*/
wsRemoveFocusEvent::wsRemoveFocusEvent(nsIWebShell* webShell) :
nsActionEvent(PR_FALSE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -310,15 +284,15 @@ wsRemoveFocusEvent::wsRemoveFocusEvent(nsIWebShell* webShell) :
void *
wsRemoveFocusEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(RemoveFocus()\n");
if (mWebShell) {
printf("handleEvent(RemoveFocus())\n");
nsresult rv = mWebShell->RemoveFocus();
nsresult rv = mWebShell->RemoveFocus();
printf("result = %lx\n", rv);
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -328,9 +302,9 @@ wsRemoveFocusEvent::handleEvent ()
*/
wsRepaintEvent::wsRepaintEvent(nsIWebShell* webShell, PRBool forceRepaint) :
nsActionEvent(PR_FALSE),
mWebShell(webShell),
mForceRepaint(forceRepaint)
nsActionEvent(),
mWebShell(webShell),
mForceRepaint(forceRepaint)
{
}
@ -338,15 +312,15 @@ wsRepaintEvent::wsRepaintEvent(nsIWebShell* webShell, PRBool forceRepaint) :
void *
wsRepaintEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Repaint(%d)\n", mForceRepaint);
if (mWebShell) {
printf("handleEvent(Repaint(%d))\n", mForceRepaint);
nsresult rv = mWebShell->Repaint(mForceRepaint);
nsresult rv = mWebShell->Repaint(mForceRepaint);
printf("result = %lx\n", rv);
}
return NULL;
printf("result = %lx\n", rv);
}
return NULL;
} // handleEvent()
@ -356,8 +330,8 @@ wsRepaintEvent::handleEvent ()
*/
wsCanBackEvent::wsCanBackEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -365,17 +339,17 @@ wsCanBackEvent::wsCanBackEvent(nsIWebShell* webShell) :
void *
wsCanBackEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(CanBack()\n");
if (mWebShell) {
printf("handleEvent(CanBack())\n");
nsresult rv = mWebShell->CanBack();
printf("result = %lx\n", rv);
nsresult rv = mWebShell->CanBack();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
return (void *) rv;
}
return NULL;
} // handleEvent()
@ -385,8 +359,8 @@ wsCanBackEvent::handleEvent ()
*/
wsCanForwardEvent::wsCanForwardEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -394,17 +368,17 @@ wsCanForwardEvent::wsCanForwardEvent(nsIWebShell* webShell) :
void *
wsCanForwardEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(CanForward()\n");
if (mWebShell) {
printf("handleEvent(CanForward())\n");
nsresult rv = mWebShell->CanForward();
printf("result = %lx\n", rv);
nsresult rv = mWebShell->CanForward();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
return (void *) rv;
}
return NULL;
} // handleEvent()
@ -414,8 +388,8 @@ wsCanForwardEvent::handleEvent ()
*/
wsBackEvent::wsBackEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -423,17 +397,17 @@ wsBackEvent::wsBackEvent(nsIWebShell* webShell) :
void *
wsBackEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Back()\n");
if (mWebShell) {
printf("handleEvent(Back())\n");
nsresult rv = mWebShell->Back();
printf("result = %lx\n", rv);
nsresult rv = mWebShell->Back();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
return (void *) rv;
}
return NULL;
} // handleEvent()
@ -443,8 +417,8 @@ wsBackEvent::handleEvent ()
*/
wsForwardEvent::wsForwardEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -452,17 +426,17 @@ wsForwardEvent::wsForwardEvent(nsIWebShell* webShell) :
void *
wsForwardEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(Forward()\n");
if (mWebShell) {
printf("handleEvent(Forward())\n");
nsresult rv = mWebShell->Forward();
printf("result = %lx\n", rv);
nsresult rv = mWebShell->Forward();
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
return (void *) rv;
}
return NULL;
} // handleEvent()
@ -472,9 +446,9 @@ wsForwardEvent::handleEvent ()
*/
wsGoToEvent::wsGoToEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
nsActionEvent(PR_TRUE),
mWebShell(webShell),
mHistoryIndex(historyIndex)
nsActionEvent(),
mWebShell(webShell),
mHistoryIndex(historyIndex)
{
}
@ -482,17 +456,17 @@ wsGoToEvent::wsGoToEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
void *
wsGoToEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(GoTo(%ld)\n", mHistoryIndex);
if (mWebShell) {
printf("handleEvent(GoTo(%ld))\n", mHistoryIndex);
nsresult rv = mWebShell->GoTo(mHistoryIndex);
printf("result = %lx\n", rv);
nsresult rv = mWebShell->GoTo(mHistoryIndex);
printf("result = %lx\n", rv);
return (void *) rv;
}
return NULL;
return (void *) rv;
}
return NULL;
} // handleEvent()
@ -502,8 +476,8 @@ wsGoToEvent::handleEvent ()
*/
wsGetHistoryLengthEvent::wsGetHistoryLengthEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -511,19 +485,19 @@ wsGetHistoryLengthEvent::wsGetHistoryLengthEvent(nsIWebShell* webShell) :
void *
wsGetHistoryLengthEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetHistoryLengthEvent()\n");
if (mWebShell) {
printf("handleEvent(wsGetHistoryLengthEvent())\n");
PRInt32 historyLength = 0;
PRInt32 historyLength = 0;
nsresult rv = mWebShell->GetHistoryLength(historyLength);
printf("result = %lx\n", rv);
nsresult rv = mWebShell->GetHistoryLength(historyLength);
printf("result = %lx\n", rv);
return (void *) historyLength;
}
return NULL;
return (void *) historyLength;
}
return NULL;
} // handleEvent()
@ -533,8 +507,8 @@ wsGetHistoryLengthEvent::handleEvent ()
*/
wsGetHistoryIndexEvent::wsGetHistoryIndexEvent(nsIWebShell* webShell) :
nsActionEvent(PR_TRUE),
mWebShell(webShell)
nsActionEvent(),
mWebShell(webShell)
{
}
@ -542,19 +516,19 @@ wsGetHistoryIndexEvent::wsGetHistoryIndexEvent(nsIWebShell* webShell) :
void *
wsGetHistoryIndexEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetHistoryIndexEvent()\n");
if (mWebShell) {
printf("handleEvent(wsGetHistoryIndexEvent())\n");
PRInt32 historyIndex = 0;
PRInt32 historyIndex = 0;
nsresult rv = mWebShell->GetHistoryIndex(historyIndex);
printf("result = %lx\n", rv);
nsresult rv = mWebShell->GetHistoryIndex(historyIndex);
printf("result = %lx\n", rv);
return (void *) historyIndex;
}
return NULL;
return (void *) historyIndex;
}
return NULL;
} // handleEvent()
@ -564,9 +538,9 @@ wsGetHistoryIndexEvent::handleEvent ()
*/
wsGetURLEvent::wsGetURLEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
nsActionEvent(PR_TRUE),
mWebShell(webShell),
mHistoryIndex(historyIndex)
nsActionEvent(),
mWebShell(webShell),
mHistoryIndex(historyIndex)
{
}
@ -574,22 +548,23 @@ wsGetURLEvent::wsGetURLEvent(nsIWebShell* webShell, PRInt32 historyIndex) :
void *
wsGetURLEvent::handleEvent ()
{
if (mWebShell) {
printf("handleEvent(wsGetURLEvent(%ld)\n", mHistoryIndex);
if (mWebShell) {
printf("handleEvent(wsGetURLEvent(%ld))\n", mHistoryIndex);
const PRUnichar * url = nsnull;
const PRUnichar * url = nsnull;
// returns PRUninchar * URL in <url>. No need to delete. References internal buffer of an nsString
nsresult rv = mWebShell->GetURL(mHistoryIndex, &url);
printf("result = %lx, url = %lx\n", rv, url);
// returns PRUninchar * URL in <url>. No need to delete. References internal buffer of an nsString
nsresult rv = mWebShell->GetURL(mHistoryIndex, &url);
printf("result = %lx, url = %lx\n", rv, url);
return (void *) url;
}
return NULL;
return (void *) url;
}
return NULL;
} // handleEvent()
// EOF

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

@ -23,7 +23,6 @@
#define nsActions_h___
#ifndef XP_UNIX
//PENDING(mark): Will this work on the Mac????
#include <windows.h>
#endif
#include "nsIWebShell.h"
@ -33,226 +32,213 @@
class nsActionEvent {
public:
nsActionEvent (PRBool synchronous);
virtual ~nsActionEvent () {};
virtual void * handleEvent (void) { return NULL;};
void destroyEvent (void) { delete this; };
operator PLEvent* () { return &mEvent; };
PRBool isSynchronous (void) { return mSynchronous; };
PRBool isComplete (void);
void setComplete (PRBool complete) { mComplete = complete; };
void * getResult (void) { return mResult; };
void setResult (void * result) { mResult = result; };
nsActionEvent ();
virtual ~nsActionEvent () {};
virtual void * handleEvent (void) { return NULL;};
void destroyEvent (void) { delete this; };
operator PLEvent* () { return &mEvent; };
protected:
PLEvent mEvent;
void * mResult;
PRBool mSynchronous;
PRBool mComplete;
PLEvent mEvent;
};
class wsResizeEvent : public nsActionEvent {
public:
wsResizeEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
void * handleEvent (void);
wsResizeEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mLeft;
PRInt32 mBottom;
PRInt32 mWidth;
PRInt32 mHeight;
nsIWebShell * mWebShell;
PRInt32 mLeft;
PRInt32 mBottom;
PRInt32 mWidth;
PRInt32 mHeight;
};
class wsLoadURLEvent : public nsActionEvent {
public:
wsLoadURLEvent (nsIWebShell* webShell, PRUnichar * urlString);
~wsLoadURLEvent ();
void * handleEvent (void);
wsLoadURLEvent (nsIWebShell* webShell, PRUnichar * urlString);
~wsLoadURLEvent ();
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
#ifdef NECKO
nsString * mURL;
#else
nsString1 * mURL;
#endif
nsIWebShell * mWebShell;
nsString * mURL;
};
class wsStopEvent : public nsActionEvent {
public:
wsStopEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsStopEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsShowEvent : public nsActionEvent {
public:
wsShowEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsShowEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsHideEvent : public nsActionEvent {
public:
wsHideEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsHideEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsMoveToEvent : public nsActionEvent {
public:
wsMoveToEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y);
void * handleEvent (void);
wsMoveToEvent (nsIWebShell* webShell, PRInt32 x, PRInt32 y);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mX;
PRInt32 mY;
nsIWebShell * mWebShell;
PRInt32 mX;
PRInt32 mY;
};
class wsSetFocusEvent : public nsActionEvent {
public:
wsSetFocusEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsSetFocusEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsRemoveFocusEvent : public nsActionEvent {
public:
wsRemoveFocusEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsRemoveFocusEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsRepaintEvent : public nsActionEvent {
public:
wsRepaintEvent (nsIWebShell* webShell, PRBool forceRepaint);
void * handleEvent (void);
wsRepaintEvent (nsIWebShell* webShell, PRBool forceRepaint);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRBool mForceRepaint;
nsIWebShell * mWebShell;
PRBool mForceRepaint;
};
class wsCanBackEvent : public nsActionEvent {
public:
wsCanBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsCanBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsCanForwardEvent : public nsActionEvent {
public:
wsCanForwardEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsCanForwardEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsBackEvent : public nsActionEvent {
public:
wsBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsBackEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsForwardEvent : public nsActionEvent {
public:
wsForwardEvent (nsIWebShell* webShell);
void * handleEvent (void);
wsForwardEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsGoToEvent : public nsActionEvent {
public:
wsGoToEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
wsGoToEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
};
class wsGetHistoryLengthEvent : public nsActionEvent {
public:
wsGetHistoryLengthEvent
(nsIWebShell* webShell);
void * handleEvent (void);
wsGetHistoryLengthEvent(nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsGetHistoryIndexEvent : public nsActionEvent {
public:
wsGetHistoryIndexEvent
(nsIWebShell* webShell);
void * handleEvent (void);
wsGetHistoryIndexEvent (nsIWebShell* webShell);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
nsIWebShell * mWebShell;
};
class wsGetURLEvent : public nsActionEvent {
public:
wsGetURLEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
wsGetURLEvent (nsIWebShell* webShell, PRInt32 historyIndex);
void * handleEvent (void);
protected:
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
nsIWebShell * mWebShell;
PRInt32 mHistoryIndex;
};
#endif /* nsActions_h___ */
// EOF

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

@ -9,7 +9,7 @@ export MOZILLA_FIVE_HOME
JDK_LOCATION=${JDKHOME}
# WARNING: YOU NEED TO RUN 'gtk-config --libs' and stick in whatever library
# paths it gives you!!!!
GTKLIBS=/opt/local/lib:/usr/openwin/lib:/usr/dt/lib
GTKLIBS=/usr/local/X11R6/lib:/opt/local/lib:/usr/openwin/lib:/usr/dt/lib
# For Solaris
LD_LIBRARY_PATH=${JDK_LOCATION}/jre/lib/solaris:${MOZILLA_DIST}/bin:${GTKLIBS}:.:/usr/local/lib:/usr/lib:/lib
export LD_LIBRARY_PATH