From 47916982f69edc059751149804cce6d436d72a37 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 10 Dec 2020 19:27:01 +0000 Subject: [PATCH] check min windows version for egl init in win32glmanager. --- src/Windows/Avalonia.Win32/Win32GlManager.cs | 8 ++++++-- src/Windows/Avalonia.Win32/Win32Platform.cs | 4 +--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Win32GlManager.cs b/src/Windows/Avalonia.Win32/Win32GlManager.cs index b51f80e397..f6b07ee33e 100644 --- a/src/Windows/Avalonia.Win32/Win32GlManager.cs +++ b/src/Windows/Avalonia.Win32/Win32GlManager.cs @@ -20,13 +20,17 @@ namespace Avalonia.Win32 return wgl; } - if (opts?.AllowEglInitialization == true) + if (opts?.AllowEglInitialization == true || + ((!opts?.AllowEglInitialization.HasValue ?? false) && + Win32Platform.WindowsVersion > new Version(6, 1))) { var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); if (egl is { } && - opts?.UseWindowsUIComposition == true) + opts?.UseWindowsUIComposition == true) + { WinUICompositorConnection.TryCreateAndRegister(egl); + } return egl; } diff --git a/src/Windows/Avalonia.Win32/Win32Platform.cs b/src/Windows/Avalonia.Win32/Win32Platform.cs index 2a3625e31a..45aad77efe 100644 --- a/src/Windows/Avalonia.Win32/Win32Platform.cs +++ b/src/Windows/Avalonia.Win32/Win32Platform.cs @@ -41,9 +41,7 @@ namespace Avalonia { public bool UseDeferredRendering { get; set; } = true; - public bool AllowEglInitialization { get; set; } - = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && - Win32Platform.WindowsVersion > new Version(6, 1); + public bool? AllowEglInitialization { get; set; } public bool? EnableMultitouch { get; set; } public bool OverlayPopups { get; set; }