Explorar o código

Merge pull request #8393 from Tetedeiench/bugfix-window-margin

Set window margin to 0 WinUiComp is used - issue #8316
Max Katz %!s(int64=3) %!d(string=hai) anos
pai
achega
14de358749
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      src/Windows/Avalonia.Win32/WindowImpl.cs

+ 7 - 4
src/Windows/Avalonia.Win32/WindowImpl.cs

@@ -904,17 +904,20 @@ namespace Avalonia.Win32
                 borderCaptionThickness.top = 1;
                 borderCaptionThickness.top = 1;
             }
             }
 
 
+            //using a default margin of 0 when using WinUiComp removes artefacts when resizing. See issue #8316
+            var defaultMargin = _isUsingComposition ? 0 : 1;
+
             MARGINS margins = new MARGINS();
             MARGINS margins = new MARGINS();
-            margins.cxLeftWidth = 1;
-            margins.cxRightWidth = 1;
-            margins.cyBottomHeight = 1;
+            margins.cxLeftWidth = defaultMargin;
+            margins.cxRightWidth = defaultMargin;
+            margins.cyBottomHeight = defaultMargin;
 
 
             if (_extendTitleBarHint != -1)
             if (_extendTitleBarHint != -1)
             {
             {
                 borderCaptionThickness.top = (int)(_extendTitleBarHint * RenderScaling);
                 borderCaptionThickness.top = (int)(_extendTitleBarHint * RenderScaling);
             }
             }
 
 
-            margins.cyTopHeight = _extendChromeHints.HasAllFlags(ExtendClientAreaChromeHints.SystemChrome) && !_extendChromeHints.HasAllFlags(ExtendClientAreaChromeHints.PreferSystemChrome) ? borderCaptionThickness.top : 1;
+            margins.cyTopHeight = _extendChromeHints.HasAllFlags(ExtendClientAreaChromeHints.SystemChrome) && !_extendChromeHints.HasAllFlags(ExtendClientAreaChromeHints.PreferSystemChrome) ? borderCaptionThickness.top : defaultMargin;
 
 
             if (WindowState == WindowState.Maximized)
             if (WindowState == WindowState.Maximized)
             {
             {