diff --git a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs index 726d2c596c..e361e7b736 100644 --- a/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs +++ b/src/Avalonia.Controls/Platform/DefaultMenuInteractionHandler.cs @@ -275,7 +275,7 @@ namespace Avalonia.Controls.Platform return; } - if (item.HasSubMenu) + if (item.HasSubMenu && item.IsEffectivelyEnabled) { Open(item, true); } diff --git a/src/Avalonia.Visuals/Media/FormattedText.cs b/src/Avalonia.Visuals/Media/FormattedText.cs index a843be4c4b..ddffbe7500 100644 --- a/src/Avalonia.Visuals/Media/FormattedText.cs +++ b/src/Avalonia.Visuals/Media/FormattedText.cs @@ -200,7 +200,7 @@ namespace Avalonia.Media private void Set(ref T field, T value) { - if (field != null && field.Equals(value)) + if (EqualityComparer.Default.Equals(field, value)) { return; } diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index f0d2d5ca8a..14645bc415 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -192,11 +192,6 @@ namespace Avalonia.X11 if (platform.Options.UseDBusMenu) NativeMenuExporter = DBusMenuExporter.TryCreate(_handle); NativeControlHost = new X11NativeControlHost(_platform, this); - DispatcherTimer.Run(() => - { - Paint?.Invoke(default); - return _handle != IntPtr.Zero; - }, TimeSpan.FromMilliseconds(100)); InitializeIme(); } diff --git a/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs b/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs index b097e0917f..8688671d3b 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs @@ -30,10 +30,9 @@ namespace Avalonia.LinuxFramebuffer public IRenderer CreateRenderer(IRenderRoot root) { - return new DeferredRenderer(root, AvaloniaLocator.Current.GetService()) - { - - }; + var factory = AvaloniaLocator.Current.GetService(); + var renderLoop = AvaloniaLocator.Current.GetService(); + return factory?.Create(root, renderLoop) ?? new DeferredRenderer(root, renderLoop); } public void Dispose() @@ -41,7 +40,7 @@ namespace Avalonia.LinuxFramebuffer throw new NotSupportedException(); } - + public void Invalidate(Rect rect) { } diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs index 7fb601eb62..f4db6bf48a 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs @@ -37,15 +37,17 @@ namespace Avalonia.LinuxFramebuffer Threading = new InternalPlatformThreadingInterface(); if (_fb is IGlOutputBackend gl) AvaloniaLocator.CurrentMutable.Bind().ToConstant(gl.PlatformOpenGlInterface); + + var opts = AvaloniaLocator.Current.GetService(); + AvaloniaLocator.CurrentMutable .Bind().ToConstant(Threading) - .Bind().ToConstant(new DefaultRenderTimer(60)) + .Bind().ToConstant(new DefaultRenderTimer(opts?.Fps ?? 60)) .Bind().ToConstant(new RenderLoop()) .Bind().ToTransient() .Bind().ToConstant(new KeyboardDevice()) .Bind().ToSingleton() .Bind().ToSingleton(); - } diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs new file mode 100644 index 0000000000..bf925bbd75 --- /dev/null +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs @@ -0,0 +1,14 @@ +namespace Avalonia.LinuxFramebuffer +{ + /// + /// Platform-specific options which apply to the Linux framebuffer. + /// + public class LinuxFramebufferPlatformOptions + { + /// + /// Gets or sets the number of frames per second at which the renderer should run. + /// Default 60. + /// + public int Fps { get; set; } = 60; + } +}