forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCEF-GTK-patch.txt
More file actions
56 lines (48 loc) · 2.5 KB
/
CEF-GTK-patch.txt
File metadata and controls
56 lines (48 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
See this topic on the CEF C++ forum for more details:
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10641
Do the following changes in the CEF C++ sources:
1. In `chromium/src/cef/libcef/browser/browser_host_impl_gtk.cc`:
At the end of the CefBrowserHostImpl::PlatformCreateWindow() function,
before the return statement add the following code:
gtk_widget_show_all(GTK_WIDGET(window_info_.widget));
In the same function replace this code:
gtk_container_add(GTK_CONTAINER(window_info_.parent_widget),
window_info_.widget);
With the following code:
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);
}