From 4154eeacedc0d3c33f80544e69f2b7d9579a583b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Thu, 21 May 2020 09:33:40 -0300 Subject: [PATCH] Revert "use thickness as the ExtendClientArea hint." This reverts commit 42673554085035e8a8a3435bc623ceb29f72e4db. --- src/Avalonia.Controls/Platform/IWindowImpl.cs | 2 +- src/Avalonia.Controls/Window.cs | 10 +++++----- .../Remote/PreviewerWindowImpl.cs | 2 +- src/Avalonia.DesignerSupport/Remote/Stubs.cs | 2 +- src/Avalonia.Native/WindowImpl.cs | 2 +- src/Avalonia.X11/X11Window.cs | 2 +- src/Windows/Avalonia.Win32/WindowImpl.cs | 19 ++++++++++--------- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Avalonia.Controls/Platform/IWindowImpl.cs b/src/Avalonia.Controls/Platform/IWindowImpl.cs index 604c3a61aa..9c4808a41c 100644 --- a/src/Avalonia.Controls/Platform/IWindowImpl.cs +++ b/src/Avalonia.Controls/Platform/IWindowImpl.cs @@ -95,7 +95,7 @@ namespace Avalonia.Platform /// void SetMinMaxSize(Size minSize, Size maxSize); - Thickness ExtendClientAreaToDecorationsHint { get; set; } + bool ExtendClientAreaToDecorationsHint { get; set; } Action ExtendClientAreaToDecorationsChanged { get; set; } diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index eb8801622d..55af5b69a3 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -92,8 +92,8 @@ namespace Avalonia.Controls /// /// Defines the property. /// - public static readonly StyledProperty ExtendClientAreaToDecorationsHintProperty = - AvaloniaProperty.Register(nameof(ExtendClientAreaToDecorationsHint), default); + public static readonly StyledProperty ExtendClientAreaToDecorationsHintProperty = + AvaloniaProperty.Register(nameof(ExtendClientAreaToDecorationsHint), false); /// @@ -109,7 +109,7 @@ namespace Avalonia.Controls /// public static readonly DirectProperty WindowDecorationMarginsProperty = AvaloniaProperty.RegisterDirect(nameof(WindowDecorationMargins), - o => o.WindowDecorationMargins); + o => o.WindowDecorationMargins); /// @@ -190,7 +190,7 @@ namespace Avalonia.Controls (w, e) => { if (w.PlatformImpl != null) w.PlatformImpl.WindowState = (WindowState)e.NewValue; }); ExtendClientAreaToDecorationsHintProperty.Changed.AddClassHandler( - (w, e) => { if (w.PlatformImpl != null) w.PlatformImpl.ExtendClientAreaToDecorationsHint = (Thickness)e.NewValue; }); + (w, e) => { if (w.PlatformImpl != null) w.PlatformImpl.ExtendClientAreaToDecorationsHint = (bool)e.NewValue; }); MinWidthProperty.Changed.AddClassHandler((w, e) => w.PlatformImpl?.SetMinMaxSize(new Size((double)e.NewValue, w.MinHeight), new Size(w.MaxWidth, w.MaxHeight))); MinHeightProperty.Changed.AddClassHandler((w, e) => w.PlatformImpl?.SetMinMaxSize(new Size(w.MinWidth, (double)e.NewValue), new Size(w.MaxWidth, w.MaxHeight))); @@ -269,7 +269,7 @@ namespace Avalonia.Controls /// /// Gets or sets if the ClientArea is Extended into the Window Decorations (chrome or border). /// - public Thickness ExtendClientAreaToDecorationsHint + public bool ExtendClientAreaToDecorationsHint { get { return GetValue(ExtendClientAreaToDecorationsHintProperty); } set { SetValue(ExtendClientAreaToDecorationsHintProperty, value); } diff --git a/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs b/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs index 573a881c01..1da6da971b 100644 --- a/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs +++ b/src/Avalonia.DesignerSupport/Remote/PreviewerWindowImpl.cs @@ -85,7 +85,7 @@ namespace Avalonia.DesignerSupport.Remote public IScreenImpl Screen { get; } = new ScreenStub(); public Action GotInputWhenDisabled { get; set; } - public Thickness ExtendClientAreaToDecorationsHint { get; set; } + public bool ExtendClientAreaToDecorationsHint { get; set; } public Action ExtendClientAreaToDecorationsChanged { get; set; } diff --git a/src/Avalonia.DesignerSupport/Remote/Stubs.cs b/src/Avalonia.DesignerSupport/Remote/Stubs.cs index d5c98baec8..0c6991a645 100644 --- a/src/Avalonia.DesignerSupport/Remote/Stubs.cs +++ b/src/Avalonia.DesignerSupport/Remote/Stubs.cs @@ -39,7 +39,7 @@ namespace Avalonia.DesignerSupport.Remote public Action TransparencyLevelChanged { get; set; } - public Thickness ExtendClientAreaToDecorationsHint { get; set; } + public bool ExtendClientAreaToDecorationsHint { get; set; } public Action ExtendClientAreaToDecorationsChanged { get; set; } diff --git a/src/Avalonia.Native/WindowImpl.cs b/src/Avalonia.Native/WindowImpl.cs index 2e81a66d1f..3495c4b392 100644 --- a/src/Avalonia.Native/WindowImpl.cs +++ b/src/Avalonia.Native/WindowImpl.cs @@ -98,7 +98,7 @@ namespace Avalonia.Native public Action WindowStateChanged { get; set; } - public Thickness ExtendClientAreaToDecorationsHint { get; set; } + public bool ExtendClientAreaToDecorationsHint { get; set; } public Action ExtendClientAreaToDecorationsChanged { get; set; } diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index d5cd1dae77..508717f2b4 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -311,7 +311,7 @@ namespace Avalonia.X11 set => _transparencyHelper.TransparencyLevelChanged = value; } - public Thickness ExtendClientAreaToDecorationsHint { get; set; } + public bool ExtendClientAreaToDecorationsHint { get; set; } public Action ExtendClientAreaToDecorationsChanged { get; set; } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 78dcd91ff5..2ee34496ba 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -68,7 +68,7 @@ namespace Avalonia.Win32 private Size _minSize; private Size _maxSize; private WindowImpl _parent; - private Thickness _extendClientAreaToDecorationsHint; + private bool _extendClientAreaToDecorationsHint; public WindowImpl() { @@ -672,7 +672,7 @@ namespace Avalonia.Win32 TaskBarList.MarkFullscreen(_hwnd, fullscreen); } - private void ExtendClientArea (Thickness thickness) + private void ExtendClientArea () { if (!_isClientAreaExtended) { @@ -696,10 +696,10 @@ namespace Avalonia.Win32 } // Extend the frame into the client area. - margins.cxLeftWidth = thickness.Left == -1 ? border_thickness.left : (int)(thickness.Left * Scaling); - margins.cxRightWidth = thickness.Right == -1 ? border_thickness.right : (int)(thickness.Right * Scaling); - margins.cyBottomHeight = thickness.Bottom == -1 ? border_thickness.bottom : (int)(thickness.Bottom * Scaling); - margins.cyTopHeight = thickness.Top == -1 ? border_thickness.top : (int)(thickness.Top * Scaling); + margins.cxLeftWidth = border_thickness.left; + margins.cxRightWidth = border_thickness.right; + margins.cyBottomHeight = border_thickness.bottom; + margins.cyTopHeight = border_thickness.top; var hr = DwmExtendFrameIntoClientArea(_hwnd, ref margins); @@ -954,14 +954,15 @@ namespace Avalonia.Win32 IntPtr EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo.Handle => Handle.Handle; - public Thickness ExtendClientAreaToDecorationsHint + public bool ExtendClientAreaToDecorationsHint { get => _extendClientAreaToDecorationsHint; set { - _extendClientAreaToDecorationsHint = value; + _extendClientAreaToDecorationsHint = true; - ExtendClientArea(value); + ExtendClientArea(); + // TODO Trigger transition. } }