diff --git a/src/Avalonia.X11/X11Platform.cs b/src/Avalonia.X11/X11Platform.cs index 75e0776b5e..9e1757d4ef 100644 --- a/src/Avalonia.X11/X11Platform.cs +++ b/src/Avalonia.X11/X11Platform.cs @@ -70,10 +70,14 @@ namespace Avalonia.X11 if (options.UseDBusMenu) DBusHelper.TryInitialize(); + IRenderTimer timer = options.ShouldRenderOnUIThread + ? new UiThreadRenderTimer(60) + : new SleepLoopRenderTimer(60); + AvaloniaLocator.CurrentMutable.BindToSelf(this) .Bind().ToConstant(this) .Bind().ToConstant(new X11PlatformThreading(this)) - .Bind().ToConstant(new SleepLoopRenderTimer(60)) + .Bind().ToConstant(timer) .Bind().ToConstant(new PlatformHotkeyConfiguration(KeyModifiers.Control)) .Bind().ToFunc(() => KeyboardDevice) .Bind().ToConstant(new X11CursorFactory(Display)) @@ -303,7 +307,14 @@ namespace Avalonia /// public bool EnableSessionManagement { get; set; } = Environment.GetEnvironmentVariable("AVALONIA_X11_USE_SESSION_MANAGEMENT") != "0"; - + + /// + /// Render directly on the UI thread instead of using a dedicated render thread. + /// This can be usable if your device don't have multiple cores to begin with. + /// This setting is false by default. + /// + public bool ShouldRenderOnUIThread { get; set; } + public IList GlProfiles { get; set; } = new List { new GlVersion(GlProfileType.OpenGL, 4, 0),