Skip to content

Commit 98cefb7

Browse files
CzarekCzarek
authored andcommitted
Linux CEF 3 port underway.
1 parent 0350c4f commit 98cefb7

3 files changed

Lines changed: 66 additions & 4 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Chromium/CEF branch:
2-
1364
2+
1453
33
Chromium release url:
4-
http://src.chromium.org/svn/releases/25.0.1364.68
4+
http://src.chromium.org/svn/releases/27.0.1453.110
55
CEF revision:
6-
1094
6+
1279
77
CEF repository url:
8-
http://chromiumembedded.googlecode.com/svn/branches/1364/cef3@1094
8+
http://chromiumembedded.googlecode.com/svn/branches/1453/cef3@1279
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
See this topic on the CEF C++ forum for more details:
2+
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10641
3+
4+
Do the following changes in the CEF C++ sources:
5+
6+
1. In `chromium/src/cef/libcef/browser/browser_host_impl_gtk.cc`:
7+
8+
At the end of the CefBrowserImpl::UIT_CreateBrowser() function,
9+
before the return statement add the following code:
10+
11+
gtk_widget_show_all(GTK_WIDGET(window_info_.widget));
12+
13+
2. In `chromium/src/cef/libcef/webwidget_host_gtk.cc`:
14+
15+
In WebWidgetHostGtkWidget::CreateNewWidget() function replace this line:
16+
17+
gtk_box_pack_start(GTK_BOX(parent_view), widget, TRUE, TRUE, 0);
18+
19+
With the following code:
20+
21+
if (GTK_IS_BOX(parent_view)) {
22+
gtk_box_pack_start(GTK_BOX(parent_view), widget, TRUE, TRUE, 0);
23+
} else {
24+
// Parent view shouldn't contain any children, but in wxWidgets library
25+
// there will be GtkPizza widget for Panel or any other control.
26+
GList *children, *iter;
27+
children = gtk_container_get_children(GTK_CONTAINER(parent_view));
28+
GtkWidget* child = NULL;
29+
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
30+
for (iter = children; iter != NULL; iter = g_list_next(iter)) {
31+
child = GTK_WIDGET(iter->data);
32+
// We will have to keep a reference to that child that we remove,
33+
// otherwise we will get lots of warnings like "invalid unclassed
34+
// pointer in cast to `GtkPizza'". First we increase a reference,
35+
// we need to do this for a moment before we add this child to the
36+
// vbox, then we will decrease that reference.
37+
g_object_ref(G_OBJECT(child));
38+
gtk_container_remove(GTK_CONTAINER(parent_view), child);
39+
}
40+
g_list_free(children);
41+
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
42+
if (child != NULL) {
43+
// This child is packed to the box only so that its reference lives,
44+
// as it might be referenced from other code thus resulting in errors.
45+
gtk_box_pack_end(GTK_BOX(vbox), child, FALSE, FALSE, 0);
46+
gtk_widget_hide(GTK_WIDGET(child));
47+
g_object_unref(G_OBJECT(child));
48+
}
49+
gtk_widget_show(GTK_WIDGET(vbox));
50+
if (GTK_IS_SCROLLED_WINDOW(parent_view))
51+
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(parent_view), vbox);
52+
else
53+
gtk_container_add(GTK_CONTAINER(parent_view), vbox);
54+
}

cefpython/cefpython.pyx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
# - Supporting operators that are not yet supported:
4747
# | CefRefPtr[T]& Assign "operator="(T* p)
4848
# | cefBrowser.Assign(CefBrowser*)
49+
#
50+
# - Declaring C++ classes in Cython. Storing python callbacks
51+
# in a C++ class using Py_INCREF, Py_DECREF. Calling from
52+
# C++ using PyObject_CallMethod.
53+
# | http://stackoverflow.com/a/17070382/623622
54+
# Disadvantage: when calling python callback from the C++ class
55+
# declared in Cython there is no easy way to propagate the python
56+
# exceptions when they occur during execution of the callback.
4957

5058
# Global variables.
5159

0 commit comments

Comments
 (0)