mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +00:00
WPF/OffScreen - Initialize Cef with WindowlessRendering enabled by default
Suggestion is this is now required to be set https://github.com/cefsharp/CefSharp/issues/2431
This commit is contained in:
@@ -278,9 +278,15 @@ namespace CefSharp.OffScreen
|
||||
public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
|
||||
RequestContext requestContext = null, bool automaticallyCreateBrowser = true)
|
||||
{
|
||||
if (!Cef.IsInitialized && !Cef.Initialize())
|
||||
if (!Cef.IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException("Cef::Initialize() failed");
|
||||
var settings = new CefSettings();
|
||||
settings.WindowlessRenderingEnabled = true;
|
||||
|
||||
if (!Cef.Initialize(settings))
|
||||
{
|
||||
throw new InvalidOperationException("Cef::Initialize() failed");
|
||||
}
|
||||
}
|
||||
|
||||
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
|
||||
|
||||
@@ -433,11 +433,17 @@ namespace CefSharp.Wpf
|
||||
private void NoInliningConstructor()
|
||||
{
|
||||
//Initialize CEF if it hasn't already been initialized
|
||||
if (!Cef.IsInitialized && !Cef.Initialize())
|
||||
if (!Cef.IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException("Cef::Initialize() failed");
|
||||
var settings = new CefSettings();
|
||||
settings.WindowlessRenderingEnabled = true;
|
||||
|
||||
if (!Cef.Initialize(settings))
|
||||
{
|
||||
throw new InvalidOperationException("Cef::Initialize() failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Add this ChromiumWebBrowser instance to a list of IDisposable objects
|
||||
// that if still alive at the time Cef.Shutdown is called will be disposed of
|
||||
// It's important all browser instances be freed before Cef.Shutdown is called.
|
||||
|
||||
Reference in New Issue
Block a user