Ticket #10623: handle-button-press-event.patch

File handle-button-press-event.patch, 1.9 KB (added by dsd, 4 years ago)

hulahop patch

  • src/hulahop-web-view.cpp

    old new child_focus_out_cb(GtkWidget *widge 
    8181    return FALSE; 
    8282} 
    8383 
     84static gboolean 
     85child_button_press_cb(GtkWidget      *widget, 
     86                      GdkEventFocus  *event, 
     87                      HulahopWebView *web_view) 
     88{ 
     89    nsCOMPtr<nsIWebBrowserFocus> webBrowserFocus; 
     90    webBrowserFocus = do_QueryInterface(web_view->browser); 
     91    NS_ENSURE_TRUE(webBrowserFocus, FALSE); 
     92 
     93    webBrowserFocus->Activate(); 
     94 
     95    return FALSE; 
     96} 
     97 
    8498static void 
    8599hulahop_web_view_unrealize(GtkWidget *widget) 
    86100{ 
    hulahop_web_view_realize(GtkWidget *widg 
    142156                            "focus-out-event", 
    143157                            G_CALLBACK(child_focus_out_cb), 
    144158                            web_view, (GConnectFlags)0); 
     159 
     160    /* 
     161     * xulrunner-1.9.2 doesn't like receiving click events on text inputs 
     162     * without being told that it has been focused first. However, GTK+ 
     163     * sends button-press-event before focus-in-event, so we must use 
     164     * button-press-event to tell mozilla that it has been given focus. 
     165     * 
     166     * Ordinarily, mozilla would not let us bind to button_press_event here 
     167     * because it has it's own handler which stops emission of the signal 
     168     * (our handler would simply not be called). This workaround will only 
     169     * come into effect with a patched xulrunner at time of writing. 
     170     * 
     171     * See https://bugzilla.mozilla.org/show_bug.cgi?id=533245 
     172     */ 
     173    g_signal_connect_object(web_view->mozilla_widget, 
     174                            "button-press-event", 
     175                            G_CALLBACK(child_button_press_cb), 
     176                            web_view, (GConnectFlags)0); 
    145177} 
    146178 
    147179static void