Page 1 of 1

CEF views and CreateBrowserSync

PostPosted: Sat Mar 25, 2017 4:47 am
by Czarek
I am trying to integrate CEF views with my existing code. I have a hello world example in cefpython that doesn't depend on any third party GUI framework and calls CefWindowInfo.SetAsChild(0) so that CEF creates a top-level window. However that window has no title, so I wanted to use CEF views to set title. However I can't get it to work, I get a blank window, browser loads fine, but is not shown. Here is my code:

Code: Select all
cef_window = CefWindow::CreateTopLevelWindow()
window_info->SetAsChild(cef_window->GetWindowHandle())


Tried calling SetBounds, Layout and SetToFillLayout without success.

I see that there is CefBrowserView::CreateBrowserView() method, however it creates browser asynchronously and I want to integrate with existing code that expects synchronous browser creation.

Update:
I printed CefBrowser window handle and then executed:
Code: Select all
xdotool windowraise 65011770

And then I see browser just fine.

CEF branch 2924.
OS: Ubuntu 14.04

Re: CEF views and CreateBrowserSync

PostPosted: Sat Mar 25, 2017 10:37 am
by magreenblatt
You must use CreateBrowserView with views. See example usage in cefclient or cefsimple.

Re: CEF views and CreateBrowserSync

PostPosted: Sat Mar 25, 2017 11:28 am
by Czarek
Thanks. I ended up calling native Cocoa/X11 functions to set title. On Windows SetAsPopup() already supports setting title.