From 8037530273cc6c64d5e940950f69772d8af54b51 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Mon, 20 Jun 2011 08:41:09 +0000 Subject: Use "event" signal to work around Mozilla focus issue (Daniel Drake) Commit e81506ffe3645fcd3b36704345aafa9bae684fe3 works around a Mozilla focus issue but relies on a small change to the Mozilla codebase. As suggested at https://bugzilla.mozilla.org/show_bug.cgi?id=533245#c19 here is an alternative workaround which does not require any changes to the Mozilla code. --- diff --git a/src/hulahop-web-view.cpp b/src/hulahop-web-view.cpp index f13dc52..8b28094 100644 --- a/src/hulahop-web-view.cpp +++ b/src/hulahop-web-view.cpp @@ -82,10 +82,13 @@ child_focus_out_cb(GtkWidget *widget, } static gboolean -child_button_press_cb(GtkWidget *widget, - GdkEventFocus *event, - HulahopWebView *web_view) +child_event_cb(GtkWidget *widget, + GdkEvent *event, + HulahopWebView *web_view) { + if (event->type != GDK_BUTTON_PRESS) + return FALSE; + nsCOMPtr webBrowserFocus; webBrowserFocus = do_QueryInterface(web_view->browser); NS_ENSURE_TRUE(webBrowserFocus, FALSE); @@ -163,16 +166,16 @@ hulahop_web_view_realize(GtkWidget *widget) * 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. + * Mozilla does 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). So, we catch the relevant event via the earlier + * "event" signal. * * 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), + "event", + G_CALLBACK(child_event_cb), web_view, (GConnectFlags)0); } -- cgit v0.9.1