Hi,
But I have no other place to ask a question about updating CefPython so please bear with me.
I tried to `cefpython91` branch from the mentioned fork and managed to make it mostly work on my Linux/Python 3.10 environment.
However, when I try to run it in offscreen rendering mode, it either never invoke OnPaint callback or opening up actual browser window.
Below is the minimal example that reproduces the problem:
############################################
from cefpython3 import cefpython as cef
import sys
class
RenderHandler:
def
GetViewRect(self, rect_out, **_) ->
bool:
print("#### GetViewRect")
rect_out.extend([0, 0, 800, 600])
return
True
def
OnPaint(self, browser, element_type, paint_buffer, **_) ->
None:
print("#### OnPaint")
def
main():
settings = {
"windowless_rendering_enabled":
True,
}
switches = {
# "log-severity": "verbose",
"disable-gpu": "",
"disable-gpu-compositing": "",
"disable-extensions": "",
}
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize(settings=settings, switches=switches)
window_info = cef.WindowInfo()
window_info.SetAsOffscreen(0)
browser = cef.CreateBrowserSync(url="
https://www.google.com/", window_info=window_info)
browser.SetClientHandler(RenderHandler())
browser.WasResized()
cef.MessageLoop()
if __name__ == '__main__':
main()
############################################
What feels strange is, GetViewRect is only invoked (still, not OnPaint or OnAcceleratedPaint) when I provide an invalid window handle to SetAsOffscreen, otherwise it justs opens up a browser window.
My intended use case is to run it from a game loop (with UPBGE, to be specific) and I could observe a similar behaviour in that environment with a slight twist.
In that case, any invocation of the game engine's API or even simple Python's builtin functions like `print` makes the code invoke GetViewRect without calling OnPaint/OnAcceleratedPaint. And if I just initialise CEF, it will open an actual browser like my above example.
I bisected the CEF/CefPython builds and managed to track down the problematic changes to be those between 72 and 73. Up until 72 (`cefpython72`), I could run the same code correctly in OSR mode.
I suspect it might have something to do with threading but I have no real clue.
If anyone could provide some insight, hints, or just any suggestion as to potential way to fix this problem, it'd be much appreciated.
Thanks!
Xavier
P.S.: (To miilO) If you happen to read this, please consider providing some way I could report issues or contribute to the code.