diff options
author | Simon Schampijer <simon@schampijer.de> | 2011-06-20 08:41:09 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2011-06-20 08:41:09 (GMT) |
commit | 8037530273cc6c64d5e940950f69772d8af54b51 (patch) | |
tree | b3be1e816d4508ebabe68ac82037510489ad52f9 | |
parent | 98ad10e1f29c99ebf6b3dcc054de950e0fe06c32 (diff) |
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.
-rw-r--r-- | src/hulahop-web-view.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
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<nsIWebBrowserFocus> 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); } |