@@ -384,7 +384,7 @@ cdef extern from *:
384384# cannot cimport *, that would cause name conflicts with constants
385385# noinspection PyUnresolvedReferences
386386from cef_types cimport (
387- CefSettings, CefBrowserSettings, CefRect, CefPoint,
387+ CefSettings, CefBrowserSettings, CefRect, CefSize, CefPoint,
388388 CefKeyEvent, CefMouseEvent, CefScreenInfo,
389389 PathKey, PK_DIR_EXE, PK_DIR_MODULE,
390390 int32, uint32, int64, uint64,
@@ -433,6 +433,8 @@ from cef_path_util cimport *
433433from cef_drag_data cimport *
434434from cef_image cimport *
435435from main_message_loop cimport *
436+ # noinspection PyUnresolvedReferences
437+ from cef_views cimport *
436438
437439# -----------------------------------------------------------------------------
438440# GLOBAL VARIABLES
@@ -775,6 +777,46 @@ def CreateBrowserSync(windowInfo=None,
775777 assert IsThread(TID_UI), (
776778 " cefpython.CreateBrowserSync() may only be called on the UI thread" )
777779
780+ """
781+ # CEF views
782+ # noinspection PyUnresolvedReferences
783+ cdef CefRefPtr[CefWindow] cef_window
784+ # noinspection PyUnresolvedReferences
785+ cdef CefRefPtr[CefBoxLayout] cef_box_layout
786+ cdef CefBoxLayoutSettings cef_box_layout_settings
787+ cdef CefRefPtr[CefPanel] cef_panel
788+ if not windowInfo and browserSettings \
789+ and "window_title" in browserSettings:
790+ # noinspection PyUnresolvedReferences
791+ cef_window = CefWindow.CreateTopLevelWindow(
792+ <CefRefPtr[CefWindowDelegate]?>NULL)
793+ Debug("CefWindow.GetChildViewCount = "
794+ +str(cef_window.get().GetChildViewCount()))
795+
796+ cef_window.get().CenterWindow(CefSize(800, 600))
797+ cef_window.get().SetBounds(CefRect(0, 0, 800, 600))
798+ # noinspection PyUnresolvedReferences
799+ #cef_box_layout = cef_window.get().SetToBoxLayout(
800+ # cef_box_layout_settings)
801+ #cef_box_layout.get().SetFlexForView(cef_window, 1)
802+ cef_window.get().SetToFillLayout()
803+ # noinspection PyUnresolvedReferences
804+ cef_panel = CefPanel.CreatePanel(<CefRefPtr[CefPanelDelegate]?>NULL)
805+ cef_window.get().AddChildView(cef_panel)
806+ cef_window.get().Layout()
807+ cef_window.get().SetVisible(True)
808+ cef_window.get().Show()
809+ cef_window.get().RequestFocus()
810+ windowInfo = WindowInfo()
811+ windowInfo.SetAsChild(cef_window.get().GetWindowHandle())
812+ Debug("CefWindow handle = "+str(cef_window.get().GetWindowHandle()))
813+ """
814+
815+ # Only title was set in hello_world.py example
816+ if windowInfo and not windowInfo.windowType:
817+ windowInfo.SetAsChild(0 )
818+
819+ # No window info provided
778820 if not windowInfo:
779821 windowInfo = WindowInfo()
780822 windowInfo.SetAsChild(0 )
@@ -831,6 +873,9 @@ def CreateBrowserSync(windowInfo=None,
831873 else :
832874 Debug(" CefBrowser::CreateBrowserSync() succeeded" )
833875
876+ Debug(" CefBrowser window handle = "
877+ + str (cefBrowser.get().GetHost().get().GetWindowHandle()))
878+
834879 # Request context - part 2/2.
835880 if g_applicationSettings[" unique_request_context_per_browser" ]:
836881 requestContextHandler.get().SetBrowser(cefBrowser)
@@ -842,6 +887,21 @@ def CreateBrowserSync(windowInfo=None,
842887 pyBrowser.SetUserData(" __outerWindowHandle" ,
843888 int (windowInfo.parentWindowHandle))
844889
890+ """
891+ if cef_window.get():
892+ cef_window.get().ReorderChildView(cef_panel, -1)
893+ cef_window.get().Layout()
894+ cef_window.get().Show()
895+ cef_window.get().RequestFocus()
896+ """
897+
898+ if windowInfo.parentWindowHandle == 0 and windowInfo.windowType == " child" :
899+ # Set window title in hello_world.py example
900+ IF UNAME_SYSNAME == " Linux" :
901+ pass
902+ ELIF UNAME_SYSNAME == " Darwin" :
903+ pass
904+
845905 return pyBrowser
846906
847907def MessageLoop ():
0 commit comments