feat: StartLinuxDrm in Raspberry Pi.
This commit is contained in:
parent
1ad9fc2714
commit
cbea8156ad
@ -1,48 +1,43 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Dialogs;
|
||||
using Avalonia.Media;
|
||||
using System;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Avalonia;
|
||||
|
||||
namespace Semi.Avalonia.Demo.Drm
|
||||
namespace Semi.Avalonia.Demo.Drm;
|
||||
|
||||
class Program
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
var builder = BuildAvaloniaApp();
|
||||
builder.With(new FontManagerOptions
|
||||
|
||||
double GetScaling()
|
||||
{
|
||||
FontFallbacks = new[]
|
||||
{
|
||||
new FontFallback
|
||||
{
|
||||
FontFamily = new FontFamily("Microsoft YaHei")
|
||||
var idx = Array.IndexOf(args, "--scaling");
|
||||
if (idx != 0 && args.Length > idx + 1 &&
|
||||
double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling))
|
||||
return scaling;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (args.Contains("--drm"))
|
||||
{
|
||||
SilenceConsole();
|
||||
builder.StartLinuxDrm(args: args, card: "/dev/dri/card1", scaling: 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.StartWithClassicDesktopLifetime(args);
|
||||
return builder.StartLinuxDrm(args: args, card: "/dev/dri/card1", scaling: GetScaling());
|
||||
}
|
||||
|
||||
return builder.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UseManagedSystemDialogs()
|
||||
.UsePlatformDetect()
|
||||
.With(new Win32PlatformOptions())
|
||||
.LogToTrace();
|
||||
|
||||
private static void SilenceConsole()
|
||||
@ -55,5 +50,4 @@ namespace Semi.Avalonia.Demo.Drm
|
||||
})
|
||||
{ IsBackground = true }.Start();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user