77Requires PySDL2 and SDL2 libraries.
88
99Tested configurations:
10+ - Windows 7: SDL 2.0.7 and PySDL2 0.9.6
1011- Fedora 25: SDL2 2.0.5 with PySDL2 0.9.3
1112- Ubuntu 14.04: SDL2 with PySDL2 0.9.6
1213
1314Install instructions:
14151. Install SDL libraries for your OS, e.g:
16+ - Windows: Download SDL2.dll from http://www.libsdl.org/download-2.0.php
17+ and put SDL2.dll in C:\Python27\ (where you've installed Python)
1518 - Fedora: sudo dnf install SDL2 SDL2_ttf SDL2_image SDL2_gfx SDL2_mixer
1619 - Ubuntu: sudo apt-get install libsdl2-dev
17202. Install PySDL2 using pip package manager:
1821 pip install PySDL2
1922
2023Missing functionality:
24+ - Performance is still not perfect, see Issue #379 for further details
2125- Keyboard modifiers that are not yet handled in this example:
2226 ctrl, marking text inputs with the shift key.
2327- Mouse dragging
@@ -69,10 +73,23 @@ def main():
6973 browserHeight = height - headerHeight
7074 browserWidth = width
7175 # Mouse wheel fudge to enhance scrolling
72- scrollEnhance = 20
76+ scrollEnhance = 40
7377 # Initialise CEF for offscreen rendering
7478 sys .excepthook = cef .ExceptHook
75- cef .Initialize (settings = {"windowless_rendering_enabled" : True })
79+ switches = {
80+ # Tweaking OSR performance by setting the same Chromium flags
81+ # as in upstream cefclient (Issue #240).
82+ "disable-surfaces" : "" ,
83+ "disable-gpu" : "" ,
84+ "disable-gpu-compositing" : "" ,
85+ "enable-begin-frame-scheduling" : "" ,
86+ }
87+ browser_settings = {
88+ # Tweaking OSR performance (Issue #240)
89+ "windowless_frame_rate" : 100
90+ }
91+ cef .Initialize (settings = {"windowless_rendering_enabled" : True },
92+ switches = switches )
7693 window_info = cef .WindowInfo ()
7794 window_info .SetAsOffscreen (0 )
7895 # Initialise SDL2 for video (add other init constants if you
@@ -96,7 +113,9 @@ def main():
96113 # Set-up the RenderHandler, passing in the SDL2 renderer
97114 renderHandler = RenderHandler (renderer , width , height - headerHeight )
98115 # Create the browser instance
99- browser = cef .CreateBrowserSync (window_info , url = "https://www.google.com/" )
116+ browser = cef .CreateBrowserSync (window_info ,
117+ url = "https://www.google.com/" ,
118+ settings = browser_settings )
100119 browser .SetClientHandler (LoadHandler ())
101120 browser .SetClientHandler (renderHandler )
102121 # Must call WasResized at least once to let know CEF that
0 commit comments