Browse Source

Revert "use thickness as the ExtendClientArea hint."

This reverts commit 42673554085035e8a8a3435bc623ceb29f72e4db.
Dan Walmsley 5 years ago
parent
commit
aea6f7bff9

+ 1 - 1
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<bool> ExtendClientAreaToDecorationsChanged { get; set; }
         

+ 5 - 5
src/Avalonia.Controls/Window.cs

@@ -92,8 +92,8 @@ namespace Avalonia.Controls
         /// <summary>
         /// Defines the <see cref="ExtendClientAreaToDecorationsHint"/> property.
         /// </summary>
-        public static readonly StyledProperty<Thickness> ExtendClientAreaToDecorationsHintProperty =
-            AvaloniaProperty.Register<Window, Thickness>(nameof(ExtendClientAreaToDecorationsHint), default);
+        public static readonly StyledProperty<bool> ExtendClientAreaToDecorationsHintProperty =
+            AvaloniaProperty.Register<Window, bool>(nameof(ExtendClientAreaToDecorationsHint), false);
 
 
         /// <summary>
@@ -109,7 +109,7 @@ namespace Avalonia.Controls
         /// </summary>
         public static readonly DirectProperty<Window, Thickness> WindowDecorationMarginsProperty =
             AvaloniaProperty.RegisterDirect<Window, Thickness>(nameof(WindowDecorationMargins),
-                o => o.WindowDecorationMargins);        
+                o => o.WindowDecorationMargins);
         
 
         /// <summary>
@@ -190,7 +190,7 @@ namespace Avalonia.Controls
                 (w, e) => { if (w.PlatformImpl != null) w.PlatformImpl.WindowState = (WindowState)e.NewValue; });
 
             ExtendClientAreaToDecorationsHintProperty.Changed.AddClassHandler<Window>(
-                (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<Window>((w, e) => w.PlatformImpl?.SetMinMaxSize(new Size((double)e.NewValue, w.MinHeight), new Size(w.MaxWidth, w.MaxHeight)));
             MinHeightProperty.Changed.AddClassHandler<Window>((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
         /// <summary>
         /// Gets or sets if the ClientArea is Extended into the Window Decorations (chrome or border).
         /// </summary>
-        public Thickness ExtendClientAreaToDecorationsHint
+        public bool ExtendClientAreaToDecorationsHint
         {
             get { return GetValue(ExtendClientAreaToDecorationsHintProperty); }
             set { SetValue(ExtendClientAreaToDecorationsHintProperty, value); }

+ 1 - 1
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<bool> ExtendClientAreaToDecorationsChanged { get; set; }
 

+ 1 - 1
src/Avalonia.DesignerSupport/Remote/Stubs.cs

@@ -39,7 +39,7 @@ namespace Avalonia.DesignerSupport.Remote
 
         public Action<WindowTransparencyLevel> TransparencyLevelChanged { get; set; }
 
-        public Thickness ExtendClientAreaToDecorationsHint { get; set; }
+        public bool ExtendClientAreaToDecorationsHint { get; set; }
 
         public Action<bool> ExtendClientAreaToDecorationsChanged { get; set; }
 

+ 1 - 1
src/Avalonia.Native/WindowImpl.cs

@@ -98,7 +98,7 @@ namespace Avalonia.Native
 
         public Action<WindowState> WindowStateChanged { get; set; }
 
-        public Thickness ExtendClientAreaToDecorationsHint { get; set; }
+        public bool ExtendClientAreaToDecorationsHint { get; set; }
 
         public Action<bool> ExtendClientAreaToDecorationsChanged { get; set; }
 

+ 1 - 1
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<bool> ExtendClientAreaToDecorationsChanged { get; set; }
 

+ 10 - 9
src/Windows/Avalonia.Win32/WindowImpl.cs

@@ -69,7 +69,7 @@ namespace Avalonia.Win32
         private Size _maxSize;
         private POINT _maxTrackSize;
         private WindowImpl _parent;
-        private Thickness _extendClientAreaToDecorationsHint;
+        private bool _extendClientAreaToDecorationsHint;
 
         public WindowImpl()
         {
@@ -666,7 +666,7 @@ namespace Avalonia.Win32
             TaskBarList.MarkFullscreen(_hwnd, fullscreen);
         }
 
-        private void ExtendClientArea (Thickness thickness)
+        private void ExtendClientArea ()
         {
             if (!_isClientAreaExtended)
             {
@@ -690,10 +690,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);
 
@@ -948,14 +948,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.
             }
         }