Browse Source
Merge pull request #7310 from odalet/feature/fix-7309
Fixes #7309 - Each time we retrieve a null *PlatformOptions from AvaloniaLocator, return a default instance
pull/7308/head
Dan Walmsley
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
14 additions and
15 deletions
-
src/Avalonia.Native/AvaloniaNativeMenuExporter.cs
-
src/Avalonia.Native/AvaloniaNativePlatform.cs
-
src/Avalonia.X11/Glx/GlxDisplay.cs
-
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs
-
src/Windows/Avalonia.Win32/Win32GlManager.cs
|
|
|
@ -80,8 +80,8 @@ namespace Avalonia.Native |
|
|
|
}; |
|
|
|
result.Add(aboutItem); |
|
|
|
|
|
|
|
var macOpts = AvaloniaLocator.Current.GetService<MacOSPlatformOptions>(); |
|
|
|
if (macOpts == null || !macOpts.DisableDefaultApplicationMenuItems) |
|
|
|
var macOpts = AvaloniaLocator.Current.GetService<MacOSPlatformOptions>() ?? new MacOSPlatformOptions(); |
|
|
|
if (!macOpts.DisableDefaultApplicationMenuItems) |
|
|
|
{ |
|
|
|
result.Add(new NativeMenuItemSeparator()); |
|
|
|
|
|
|
|
@ -142,9 +142,9 @@ namespace Avalonia.Native |
|
|
|
|
|
|
|
private void DoLayoutReset(bool forceUpdate = false) |
|
|
|
{ |
|
|
|
var macOpts = AvaloniaLocator.Current.GetService<MacOSPlatformOptions>(); |
|
|
|
var macOpts = AvaloniaLocator.Current.GetService<MacOSPlatformOptions>() ?? new MacOSPlatformOptions(); |
|
|
|
|
|
|
|
if (macOpts != null && macOpts.DisableNativeMenus) |
|
|
|
if (macOpts.DisableNativeMenus) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -96,9 +96,9 @@ namespace Avalonia.Native |
|
|
|
_factory.Initialize(new GCHandleDeallocator(), applicationPlatform); |
|
|
|
if (_factory.MacOptions != null) |
|
|
|
{ |
|
|
|
var macOpts = AvaloniaLocator.Current.GetService<MacOSPlatformOptions>(); |
|
|
|
var macOpts = AvaloniaLocator.Current.GetService<MacOSPlatformOptions>() ?? new MacOSPlatformOptions(); |
|
|
|
|
|
|
|
_factory.MacOptions.SetShowInDock(macOpts?.ShowInDock != false ? 1 : 0); |
|
|
|
_factory.MacOptions.SetShowInDock(macOpts.ShowInDock ? 1 : 0); |
|
|
|
} |
|
|
|
|
|
|
|
AvaloniaLocator.CurrentMutable |
|
|
|
|
|
|
|
@ -95,8 +95,8 @@ namespace Avalonia.X11.Glx |
|
|
|
|
|
|
|
if (Environment.GetEnvironmentVariable("AVALONIA_GLX_IGNORE_RENDERER_BLACKLIST") != "1") |
|
|
|
{ |
|
|
|
var blacklist = AvaloniaLocator.Current.GetService<X11PlatformOptions>() |
|
|
|
?.GlxRendererBlacklist; |
|
|
|
var opts = AvaloniaLocator.Current.GetService<X11PlatformOptions>() ?? new X11PlatformOptions(); |
|
|
|
var blacklist = opts.GlxRendererBlacklist; |
|
|
|
if (blacklist != null) |
|
|
|
foreach (var item in blacklist) |
|
|
|
if (glInterface.Renderer.Contains(item)) |
|
|
|
|
|
|
|
@ -38,11 +38,11 @@ namespace Avalonia.LinuxFramebuffer |
|
|
|
if (_fb is IGlOutputBackend gl) |
|
|
|
AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToConstant(gl.PlatformOpenGlInterface); |
|
|
|
|
|
|
|
var opts = AvaloniaLocator.Current.GetService<LinuxFramebufferPlatformOptions>(); |
|
|
|
var opts = AvaloniaLocator.Current.GetService<LinuxFramebufferPlatformOptions>() ?? new LinuxFramebufferPlatformOptions(); |
|
|
|
|
|
|
|
AvaloniaLocator.CurrentMutable |
|
|
|
.Bind<IPlatformThreadingInterface>().ToConstant(Threading) |
|
|
|
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(opts?.Fps ?? 60)) |
|
|
|
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(opts.Fps)) |
|
|
|
.Bind<IRenderLoop>().ToConstant(new RenderLoop()) |
|
|
|
.Bind<ICursorFactory>().ToTransient<CursorFactoryStub>() |
|
|
|
.Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice()) |
|
|
|
|
|
|
|
@ -13,19 +13,18 @@ namespace Avalonia.Win32 |
|
|
|
{ |
|
|
|
AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToLazy<IPlatformOpenGlInterface>(() => |
|
|
|
{ |
|
|
|
var opts = AvaloniaLocator.Current.GetService<Win32PlatformOptions>(); |
|
|
|
if (opts?.UseWgl == true) |
|
|
|
var opts = AvaloniaLocator.Current.GetService<Win32PlatformOptions>() ?? new Win32PlatformOptions(); |
|
|
|
if (opts.UseWgl) |
|
|
|
{ |
|
|
|
var wgl = WglPlatformOpenGlInterface.TryCreate(); |
|
|
|
return wgl; |
|
|
|
} |
|
|
|
|
|
|
|
if (opts?.AllowEglInitialization ?? Win32Platform.WindowsVersion > PlatformConstants.Windows7) |
|
|
|
if (opts.AllowEglInitialization ?? Win32Platform.WindowsVersion > PlatformConstants.Windows7) |
|
|
|
{ |
|
|
|
var egl = EglPlatformOpenGlInterface.TryCreate(() => new AngleWin32EglDisplay()); |
|
|
|
|
|
|
|
if (egl != null && |
|
|
|
opts?.UseWindowsUIComposition == true) |
|
|
|
if (egl != null && opts.UseWindowsUIComposition) |
|
|
|
{ |
|
|
|
WinUICompositorConnection.TryCreateAndRegister(egl, opts.CompositionBackdropCornerRadius); |
|
|
|
} |
|
|
|
|