aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/mozilla-embed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla/mozilla-embed.cpp')
-rw-r--r--embed/mozilla/mozilla-embed.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 1d87d77ab..e9fc2aab9 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -64,6 +64,9 @@ static gboolean mozilla_embed_dom_mouse_click_cb(GtkMozEmbed *embed,
static gboolean mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed,
gpointer dom_event,
MozillaEmbed *membed);
+static gboolean mozilla_embed_dom_key_press_cb (GtkMozEmbed *embed,
+ gpointer dom_event,
+ MozillaEmbed *membed);
static void mozilla_embed_new_window_cb (GtkMozEmbed *embed,
GtkMozEmbed **newEmbed,
guint chrome_mask,
@@ -242,6 +245,9 @@ mozilla_embed_init (MozillaEmbed *embed)
g_signal_connect_object (G_OBJECT (embed), "dom_mouse_down",
G_CALLBACK (mozilla_embed_dom_mouse_down_cb),
embed, (GConnectFlags) 0);
+ g_signal_connect_object (G_OBJECT (embed), "dom-key-press",
+ G_CALLBACK (mozilla_embed_dom_key_press_cb),
+ embed, (GConnectFlags) 0);
g_signal_connect_object (G_OBJECT (embed), "new_window",
G_CALLBACK (mozilla_embed_new_window_cb),
embed, (GConnectFlags) 0);
@@ -910,6 +916,33 @@ mozilla_embed_dom_mouse_down_cb (GtkMozEmbed *embed, gpointer dom_event,
"ge_dom_mouse_down");
}
+static gint
+mozilla_embed_dom_key_press_cb (GtkMozEmbed *embed,
+ gpointer dom_event,
+ MozillaEmbed *membed)
+{
+ MozillaEmbedPrivate *mpriv = membed->priv;
+ gint retval = FALSE;
+
+ if (dom_event == NULL) return FALSE;
+
+ nsCOMPtr<nsIDOMKeyEvent> ev = static_cast<nsIDOMKeyEvent*>(dom_event);
+ NS_ENSURE_TRUE (ev, FALSE);
+
+ if (!EventContext::CheckKeyPress (ev)) return FALSE;
+
+ GdkEvent *event = gtk_get_current_event ();
+ if (event == NULL) return FALSE; /* shouldn't happen! */
+
+ g_return_val_if_fail (GDK_KEY_PRESS == event->type, FALSE);
+
+ g_signal_emit_by_name (embed, "ge-search-key-press", event, &retval);
+
+ gdk_event_free (event);
+
+ return retval;
+}
+
EphyEmbedChrome
_mozilla_embed_translate_chrome (GtkMozEmbedChromeFlags flags)
{