Browse Source
Merge pull request #11687 from foxxelias/linux-only-fbdev-run-fix
[FIX] Added missing IPlatformIconLoader in LinuxFramebufferPlatform.cs
baget-ci-test
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
36 additions and
7 deletions
-
samples/ControlCatalog.NetCore/Program.cs
-
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs
|
|
|
@ -18,9 +18,16 @@ namespace ControlCatalog.NetCore |
|
|
|
{ |
|
|
|
static class Program |
|
|
|
{ |
|
|
|
private static bool s_useFramebuffer; |
|
|
|
|
|
|
|
[STAThread] |
|
|
|
static int Main(string[] args) |
|
|
|
{ |
|
|
|
if (args.Contains("--fbdev")) |
|
|
|
{ |
|
|
|
s_useFramebuffer = true; |
|
|
|
} |
|
|
|
|
|
|
|
if (args.Contains("--wait-for-attach")) |
|
|
|
{ |
|
|
|
Console.WriteLine("Attach debugger and use 'Set next statement'"); |
|
|
|
@ -42,10 +49,10 @@ namespace ControlCatalog.NetCore |
|
|
|
return scaling; |
|
|
|
return 1; |
|
|
|
} |
|
|
|
if (args.Contains("--fbdev")) |
|
|
|
if (s_useFramebuffer) |
|
|
|
{ |
|
|
|
SilenceConsole(); |
|
|
|
return builder.StartLinuxFbDev(args, scaling: GetScaling()); |
|
|
|
SilenceConsole(); |
|
|
|
return builder.StartLinuxFbDev(args, scaling: GetScaling()); |
|
|
|
} |
|
|
|
else if (args.Contains("--vnc")) |
|
|
|
{ |
|
|
|
@ -128,10 +135,13 @@ namespace ControlCatalog.NetCore |
|
|
|
.WithInterFont() |
|
|
|
.AfterSetup(builder => |
|
|
|
{ |
|
|
|
builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() |
|
|
|
if (!s_useFramebuffer) |
|
|
|
{ |
|
|
|
StartupScreenIndex = 1, |
|
|
|
}); |
|
|
|
builder.Instance!.AttachDevTools(new Avalonia.Diagnostics.DevToolsOptions() |
|
|
|
{ |
|
|
|
StartupScreenIndex = 1, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
EmbedSample.Implementation = OperatingSystem.IsWindows() ? (INativeDemoControl)new EmbedSampleWin() |
|
|
|
: OperatingSystem.IsMacOS() ? new EmbedSampleMac() |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Diagnostics; |
|
|
|
using System.IO; |
|
|
|
using System.Threading; |
|
|
|
using Avalonia; |
|
|
|
using Avalonia.Controls; |
|
|
|
@ -22,13 +23,30 @@ using Avalonia.Threading; |
|
|
|
|
|
|
|
namespace Avalonia.LinuxFramebuffer |
|
|
|
{ |
|
|
|
internal class LinuxFramebufferIconLoaderStub : IPlatformIconLoader |
|
|
|
{ |
|
|
|
private class IconStub : IWindowIconImpl |
|
|
|
{ |
|
|
|
public void Save(Stream outputStream) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public IWindowIconImpl LoadIcon(string fileName) => new IconStub(); |
|
|
|
|
|
|
|
public IWindowIconImpl LoadIcon(Stream stream) => new IconStub(); |
|
|
|
|
|
|
|
public IWindowIconImpl LoadIcon(IBitmapImpl bitmap) => new IconStub(); |
|
|
|
} |
|
|
|
|
|
|
|
class LinuxFramebufferPlatform |
|
|
|
{ |
|
|
|
IOutputBackend _fb; |
|
|
|
public static ManualRawEventGrouperDispatchQueue EventGrouperDispatchQueue = new(); |
|
|
|
|
|
|
|
internal static Compositor Compositor { get; private set; } = null!; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LinuxFramebufferPlatform(IOutputBackend backend) |
|
|
|
{ |
|
|
|
@ -47,6 +65,7 @@ namespace Avalonia.LinuxFramebuffer |
|
|
|
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(opts.Fps)) |
|
|
|
.Bind<ICursorFactory>().ToTransient<CursorFactoryStub>() |
|
|
|
.Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice()) |
|
|
|
.Bind<IPlatformIconLoader>().ToSingleton<LinuxFramebufferIconLoaderStub>() |
|
|
|
.Bind<IPlatformSettings>().ToSingleton<DefaultPlatformSettings>() |
|
|
|
.Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>(); |
|
|
|
|
|
|
|
|