This opens many customization possibilities beyond those provided by
wxWebView API and also allows to process CEF IPC messages much more
efficiently than what is possible using wxEvents.
Closes#24336.
Add new wxWebViewConfigurationChromium class which corresponds to the
"native" configuration used in the other backends and contains (some)
fields of CefSettings in this one.
Calling this function from OnInternalIdle() is not always enough, so
call it before processing each and every event to ensure that CEF can
really do whatever it needs to be doing internally.
This doesn't seem to noticeably slow down the program and solves weird
problems, like embedded text boxes (e.g. search zones on the web sites)
not getting focus on click.
This function is always called, even if the application prevents the
wxEVT_IDLE handler from being called, either by forgetting to Skip() the
event in its own handler of this message or by changing the global idle
event generation mode to wxIDLE_PROCESS_SPECIFIED.
Just include wxWebViewChromium in the webview library if it's enabled
during the build.
There doesn't seem to be any reason to build a separate library for it,
it's not really different from the other disabled by default wxWebView
backend (Edge).
And now that we don't need to link with an extra library, there is also
no need to have a separate webview_chromium sample, so just add a
possibility to run webview sample itself using Chromium backend by
setting WX_WEBVIEW_BACKEND environment variable.
Use "wxCEF" prefix for this class to avoid any conflicts by using
non-wx-prefixed name.
Also replace wxWebViewChromiumImplData with wxCEF::ImplData as this is
shorter and more consistent with ClientHandler.
Finally stop using anonymous namespace for wxBrowserProcessHandler and
wxCefApp, as we can now put them into the same wxCEF namespace.
Make browser creation actually work by postponing it until the host
window is realized and so has a valid X11 Window.
Remove unnecessary code manually creating GTK widget and just use the
standard wxGTK wxWindow instead.
Add code for setting the visual compatible with CEF to avoid X11 errors,
see https://github.com/chromiumembedded/cef/issues/3564, with many
thanks to Jiří Janoušek for finding and solving this problem originally.
Adjust the sample to handle wxWebView::Create() failure (not very
gracefully, but still better than just crashing) and to avoid using it
until it is fully created.
Update documentation to mention GTK limitations.
Override OnScheduleMessagePumpWork() to schedule work to be done on the
main thread instead of relying on only doing this in wxEVT_IDLE handler.
Still keep the latter, however, as without it the window doesn't refresh
correctly -- which might indicate some other problem somewhere.
This also allows to remove an ugly loop calling CefDoMessageLoopWork()
10 times before shutting down CEF and, most importantly, avoids a fatal
assert with "Object reference incorrectly held at CefShutdown" error on
exit in debug builds.
By initializing CEF from the first Create() call data paths are available
and cache can be enabled. This would also allow for more settings
customization from user code in the future.
Running CEF message loop inside wxWebviewChromium internal will get
segument fault, while moving to client doesn't.
Reset to the previous client solution to avoid segument falut, since I
don't figure out the segument fault reason.
* Enable webview_chromium on Linux, webview_chromium runs normally,
but browser window is split out of wxWidget window now and we need to
host it in wxWidgets window later.
* Make cef messageloop processing in wx::ProcessIdle period, this way
works on windows and linux.
* Don't use multiple_message_loop on Windows.
Currently, WEBVIEW_ERROR event is sent to client on CEF::OnLoadError(),
which may cause the error message of wxInfoBar disapear.
CEF::OnLoadEnd will be invoked after CEF::OnloadError, if WEBVIEW_ERROR
event get processed before CEF::LoadEnd, the wxInfoBar's message will
disappear since the webpage will get loaded in CEF::LoadEnd.
CEF will return "data:text/html,chromewebdata" when url is invalid.