diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-01-23 23:38:02 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-01-23 23:38:02 +0800 |
commit | 361ed3d1c475f7b1ab2226abf7605405411ab185 (patch) | |
tree | 331891b90297d0d93026d2ca15b86570b634fc1e /embed/mozilla | |
parent | 8f10d345ad4bebf6a99c8a62e2448f49338eeb33 (diff) | |
download | gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.tar gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.tar.gz gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.tar.bz2 gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.tar.lz gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.tar.xz gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.tar.zst gsoc2013-epiphany-361ed3d1c475f7b1ab2226abf7605405411ab185.zip |
Check for broken context event button.
2005-01-23 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
Check for broken context event button.
* embed/ephy-embed-event.c: (ephy_embed_event_get_context),
(ephy_embed_event_get_button):
* embed/ephy-embed-event.h:
* embed/mozilla/mozilla-embed-event.cpp:
* embed/mozilla/mozilla-embed-event.h:
Change get_type to get_button, and don't store a nsCOMPtr in .priv.
* src/ephy-tab.c: (ephy_tab_dom_mouse_click_cb):
* src/ephy-window.c: (show_embed_popup), (tab_context_menu_cb),
(ephy_window_set_active_tab):
Adapted for above change.
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
Attach listener to oncontextmenu event.
* embed/mozilla/EventContext.cpp:
* embed/mozilla/EventContext.h:
Get event target coordinates also for 'mouse' context events.
* embed/mozilla/mozilla-embed.cpp:
Remove key-down handler, and context code from mouse-down handler.
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 113 | ||||
-rw-r--r-- | embed/mozilla/EphyBrowser.h | 22 | ||||
-rw-r--r-- | embed/mozilla/EventContext.cpp | 94 | ||||
-rw-r--r-- | embed/mozilla/EventContext.h | 2 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-event.cpp | 20 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-event.h | 12 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 92 |
7 files changed, 216 insertions, 139 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index b2c623a6b..03076ef21 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -24,10 +24,13 @@ #include "EphyBrowser.h" #include "EphyUtils.h" +#include "EventContext.h" #include "ephy-embed.h" #include "ephy-string.h" #include "ephy-debug.h" #include "print-dialog.h" +#include "mozilla-embed.h" +#include "mozilla-embed-event.h" #include <gtkmozembed_internal.h> #include <unistd.h> @@ -57,6 +60,8 @@ #include "nsIDOMDocument.h" #include "nsIDOM3Document.h" #include "nsIDOMEvent.h" +#include "nsIDOMKeyEvent.h" +#include "nsIDOMMouseEvent.h" #include "nsIDOMNSEvent.h" #include "nsIDOMEventTarget.h" #include "nsIDOMPopupBlockedEvent.h" @@ -96,6 +101,8 @@ static PRUnichar DOMLinkAdded[] = { 'D', 'O', 'M', 'L', 'i', 'n', 'k', 'A', 'd', 'd', 'e', 'd', '\0' }; +static PRUnichar ContextMenu[] = { 'c', 'o', 'n', 't', 'e', 'x', 't', 'm', + 'e', 'n', 'u', '\0' }; static PRUnichar DOMPopupBlocked[] = { 'D', 'O', 'M', 'P', 'o', 'p', 'u', 'p', 'B', 'l', 'o', 'c', 'k', 'e', 'd', '\0' }; @@ -107,7 +114,7 @@ static PRUnichar DOMModalDialogClosed[] = { 'D', 'O', 'M', 'M', 'o', 'd', 'a', 'l', 'D', 'i', 'a', 'l', 'o', 'g', 'C', 'l', 'o', 's', 'e', 'd', '\0' }; -EphyEventListener::EphyEventListener(void) +EphyEventListener::EphyEventListener() : mOwner(nsnull) { LOG ("EphyEventListener ctor (%p)", this) @@ -328,10 +335,104 @@ EphyModalAlertEventListener::HandleEvent (nsIDOMEvent * aDOMEvent) return NS_OK; } +EphyContextMenuListener::EphyContextMenuListener() +: mOwner(nsnull) +{ + LOG ("EphyContextMenuListener ctor (%p)", this) +} + +EphyContextMenuListener::~EphyContextMenuListener() +{ + LOG ("EphyContextMenuListener dtor (%p)", this) +} + +NS_IMPL_ISUPPORTS1(EphyContextMenuListener, nsIDOMContextMenuListener) + +nsresult +EphyContextMenuListener::Init(EphyBrowser *aOwner) +{ + mOwner = aOwner; + return NS_OK; +} + +NS_IMETHODIMP +EphyContextMenuListener::ContextMenu (nsIDOMEvent* aDOMEvent) +{ + nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aDOMEvent); + NS_ENSURE_TRUE (mouseEvent, NS_ERROR_FAILURE); + + MozillaEmbedEvent *info; + info = mozilla_embed_event_new (NS_STATIC_CAST (gpointer, aDOMEvent)); + + nsresult rv; + EventContext context; + context.Init (mOwner); + rv = context.GetMouseEventInfo (mouseEvent, MOZILLA_EMBED_EVENT (info)); + + /* Don't do any magic handling if we can't actually show the context + * menu, this can happen for XUL pages (e.g. about:config) + */ + if (NS_FAILED (rv)) + { + g_object_unref (info); + return NS_OK; + } + + if (info->button == 0) + { + /* Translate relative coordinates to absolute values, and try + * to avoid covering links by adding a little offset + */ + int x, y; + gdk_window_get_origin (GTK_WIDGET (mOwner->mEmbed)->window, &x, &y); + info->x += x + 6; + info->y += y + 6; + + // Set the keycode to something sensible + info->keycode = nsIDOMKeyEvent::DOM_VK_CONTEXT_MENU; + } + + if (info->modifier == GDK_CONTROL_MASK) + { + info->context = EPHY_EMBED_CONTEXT_DOCUMENT; + } + + gboolean retval = FALSE; + nsCOMPtr<nsIDOMDocument> domDoc; + rv = context.GetTargetDocument (getter_AddRefs(domDoc)); + if (NS_SUCCEEDED(rv)) + { + mOwner->PushTargetDocument (domDoc); + + g_signal_emit_by_name (mOwner->mEmbed, "ge_context_menu", + info, &retval); + + mOwner->PopTargetDocument (); + } + + /* We handled the event, block javascript calls */ + if (retval) + { + aDOMEvent->PreventDefault(); + aDOMEvent->StopPropagation(); + } + + g_object_unref (info); + + return NS_OK; +} + +NS_IMETHODIMP +EphyContextMenuListener::HandleEvent (nsIDOMEvent* aDOMEvent) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + EphyBrowser::EphyBrowser () : mFaviconEventListener(nsnull) , mPopupBlockEventListener(nsnull) , mModalAlertListener(nsnull) +, mContextMenuListener(nsnull) , mInitialized(PR_FALSE) { LOG ("EphyBrowser ctor (%p)", this) @@ -379,6 +480,12 @@ nsresult EphyBrowser::Init (GtkMozEmbed *mozembed) rv = mModalAlertListener->Init (this); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + mContextMenuListener = new EphyContextMenuListener(); + if (!mContextMenuListener) return NS_ERROR_OUT_OF_MEMORY; + + rv = mContextMenuListener->Init (this); + NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); + rv = GetListener(); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); @@ -431,6 +538,8 @@ EphyBrowser::AttachListeners(void) mModalAlertListener, PR_TRUE); rv |= mEventTarget->AddEventListener(nsEmbedString(DOMModalDialogClosed), mModalAlertListener, PR_TRUE); + rv |= mEventTarget->AddEventListener(nsEmbedString(ContextMenu), + mContextMenuListener, PR_TRUE /* capture */); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); return NS_OK; @@ -450,6 +559,8 @@ EphyBrowser::DetachListeners(void) mModalAlertListener, PR_TRUE); rv |= mEventTarget->RemoveEventListener(nsEmbedString(DOMModalDialogClosed), mModalAlertListener, PR_TRUE); + rv |= mEventTarget->RemoveEventListener(nsEmbedString(ContextMenu), + mContextMenuListener, PR_TRUE /* capture */); NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); return NS_OK; diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h index 3b4f4ce06..4878dc412 100644 --- a/embed/mozilla/EphyBrowser.h +++ b/embed/mozilla/EphyBrowser.h @@ -29,6 +29,7 @@ #include <gtkmozembed.h> #include <nsCOMPtr.h> #include <nsIDOMEventListener.h> +#include <nsIDOMContextMenuListener.h> #include <nsIDOMEventTarget.h> #include <nsIWebNavigation.h> #include <nsISHistory.h> @@ -84,12 +85,32 @@ public: NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); }; +class EphyContextMenuListener : public nsIDOMContextMenuListener +{ +public: + NS_DECL_ISUPPORTS + + EphyContextMenuListener(); + virtual ~EphyContextMenuListener(); + + nsresult Init(EphyBrowser *aOwner); + + // nsIDOMContextMenuListener + + NS_IMETHOD ContextMenu(nsIDOMEvent *aEvent); + NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent); + +protected: + EphyBrowser *mOwner; +}; + class EphyBrowser { friend class EphyEventListener; friend class EphyFaviconEventListener; friend class EphyPopupBlockEventListener; friend class EphyModalAlertEventListener; +friend class EphyContextMenuListener; public: EphyBrowser(); ~EphyBrowser(); @@ -159,6 +180,7 @@ private: EphyFaviconEventListener *mFaviconEventListener; EphyPopupBlockEventListener *mPopupBlockEventListener; EphyModalAlertEventListener *mModalAlertListener; + EphyContextMenuListener *mContextMenuListener; PRBool mInitialized; #ifdef HAVE_MOZILLA_PSM nsCOMPtr<nsISecureBrowserUI> mSecurityInfo; diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 5b5db0638..2001cfc0f 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -572,38 +572,81 @@ nsresult EventContext::GetCSSBackground (nsIDOMNode *node, nsAString& url) return NS_OK; } +nsresult EventContext::GetTargetCoords (nsIDOMEventTarget *aTarget, PRInt32 *aX, PRInt32 *aY) +{ + /* Calculate the node coordinates relative to the widget origin */ + nsCOMPtr<nsIDOMNSHTMLElement> elem (do_QueryInterface(aTarget)); + + PRInt32 x = 0, y = 0; + while (elem) + { + PRInt32 val; + elem->GetOffsetTop(&val); y += val; + elem->GetScrollTop(&val); y -= val; + elem->GetOffsetLeft(&val); x += val; + elem->GetScrollLeft(&val); x -= val; + + nsCOMPtr<nsIDOMElement> parent; + elem->GetOffsetParent (getter_AddRefs (parent)); + elem = do_QueryInterface(parent); + } + + *aX = x; + *aY = y; + + return NS_OK; +} + nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, MozillaEmbedEvent *info) { /* FIXME: casting 32-bit guint* to PRUint16* below will break on big-endian */ - PRUint16 btn; + PRUint16 btn = 1729; aMouseEvent->GetButton (&btn); switch (btn) { + /* mozilla's button counting is one-off from gtk+'s */ case 0: - info->type = EPHY_EMBED_EVENT_MOUSE_BUTTON1; - break; + info->button = 1; + break; case 1: - info->type = EPHY_EMBED_EVENT_MOUSE_BUTTON2; - break; + info->button = 2; + break; case 2: - info->type = EPHY_EMBED_EVENT_MOUSE_BUTTON3; - break; + info->button = 3; + break; + +#ifdef MOZ_BROKEN_CTX_MENU_EVENT + case 1729: + /* This only appears to happen when getting a mouse context menu + * signal, so map it to button 3 (right mouse button) + * http://bugzilla.mozilla.org/show_bug.cgi?id=258193 */ + info->button = 3; + break; +#endif case (PRUint16) -1: /* when the user submits a form with Return, mozilla synthesises * a _mouse_ click event with btn=65535 (-1). */ - info->type = EPHY_EMBED_EVENT_KEY; + default: + info->button = 0; break; + } - default: - g_warning ("Unknown mouse button"); + if (info->button != 0) + { + /* OTOH, casting only between (un)signedness is safe */ + aMouseEvent->GetScreenX ((PRInt32*)&info->x); + aMouseEvent->GetScreenY ((PRInt32*)&info->y); } + else /* this is really a keyboard event */ + { + nsCOMPtr<nsIDOMEventTarget> eventTarget; + aMouseEvent->GetTarget (getter_AddRefs (eventTarget)); - /* OTOH, casting only between (un)signedness is safe */ - aMouseEvent->GetScreenX ((PRInt32*)&info->x); - aMouseEvent->GetScreenY ((PRInt32*)&info->y); + GetTargetCoords (eventTarget, (PRInt32*)&info->x, (PRInt32*)&info->y); + } /* be sure we are not clicking on the scroolbars */ @@ -661,10 +704,9 @@ nsresult EventContext::GetMouseEventInfo (nsIDOMMouseEvent *aMouseEvent, Mozilla nsresult EventContext::GetKeyEventInfo (nsIDOMKeyEvent *aKeyEvent, MozillaEmbedEvent *info) { - nsresult rv; - - info->type = EPHY_EMBED_EVENT_KEY; + info->button = 0; + nsresult rv; PRUint32 keyCode; rv = aKeyEvent->GetKeyCode(&keyCode); if (NS_FAILED(rv)) return rv; @@ -674,25 +716,7 @@ nsresult EventContext::GetKeyEventInfo (nsIDOMKeyEvent *aKeyEvent, MozillaEmbedE rv = aKeyEvent->GetTarget(getter_AddRefs(target)); if (NS_FAILED(rv) || !target) return NS_ERROR_FAILURE; - /* Calculate the node coordinates relative to the widget origin */ - nsCOMPtr<nsIDOMNSHTMLElement> elem = do_QueryInterface(target, &rv); - if (NS_FAILED(rv)) return rv; - - PRInt32 x = 0, y = 0; - while (elem) - { - PRInt32 val; - elem->GetOffsetTop(&val); y += val; - elem->GetScrollTop(&val); y -= val; - elem->GetOffsetLeft(&val); x += val; - elem->GetScrollLeft(&val); x -= val; - - nsCOMPtr<nsIDOMElement> parent; - elem->GetOffsetParent(getter_AddRefs(parent)); - elem = do_QueryInterface(parent, &rv); - } - info->x = x; - info->y = y; + GetTargetCoords (target, (PRInt32*)&info->x, (PRInt32*)&info->y); /* Context */ rv = GetEventContext (target, info); diff --git a/embed/mozilla/EventContext.h b/embed/mozilla/EventContext.h index 5a2564e3f..36d3faedb 100644 --- a/embed/mozilla/EventContext.h +++ b/embed/mozilla/EventContext.h @@ -26,6 +26,7 @@ #include "ephy-embed.h" #include "mozilla-embed-event.h" +#include <nsIDOMEventTarget.h> #include <nsIDOMMouseEvent.h> #include <nsIDOMKeyEvent.h> #include <nsIDOMEvent.h> @@ -51,6 +52,7 @@ private: MozillaEmbedEvent *mEmbedEvent; nsCOMPtr<nsIDOMDocument> mDOMDocument; + nsresult GetTargetCoords (nsIDOMEventTarget *aTarget, PRInt32 *aX, PRInt32 *aY); nsresult GatherTextUnder (nsIDOMNode* aNode, nsAString& aResult); nsresult ResolveBaseURL (const nsAString &relurl, nsACString &url); nsresult Unescape (const nsACString &aEscaped, nsACString &aUnescaped); diff --git a/embed/mozilla/mozilla-embed-event.cpp b/embed/mozilla/mozilla-embed-event.cpp index 6e37313d4..685fa6f6a 100644 --- a/embed/mozilla/mozilla-embed-event.cpp +++ b/embed/mozilla/mozilla-embed-event.cpp @@ -35,9 +35,9 @@ #define MOZILLA_EMBED_EVENT_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), MOZILLA_TYPE_EMBED_EVENT, MozillaEmbedEventPrivate)) -struct MozillaEmbedEventPrivate +struct _MozillaEmbedEventPrivate { - nsCOMPtr<nsIDOMEvent> dom_event; + nsIDOMEvent* dom_event; GHashTable *props; }; @@ -94,6 +94,7 @@ mozilla_embed_event_new (gpointer dom_event) event = MOZILLA_EMBED_EVENT (g_object_new (MOZILLA_TYPE_EMBED_EVENT, NULL)); event->priv->dom_event = static_cast<nsIDOMEvent*>(dom_event); + NS_IF_ADDREF (event->priv->dom_event); return event; } @@ -112,12 +113,6 @@ mozilla_embed_event_set_property (MozillaEmbedEvent *event, value); } -static EphyEmbedEventType -impl_get_type (EphyEmbedEvent *event) -{ - return ((MozillaEmbedEvent *) event)->type; -} - static EphyEmbedEventContext impl_get_context (EphyEmbedEvent *event) { @@ -125,6 +120,12 @@ impl_get_context (EphyEmbedEvent *event) } static guint +impl_get_button (EphyEmbedEvent *event) +{ + return ((MozillaEmbedEvent *) event)->button; +} + +static guint impl_get_modifier (EphyEmbedEvent *event) { return ((MozillaEmbedEvent *) event)->modifier; @@ -190,6 +191,7 @@ mozilla_embed_event_finalize (GObject *object) g_hash_table_destroy (event->priv->props); + NS_IF_RELEASE (event->priv->dom_event); event->priv->dom_event = nsnull; LOG ("MozillaEmbedEvent %p finalised", object) @@ -200,8 +202,8 @@ mozilla_embed_event_finalize (GObject *object) static void ephy_embed_event_iface_init (EphyEmbedEventIface *iface) { - iface->get_type = impl_get_type; iface->get_context = impl_get_context; + iface->get_button = impl_get_button; iface->get_modifier = impl_get_modifier; iface->get_coordinates = impl_get_coordinates; iface->get_property = impl_get_property; diff --git a/embed/mozilla/mozilla-embed-event.h b/embed/mozilla/mozilla-embed-event.h index b3be2a557..79499e215 100644 --- a/embed/mozilla/mozilla-embed-event.h +++ b/embed/mozilla/mozilla-embed-event.h @@ -36,16 +36,16 @@ G_BEGIN_DECLS #define MOZILLA_IS_EMBED_EVENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MOZILLA_TYPE_EMBED_EVENT)) #define MOZILLA_EMBED_EVENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MOZILLA_TYPE_EMBED_EVENT, MozillaEmbedEventClass)) -typedef struct MozillaEmbedEventClass MozillaEmbedEventClass; -typedef struct MozillaEmbedEvent MozillaEmbedEvent; -typedef struct MozillaEmbedEventPrivate MozillaEmbedEventPrivate; +typedef struct _MozillaEmbedEventClass MozillaEmbedEventClass; +typedef struct _MozillaEmbedEvent MozillaEmbedEvent; +typedef struct _MozillaEmbedEventPrivate MozillaEmbedEventPrivate; -struct MozillaEmbedEventClass +struct _MozillaEmbedEventClass { GObjectClass parent_class; }; -struct MozillaEmbedEvent +struct _MozillaEmbedEvent { GObject parent; @@ -53,7 +53,7 @@ struct MozillaEmbedEvent MozillaEmbedEventPrivate *priv; /*< private >*/ /* public to the embed implementation */ - EphyEmbedEventType type; + guint button; guint context; guint modifier; guint x; diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp index 7d6681fb4..41c6ac6ac 100644 --- a/embed/mozilla/mozilla-embed.cpp +++ b/embed/mozilla/mozilla-embed.cpp @@ -57,9 +57,6 @@ static void mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, gint state, guint status, MozillaEmbed *membed); -static gint mozilla_embed_dom_key_down_cb (GtkMozEmbed *embed, - gpointer dom_event, - MozillaEmbed *membed); static gint mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event, MozillaEmbed *membed); @@ -279,9 +276,6 @@ mozilla_embed_init (MozillaEmbed *embed) g_signal_connect_object (G_OBJECT (embed), "security_change", G_CALLBACK (mozilla_embed_security_change_cb), embed, (GConnectFlags) 0); - g_signal_connect_object (G_OBJECT (embed), "dom_key_down", - G_CALLBACK (mozilla_embed_dom_key_down_cb), - embed, (GConnectFlags) 0); } gpointer @@ -871,71 +865,6 @@ mozilla_embed_net_state_all_cb (GtkMozEmbed *embed, const char *aURI, } static gint -mozilla_embed_dom_key_down_cb (GtkMozEmbed *embed, gpointer dom_event, - MozillaEmbed *membed) -{ - MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; - - if (dom_event == NULL) - { - g_warning ("mozilla_embed_dom_key_down_cb: domevent NULL"); - return FALSE; - } - - nsCOMPtr<nsIDOMKeyEvent> ev = static_cast<nsIDOMKeyEvent*>(dom_event); - NS_ENSURE_TRUE (ev, FALSE); - nsCOMPtr<nsIDOMEvent> dev = do_QueryInterface (ev); - NS_ENSURE_TRUE (dev, FALSE); - - MozillaEmbedEvent *info; - info = mozilla_embed_event_new (NS_STATIC_CAST (gpointer, dev)); - - gboolean ret = FALSE; - - nsresult rv; - EventContext ctx; - ctx.Init (mpriv->browser); - rv = ctx.GetKeyEventInfo (ev, info); - if (NS_FAILED (rv)) return ret; - - if ((info->keycode == nsIDOMKeyEvent::DOM_VK_F10 && - (info->modifier == GDK_SHIFT_MASK || - info->modifier == GDK_CONTROL_MASK)) - || (info->keycode == nsIDOMKeyEvent::DOM_VK_CONTEXT_MENU && - !info->modifier) - ) - { - /* Translate relative coordinates to absolute values, and try - to avoid covering links by adding a little offset. */ - - int x, y; - gdk_window_get_origin (GTK_WIDGET(membed)->window, &x, &y); - info->x += x + 6; - info->y += y + 6; - - if (info->modifier == GDK_CONTROL_MASK) - { - info->context = EPHY_EMBED_CONTEXT_DOCUMENT; - } - - nsCOMPtr<nsIDOMDocument> doc; - rv = ctx.GetTargetDocument (getter_AddRefs(doc)); - if (NS_SUCCEEDED(rv)) - { - rv = mpriv->browser->PushTargetDocument (doc); - if (NS_SUCCEEDED(rv)) - { - g_signal_emit_by_name (membed, "ge_context_menu", info, &ret); - mpriv->browser->PopTargetDocument (); - } - } - } - - g_object_unref (info); - return ret; -} - -static gint mozilla_embed_dom_mouse_click_cb (GtkMozEmbed *embed, gpointer dom_event, MozillaEmbed *membed) { @@ -991,7 +920,6 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event, EventContext event_context; gint return_value = FALSE; nsresult rv; - EphyEmbedEventType type; MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv; if (dom_event == NULL) @@ -1011,28 +939,16 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event, rv = event_context.GetMouseEventInfo (ev, MOZILLA_EMBED_EVENT (info)); if (NS_FAILED (rv)) return FALSE; - type = ephy_embed_event_get_event_type ((EphyEmbedEvent *) info); - nsCOMPtr<nsIDOMDocument> domDoc; rv = event_context.GetTargetDocument (getter_AddRefs(domDoc)); if (NS_SUCCEEDED (rv)) { - rv = mpriv->browser->PushTargetDocument (domDoc); + mpriv->browser->PushTargetDocument (domDoc); - if (NS_SUCCEEDED (rv)) - { - g_signal_emit_by_name (membed, "ge_dom_mouse_down", - info, &return_value); + g_signal_emit_by_name (membed, "ge_dom_mouse_down", + info, &return_value); - if (return_value == FALSE && - type == EPHY_EMBED_EVENT_MOUSE_BUTTON3) - { - g_signal_emit_by_name (membed, "ge_context_menu", - info, &return_value); - } - - mpriv->browser->PopTargetDocument (); - } + mpriv->browser->PopTargetDocument (); } g_object_unref (info); |