Browse Source

Merge branch 'master' into fix-opening-disabled-menu-with-accelerator-key

pull/6632/head
Tako 5 years ago
committed by GitHub
parent
commit
8177141e20
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/Avalonia.Controls/Flyouts/FlyoutBase.cs
  2. 1
      src/Avalonia.Themes.Default/Expander.xaml
  3. 5
      src/Avalonia.X11/X11Window.cs
  4. 9
      src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs
  5. 7
      src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs
  6. 14
      src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs

10
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) if (Popup.Parent != null && Popup.Parent != placementTarget)
{ {
((ISetLogicalParent)Popup).SetParent(null); ((ISetLogicalParent)Popup).SetParent(null);
@ -236,6 +231,11 @@ namespace Avalonia.Controls.Primitives
Popup.Child = CreatePresenter(); Popup.Child = CreatePresenter();
} }
if (CancelOpening())
{
return false;
}
PositionPopup(showAtPointer); PositionPopup(showAtPointer);
IsOpen = Popup.IsOpen = true; IsOpen = Popup.IsOpen = true;
OnOpened(); OnOpened();

1
src/Avalonia.Themes.Default/Expander.xaml

@ -101,6 +101,7 @@
Grid.Column="1" Grid.Column="1"
Background="Transparent" Background="Transparent"
Content="{TemplateBinding Content}" Content="{TemplateBinding Content}"
ContentTemplate="{Binding $parent[Expander].HeaderTemplate}"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"

5
src/Avalonia.X11/X11Window.cs

@ -192,11 +192,6 @@ namespace Avalonia.X11
if (platform.Options.UseDBusMenu) if (platform.Options.UseDBusMenu)
NativeMenuExporter = DBusMenuExporter.TryCreate(_handle); NativeMenuExporter = DBusMenuExporter.TryCreate(_handle);
NativeControlHost = new X11NativeControlHost(_platform, this); NativeControlHost = new X11NativeControlHost(_platform, this);
DispatcherTimer.Run(() =>
{
Paint?.Invoke(default);
return _handle != IntPtr.Zero;
}, TimeSpan.FromMilliseconds(100));
InitializeIme(); InitializeIme();
} }

9
src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs

@ -30,10 +30,9 @@ namespace Avalonia.LinuxFramebuffer
public IRenderer CreateRenderer(IRenderRoot root) public IRenderer CreateRenderer(IRenderRoot root)
{ {
return new DeferredRenderer(root, AvaloniaLocator.Current.GetService<IRenderLoop>()) var factory = AvaloniaLocator.Current.GetService<IRendererFactory>();
{ var renderLoop = AvaloniaLocator.Current.GetService<IRenderLoop>();
return factory?.Create(root, renderLoop) ?? new DeferredRenderer(root, renderLoop);
};
} }
public void Dispose() public void Dispose()
@ -41,7 +40,7 @@ namespace Avalonia.LinuxFramebuffer
throw new NotSupportedException(); throw new NotSupportedException();
} }
public void Invalidate(Rect rect) public void Invalidate(Rect rect)
{ {
} }

7
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs

@ -37,16 +37,17 @@ namespace Avalonia.LinuxFramebuffer
Threading = new InternalPlatformThreadingInterface(); Threading = new InternalPlatformThreadingInterface();
if (_fb is IGlOutputBackend gl) if (_fb is IGlOutputBackend gl)
AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToConstant(gl.PlatformOpenGlInterface); AvaloniaLocator.CurrentMutable.Bind<IPlatformOpenGlInterface>().ToConstant(gl.PlatformOpenGlInterface);
var opts = AvaloniaLocator.Current.GetService<LinuxFramebufferPlatformOptions>();
AvaloniaLocator.CurrentMutable AvaloniaLocator.CurrentMutable
.Bind<IPlatformThreadingInterface>().ToConstant(Threading) .Bind<IPlatformThreadingInterface>().ToConstant(Threading)
.Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(60)) .Bind<IRenderTimer>().ToConstant(new DefaultRenderTimer(opts?.Fps ?? 60))
.Bind<IRenderLoop>().ToConstant(new RenderLoop()) .Bind<IRenderLoop>().ToConstant(new RenderLoop())
.Bind<ICursorFactory>().ToTransient<CursorFactoryStub>() .Bind<ICursorFactory>().ToTransient<CursorFactoryStub>()
.Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice()) .Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice())
.Bind<IPlatformSettings>().ToSingleton<PlatformSettings>() .Bind<IPlatformSettings>().ToSingleton<PlatformSettings>()
.Bind<IRenderLoop>().ToConstant(new RenderLoop())
.Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>(); .Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>();
} }

14
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatformOptions.cs

@ -0,0 +1,14 @@
namespace Avalonia.LinuxFramebuffer
{
/// <summary>
/// Platform-specific options which apply to the Linux framebuffer.
/// </summary>
public class LinuxFramebufferPlatformOptions
{
/// <summary>
/// Gets or sets the number of frames per second at which the renderer should run.
/// Default 60.
/// </summary>
public int Fps { get; set; } = 60;
}
}
Loading…
Cancel
Save