From 1760ffee5ab34ae075183db964ab284b24a31f6a Mon Sep 17 00:00:00 2001 From: amwx Date: Thu, 23 Sep 2021 19:33:02 -0400 Subject: [PATCH 1/6] Move CancelOpening check --- src/Avalonia.Controls/Flyouts/FlyoutBase.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/Flyouts/FlyoutBase.cs b/src/Avalonia.Controls/Flyouts/FlyoutBase.cs index 230b4954fe..4b903d056c 100644 --- a/src/Avalonia.Controls/Flyouts/FlyoutBase.cs +++ b/src/Avalonia.Controls/Flyouts/FlyoutBase.cs @@ -215,11 +215,6 @@ namespace Avalonia.Controls.Primitives } } - if (CancelOpening()) - { - return false; - } - if (Popup.Parent != null && Popup.Parent != placementTarget) { ((ISetLogicalParent)Popup).SetParent(null); @@ -236,6 +231,11 @@ namespace Avalonia.Controls.Primitives Popup.Child = CreatePresenter(); } + if (CancelOpening()) + { + return false; + } + PositionPopup(showAtPointer); IsOpen = Popup.IsOpen = true; OnOpened(); From 3c99205995e235d396f093800de557aa4252d75f Mon Sep 17 00:00:00 2001 From: Takoooooo Date: Fri, 24 Sep 2021 16:00:06 +0300 Subject: [PATCH 2/6] fix --- src/Avalonia.Themes.Default/Expander.xaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Avalonia.Themes.Default/Expander.xaml b/src/Avalonia.Themes.Default/Expander.xaml index 5e0958c54c..7df65677b6 100644 --- a/src/Avalonia.Themes.Default/Expander.xaml +++ b/src/Avalonia.Themes.Default/Expander.xaml @@ -101,6 +101,7 @@ Grid.Column="1" Background="Transparent" Content="{TemplateBinding Content}" + ContentTemplate="{Binding $parent[Expander].HeaderTemplate}" VerticalAlignment="Center" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" From cccfd69cbd0565e2dd9bdd092e9e003d0e426d72 Mon Sep 17 00:00:00 2001 From: Sven Almgren Date: Sun, 26 Sep 2021 16:43:07 +0200 Subject: [PATCH 3/6] Removed duplicate registraion of IRenderLoop --- src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs index 89f81a7649..7fb601eb62 100644 --- a/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs +++ b/src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs @@ -44,7 +44,6 @@ namespace Avalonia.LinuxFramebuffer .Bind().ToTransient() .Bind().ToConstant(new KeyboardDevice()) .Bind().ToSingleton() - .Bind().ToConstant(new RenderLoop()) .Bind().ToSingleton(); } From d60d96e554fcdaa29b5450bda36e116dee0aba3a Mon Sep 17 00:00:00 2001 From: Yatao Li Date: Tue, 28 Sep 2021 01:57:56 +0800 Subject: [PATCH 4/6] fix x11 deferred renderer performance regression --- src/Avalonia.X11/X11Window.cs | 5 ----- 1 file changed, 5 deletions(-) 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(); } From 49e23bc07ff46d27bb2020d1ae04be654af81ab2 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Sep 2021 12:06:59 +0200 Subject: [PATCH 5/6] Use IRendererFactory in framebuffer backend. If an `IRendererFactory` is provided, use this to supply the renderer; otherwise fall back to the existing `DeferredRenderer`. --- .../Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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) { } From 23dcab47d4461d54bed91eec470c30f74e062843 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Sep 2021 12:41:11 +0200 Subject: [PATCH 6/6] Allow customizing the framebuffer FPS. --- .../LinuxFramebufferPlatform.cs | 6 ++++-- .../LinuxFramebufferPlatformOptions.cs | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs 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; + } +}