Index: libcef/browser/browser_host_impl_gtk.cc =================================================================== --- browser_host_impl_gtk.cc (revision 1639) +++ browser_host_impl_gtk.cc (working copy) @@ -273,8 +273,43 @@ // Parent the TabContents to the browser window. window_info_.widget = web_contents_->GetView()->GetNativeView(); - gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), - window_info_.widget); + if (GTK_IS_BOX(window_info_.parent_widget)) { + gtk_box_pack_start(GTK_BOX(window_info_.parent_widget), + window_info_.widget, TRUE, TRUE, 0); + } else { + // Parent view shouldn't contain any children, but in wxWidgets library + // there will be GtkPizza widget for Panel or any other control. + GList *children, *iter; + children = gtk_container_get_children(GTK_CONTAINER( + window_info_.parent_widget)); + GtkWidget* child = NULL; + GtkWidget* vbox = gtk_vbox_new(FALSE, 0); + for (iter = children; iter != NULL; iter = g_list_next(iter)) { + child = GTK_WIDGET(iter->data); + // We will have to keep a reference to that child that we remove, + // otherwise we will get lots of warnings like "invalid unclassed + // pointer in cast to `GtkPizza'". First we increase a reference, + // we need to do this for a moment before we add this child to the + // vbox, then we will decrease that reference. + g_object_ref(G_OBJECT(child)); + gtk_container_remove(GTK_CONTAINER(window_info_.parent_widget), child); + } + g_list_free(children); + gtk_box_pack_start(GTK_BOX(vbox), window_info_.widget, TRUE, TRUE, 0); + if (child != NULL) { + // This child is packed to the box only so that its reference lives, + // as it might be referenced from other code thus resulting in errors. + gtk_box_pack_end(GTK_BOX(vbox), child, FALSE, FALSE, 0); + gtk_widget_hide(GTK_WIDGET(child)); + g_object_unref(G_OBJECT(child)); + } + gtk_widget_show(GTK_WIDGET(vbox)); + if (GTK_IS_SCROLLED_WINDOW(window_info_.parent_widget)) + gtk_scrolled_window_add_with_viewport( + GTK_SCROLLED_WINDOW(window_info_.parent_widget), vbox); + else + gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), vbox); + } g_signal_connect(G_OBJECT(window_info_.widget), "destroy", G_CALLBACK(browser_destroy), this); @@ -293,6 +328,8 @@ prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200); prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50); + gtk_widget_show_all(GTK_WIDGET(window_info_.widget)); + return true; }