From 5ee76faabdc59f6b3d5e7fc460d5924e204c4915 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Wed, 19 Jul 2023 13:24:55 +0000 Subject: [PATCH 1/3] fix no border resize issue --- src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 2 +- src/Windows/Avalonia.Win32/WindowImpl.cs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 9a7f4b62e3..bdeda9236f 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -59,7 +59,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCCALCSIZE: { - if (ToInt32(wParam) == 1 && !HasFullDecorations || _isClientAreaExtended) + if (ToInt32(wParam) == 1 && _isClientAreaExtended) { return IntPtr.Zero; } diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 044c2cad67..154b20ef84 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -1340,14 +1340,12 @@ namespace Avalonia.Win32 if (!_isFullScreenActive) { - var margin = newProperties.Decorations == SystemDecorations.BorderOnly ? 1 : 0; - var margins = new MARGINS { - cyBottomHeight = margin, - cxRightWidth = margin, - cxLeftWidth = margin, - cyTopHeight = margin + cyBottomHeight = 0, + cxRightWidth = 0, + cxLeftWidth = 0, + cyTopHeight = 0 }; DwmExtendFrameIntoClientArea(_hwnd, ref margins); From 1206996c83d7e89f8ac650a85ebd2751c7575bdb Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Wed, 19 Jul 2023 13:47:05 +0000 Subject: [PATCH 2/3] disable resize for None decorations --- src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index bdeda9236f..f62c99ec4a 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -59,7 +59,7 @@ namespace Avalonia.Win32 case WindowsMessage.WM_NCCALCSIZE: { - if (ToInt32(wParam) == 1 && _isClientAreaExtended) + if (ToInt32(wParam) == 1 && _windowProperties.Decorations == SystemDecorations.None || _isClientAreaExtended) { return IntPtr.Zero; } From 0ce9a6ed87559506d401a0c0d041438080a34409 Mon Sep 17 00:00:00 2001 From: mrxx99 Date: Sun, 23 Jul 2023 19:49:05 +0200 Subject: [PATCH 3/3] Fix creating fields for attached properties called name. closes #12283 --- src/tools/Avalonia.Generators/Common/XamlXNameResolver.cs | 6 ++++++ tests/Avalonia.Generators.Tests/Views/NamedControl.xml | 3 ++- tests/Avalonia.Generators.Tests/Views/xNamedControl.xml | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tools/Avalonia.Generators/Common/XamlXNameResolver.cs b/src/tools/Avalonia.Generators/Common/XamlXNameResolver.cs index 7ed19eb84c..955df90ddd 100644 --- a/src/tools/Avalonia.Generators/Common/XamlXNameResolver.cs +++ b/src/tools/Avalonia.Generators/Common/XamlXNameResolver.cs @@ -38,6 +38,7 @@ internal class XamlXNameResolver : INameResolver, IXamlAstVisitor { if (child is XamlAstXamlPropertyValueNode propertyValueNode && propertyValueNode.Property is XamlAstNamePropertyReference namedProperty && + !IsAttachedProperty(namedProperty) && namedProperty.Name == "Name" && propertyValueNode.Values.Count > 0 && propertyValueNode.Values[0] is XamlAstTextNode text) @@ -89,4 +90,9 @@ internal class XamlXNameResolver : INameResolver, IXamlAstVisitor _ => _defaultFieldModifier }; } + + private static bool IsAttachedProperty(XamlAstNamePropertyReference namedProperty) + { + return !namedProperty.DeclaringType.Equals(namedProperty.TargetType); + } } diff --git a/tests/Avalonia.Generators.Tests/Views/NamedControl.xml b/tests/Avalonia.Generators.Tests/Views/NamedControl.xml index ba1efb247f..0a3c3d3111 100644 --- a/tests/Avalonia.Generators.Tests/Views/NamedControl.xml +++ b/tests/Avalonia.Generators.Tests/Views/NamedControl.xml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Sample.App.NamedControl"> - \ No newline at end of file + diff --git a/tests/Avalonia.Generators.Tests/Views/xNamedControl.xml b/tests/Avalonia.Generators.Tests/Views/xNamedControl.xml index 7eab86411c..3dc6df2c7d 100644 --- a/tests/Avalonia.Generators.Tests/Views/xNamedControl.xml +++ b/tests/Avalonia.Generators.Tests/Views/xNamedControl.xml @@ -2,6 +2,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Sample.App.xNamedControl"> - \ No newline at end of file +