Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-06-14 21:05:25 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-06-14 21:05:25 (GMT)
commite81506ffe3645fcd3b36704345aafa9bae684fe3 (patch)
tree017969435ca9b797f88f4a7c9429494db79cec7c
parent5cb27465d095f7de7efe1d1c012eb5c7356ac636 (diff)
Handle button press event, part of OLPC #10623 (Daniel Drake)
-rw-r--r--src/hulahop-web-view.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/hulahop-web-view.cpp b/src/hulahop-web-view.cpp
index 9104b20..d51401c 100644
--- a/src/hulahop-web-view.cpp
+++ b/src/hulahop-web-view.cpp
@@ -81,6 +81,20 @@ child_focus_out_cb(GtkWidget *widget,
return FALSE;
}
+static gboolean
+child_button_press_cb(GtkWidget *widget,
+ GdkEventFocus *event,
+ HulahopWebView *web_view)
+{
+ nsCOMPtr<nsIWebBrowserFocus> webBrowserFocus;
+ webBrowserFocus = do_QueryInterface(web_view->browser);
+ NS_ENSURE_TRUE(webBrowserFocus, FALSE);
+
+ webBrowserFocus->Activate();
+
+ return FALSE;
+}
+
static void
hulahop_web_view_unrealize(GtkWidget *widget)
{
@@ -142,6 +156,24 @@ hulahop_web_view_realize(GtkWidget *widget)
"focus-out-event",
G_CALLBACK(child_focus_out_cb),
web_view, (GConnectFlags)0);
+
+ /*
+ * xulrunner-1.9.2 doesn't like receiving click events on text inputs
+ * without being told that it has been focused first. However, GTK+
+ * sends button-press-event before focus-in-event, so we must use
+ * button-press-event to tell mozilla that it has been given focus.
+ *
+ * Ordinarily, mozilla would not let us bind to button_press_event here
+ * because it has it's own handler which stops emission of the signal
+ * (our handler would simply not be called). This workaround will only
+ * come into effect with a patched xulrunner at time of writing.
+ *
+ * See https://bugzilla.mozilla.org/show_bug.cgi?id=533245
+ */
+ g_signal_connect_object(web_view->mozilla_widget,
+ "button-press-event",
+ G_CALLBACK(child_button_press_cb),
+ web_view, (GConnectFlags)0);
}
static void