|
|
|
@ -123,40 +123,45 @@ namespace Avalonia.Native |
|
|
|
hotkeys.MoveCursorToTheEndOfLineWithSelection.Add(new KeyGesture(Key.Right, hotkeys.CommandModifiers | hotkeys.SelectionModifiers)); |
|
|
|
|
|
|
|
AvaloniaLocator.CurrentMutable.Bind<PlatformHotkeyConfiguration>().ToConstant(hotkeys); |
|
|
|
|
|
|
|
if (_options.UseGpu) |
|
|
|
|
|
|
|
foreach (var mode in _options.RenderingMode) |
|
|
|
{ |
|
|
|
if (_options.UseMetal) |
|
|
|
if (mode == AvaloniaNativeRenderingMode.OpenGl) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
var metal = new MetalPlatformGraphics(_factory); |
|
|
|
metal.CreateContext().Dispose(); |
|
|
|
_platformGraphics = metal; |
|
|
|
_platformGraphics = new AvaloniaNativeGlPlatformGraphics(_factory.ObtainGlDisplay()); |
|
|
|
break; |
|
|
|
} |
|
|
|
catch |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
// Ignored
|
|
|
|
// ignored
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (_platformGraphics == null) |
|
|
|
#pragma warning disable CS0618
|
|
|
|
else if (mode == AvaloniaNativeRenderingMode.Metal) |
|
|
|
#pragma warning restore CS0618
|
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
_platformGraphics = new AvaloniaNativeGlPlatformGraphics(_factory.ObtainGlDisplay()); |
|
|
|
var metal = new MetalPlatformGraphics(_factory); |
|
|
|
metal.CreateContext().Dispose(); |
|
|
|
_platformGraphics = metal; |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch |
|
|
|
{ |
|
|
|
// ignored
|
|
|
|
// Ignored
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(_platformGraphics != null) |
|
|
|
AvaloniaLocator.CurrentMutable |
|
|
|
.Bind<IPlatformGraphics>().ToConstant(_platformGraphics); |
|
|
|
else if (mode == AvaloniaNativeRenderingMode.Software) |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
if (_platformGraphics != null) |
|
|
|
AvaloniaLocator.CurrentMutable |
|
|
|
.Bind<IPlatformGraphics>().ToConstant(_platformGraphics); |
|
|
|
|
|
|
|
|
|
|
|
Compositor = new Compositor(_platformGraphics, true); |
|
|
|
} |
|
|
|
|
|
|
|
|