From e3a7b78ec366c3cade70b36ca0dc41b1ebbd064a Mon Sep 17 00:00:00 2001 From: Sebastian Hartte Date: Mon, 11 Jan 2021 17:31:30 +0100 Subject: [PATCH] Fixes #5281: Default to EGL initialization if no options are provided and OS is at least Windows 8 --- src/Windows/Avalonia.Win32/Win32GlManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Windows/Avalonia.Win32/Win32GlManager.cs b/src/Windows/Avalonia.Win32/Win32GlManager.cs index f6b07ee33e..e159ba3b78 100644 --- a/src/Windows/Avalonia.Win32/Win32GlManager.cs +++ b/src/Windows/Avalonia.Win32/Win32GlManager.cs @@ -9,6 +9,8 @@ namespace Avalonia.Win32 { static class Win32GlManager { + private static readonly Version Windows7 = new Version(6, 1); + public static void Initialize() { AvaloniaLocator.CurrentMutable.Bind().ToLazy(() => @@ -20,13 +22,11 @@ namespace Avalonia.Win32 return wgl; } - if (opts?.AllowEglInitialization == true || - ((!opts?.AllowEglInitialization.HasValue ?? false) && - Win32Platform.WindowsVersion > new Version(6, 1))) + if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > Windows7) { var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); - if (egl is { } && + if (egl != null && opts?.UseWindowsUIComposition == true) { WinUICompositorConnection.TryCreateAndRegister(egl);