1+ Index: libcef/browser/browser_host_impl_gtk.cc
2+ ===================================================================
3+ --- browser_host_impl_gtk.cc (revision 1639)
4+ +++ browser_host_impl_gtk.cc (working copy)
5+ @@ -273,8 +273,43 @@
6+
7+ // Parent the TabContents to the browser window.
8+ window_info_.widget = web_contents_->GetView()->GetNativeView();
9+ - gtk_container_add(GTK_CONTAINER(window_info_.parent_widget),
10+ - window_info_.widget);
11+ + if (GTK_IS_BOX(window_info_.parent_widget)) {
12+ + gtk_box_pack_start(GTK_BOX(window_info_.parent_widget),
13+ + window_info_.widget, TRUE, TRUE, 0);
14+ + } else {
15+ + // Parent view shouldn't contain any children, but in wxWidgets library
16+ + // there will be GtkPizza widget for Panel or any other control.
17+ + GList *children, *iter;
18+ + children = gtk_container_get_children(GTK_CONTAINER(
19+ + window_info_.parent_widget));
20+ + GtkWidget* child = NULL;
21+ + GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
22+ + for (iter = children; iter != NULL; iter = g_list_next(iter)) {
23+ + child = GTK_WIDGET(iter->data);
24+ + // We will have to keep a reference to that child that we remove,
25+ + // otherwise we will get lots of warnings like "invalid unclassed
26+ + // pointer in cast to `GtkPizza'". First we increase a reference,
27+ + // we need to do this for a moment before we add this child to the
28+ + // vbox, then we will decrease that reference.
29+ + g_object_ref(G_OBJECT(child));
30+ + gtk_container_remove(GTK_CONTAINER(window_info_.parent_widget), child);
31+ + }
32+ + g_list_free(children);
33+ + gtk_box_pack_start(GTK_BOX(vbox), window_info_.widget, TRUE, TRUE, 0);
34+ + if (child != NULL) {
35+ + // This child is packed to the box only so that its reference lives,
36+ + // as it might be referenced from other code thus resulting in errors.
37+ + gtk_box_pack_end(GTK_BOX(vbox), child, FALSE, FALSE, 0);
38+ + gtk_widget_hide(GTK_WIDGET(child));
39+ + g_object_unref(G_OBJECT(child));
40+ + }
41+ + gtk_widget_show(GTK_WIDGET(vbox));
42+ + if (GTK_IS_SCROLLED_WINDOW(window_info_.parent_widget))
43+ + gtk_scrolled_window_add_with_viewport(
44+ + GTK_SCROLLED_WINDOW(window_info_.parent_widget), vbox);
45+ + else
46+ + gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), vbox);
47+ + }
48+
49+ g_signal_connect(G_OBJECT(window_info_.widget), "destroy",
50+ G_CALLBACK(browser_destroy), this);
51+ @@ -293,6 +328,8 @@
52+ prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200);
53+ prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50);
54+
55+ + gtk_widget_show_all(GTK_WIDGET(window_info_.widget));
56+ +
57+ return true;
58+ }
0 commit comments