diff options
Diffstat (limited to 'embed/xulrunner')
-rw-r--r-- | embed/xulrunner/utils/ggeAutoModalDialog.cpp | 17 | ||||
-rw-r--r-- | embed/xulrunner/utils/ggeAutoModalDialog.h | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/embed/xulrunner/utils/ggeAutoModalDialog.cpp b/embed/xulrunner/utils/ggeAutoModalDialog.cpp index 76029d2f3..761e871d9 100644 --- a/embed/xulrunner/utils/ggeAutoModalDialog.cpp +++ b/embed/xulrunner/utils/ggeAutoModalDialog.cpp @@ -51,13 +51,12 @@ ggeAutoModalDialog::ggeAutoModalDialog (nsIDOMWindow *aWindow, : mWindow (aWindow), mPWindow (do_QueryInterface (aWindow)), mStack (do_GetService ("@mozilla.org/js/xpc/ContextStack;1")), - mDefaultEnabled (PR_TRUE), + mDefaultEnabled (DispatchEvent ("DOMWillOpenModalDialog", aNotifyDOM)), mContextPushed (PR_FALSE), mModalStateSet (PR_FALSE) { /* First we check whether we should show the dialogue at all */ if (aNotifyDOM) { - mDefaultEnabled = DispatchEvent ("DOMWillOpenModalDialog"); if (!mDefaultEnabled) { return; } @@ -139,13 +138,12 @@ ggeAutoModalDialog::Run (GtkWidget *aDialog) G_CALLBACK (DeleteCallback), reinterpret_cast<void*>(this)); - nsCOMPtr<nsIThread> thread (do_GetCurrentThread ()); NS_ASSERTION (thread, "No UI thread?"); mContinueModalLoop = PR_TRUE; while (mContinueModalLoop) { - if (!NS_ProcessNextEvent(thread)) + if (!NS_ProcessNextEvent (thread)) break; } @@ -157,9 +155,10 @@ ggeAutoModalDialog::Run (GtkWidget *aDialog) } PRBool -ggeAutoModalDialog::DispatchEvent (const char *aEventName) +ggeAutoModalDialog::DispatchEvent (const char *aEventName, + PRBool aDoNotify) { - if (!mWindow) { + if (!mWindow || !aDoNotify) { return PR_TRUE; } @@ -172,7 +171,7 @@ ggeAutoModalDialog::DispatchEvent (const char *aEventName) PRBool defaultActionEnabled = PR_TRUE; if (docevent) { - docevent->CreateEvent(NS_LITERAL_STRING ("Events"), getter_AddRefs (event)); + docevent->CreateEvent (NS_LITERAL_STRING ("Events"), getter_AddRefs (event)); nsCOMPtr<nsIPrivateDOMEvent> privateEvent (do_QueryInterface (event)); if (privateEvent) { @@ -180,9 +179,9 @@ ggeAutoModalDialog::DispatchEvent (const char *aEventName) privateEvent->SetTrusted(PR_TRUE); - nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(mWindow)); + nsCOMPtr<nsIDOMEventTarget> target (do_QueryInterface (mWindow)); - target->DispatchEvent(event, &defaultActionEnabled); + target->DispatchEvent (event, &defaultActionEnabled); } } diff --git a/embed/xulrunner/utils/ggeAutoModalDialog.h b/embed/xulrunner/utils/ggeAutoModalDialog.h index 0c9da0fcd..07299b609 100644 --- a/embed/xulrunner/utils/ggeAutoModalDialog.h +++ b/embed/xulrunner/utils/ggeAutoModalDialog.h @@ -50,7 +50,7 @@ class ggeAutoModalDialog // stack only please void *operator new (size_t) CPP_THROW_NEW; - PRBool DispatchEvent (const char *aEventName); + PRBool DispatchEvent (const char*, PRBool); static void PR_CALLBACK ResponseCallback (GtkWidget*, int, void*); static gboolean PR_CALLBACK DeleteCallback (GtkWidget*, void*, void*); |