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/mozilla-embed.cpp | |
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/mozilla-embed.cpp')
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 92 |
1 files changed, 4 insertions, 88 deletions
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); |