From 79665bfc742a85a76c9ba3db6ff3242e3c67393b Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 5 Apr 2021 20:42:23 +0100 Subject: [PATCH 1/6] maintain the client size when switching between extended and non extended client areas. Previously the client area would grow to fill the window. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index a42dd5fc07..feffa03d15 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -883,20 +883,19 @@ namespace Avalonia.Win32 _isClientAreaExtended = false; return; } - - GetWindowRect(_hwnd, out var rcClient); + GetClientRect(_hwnd, out var rcClient); + GetWindowRect(_hwnd, out var rcWindow); // Inform the application of the frame change. SetWindowPos(_hwnd, - IntPtr.Zero, - rcClient.left, rcClient.top, - rcClient.Width, rcClient.Height, - SetWindowPosFlags.SWP_FRAMECHANGED); - + IntPtr.Zero, + rcWindow.left, rcWindow.top, + rcClient.Width, rcClient.Height, + SetWindowPosFlags.SWP_FRAMECHANGED); + if (_isClientAreaExtended && WindowState != WindowState.FullScreen) { var margins = UpdateExtendMargins(); - DwmExtendFrameIntoClientArea(_hwnd, ref margins); } else @@ -906,6 +905,8 @@ namespace Avalonia.Win32 _offScreenMargin = new Thickness(); _extendedMargins = new Thickness(); + + Resize(new Size(rcWindow.Width, rcWindow.Height)); } if(!_isClientAreaExtended || (_extendChromeHints.HasFlagCustom(ExtendClientAreaChromeHints.SystemChrome) && From 9c192f0e3784c3d1262ea98a7622d4564292a56d Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 5 Apr 2021 20:46:37 +0100 Subject: [PATCH 2/6] whitespace. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index feffa03d15..48baf00177 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -892,7 +892,7 @@ namespace Avalonia.Win32 rcWindow.left, rcWindow.top, rcClient.Width, rcClient.Height, SetWindowPosFlags.SWP_FRAMECHANGED); - + if (_isClientAreaExtended && WindowState != WindowState.FullScreen) { var margins = UpdateExtendMargins(); From 2de40fafd2dc235a55c093a70fec46e0aa912940 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 5 Apr 2021 20:47:28 +0100 Subject: [PATCH 3/6] whitespace. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 48baf00177..b87abdd5ed 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -892,7 +892,7 @@ namespace Avalonia.Win32 rcWindow.left, rcWindow.top, rcClient.Width, rcClient.Height, SetWindowPosFlags.SWP_FRAMECHANGED); - + if (_isClientAreaExtended && WindowState != WindowState.FullScreen) { var margins = UpdateExtendMargins(); From 1b681688f78a9280378f4968671bedd56b7c09d5 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 6 Apr 2021 14:30:50 +0100 Subject: [PATCH 4/6] take into account render scaling. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index b87abdd5ed..3e1c8238b3 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -906,7 +906,7 @@ namespace Avalonia.Win32 _offScreenMargin = new Thickness(); _extendedMargins = new Thickness(); - Resize(new Size(rcWindow.Width, rcWindow.Height)); + Resize(new Size(rcWindow.Width/ RenderScaling, rcWindow.Height / RenderScaling)); } if(!_isClientAreaExtended || (_extendChromeHints.HasFlagCustom(ExtendClientAreaChromeHints.SystemChrome) && From 60a0ec9a3a3a7247e8ac1ad33cede8a5d2cda757 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 6 Apr 2021 15:17:22 +0100 Subject: [PATCH 5/6] take into account the extended mode when Resize is called. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 3e1c8238b3..b68203cb5a 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -483,8 +483,8 @@ namespace Avalonia.Win32 IntPtr.Zero, 0, 0, - requestedClientWidth + (windowRect.Width - clientRect.Width), - requestedClientHeight + (windowRect.Height - clientRect.Height), + requestedClientWidth + (_isClientAreaExtended ? 0 : windowRect.Width - clientRect.Width), + requestedClientHeight + (_isClientAreaExtended ? 0 : windowRect.Height - clientRect.Height), SetWindowPosFlags.SWP_RESIZE); } } From d1028cd3b862172331251175e5bdb17da338ab81 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 6 Apr 2021 16:20:14 +0100 Subject: [PATCH 6/6] get rid of dodgy logo... sorry --- readme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/readme.md b/readme.md index f73bdffaeb..67b706f428 100644 --- a/readme.md +++ b/readme.md @@ -2,8 +2,6 @@
[![NuGet](https://img.shields.io/nuget/v/Avalonia.svg)](https://www.nuget.org/packages/Avalonia) [![downloads](https://img.shields.io/nuget/dt/avalonia)](https://www.nuget.org/packages/Avalonia) [![MyGet](https://img.shields.io/myget/avalonia-ci/vpre/Avalonia.svg?label=myget)](https://www.myget.org/gallery/avalonia-ci) ![Size](https://img.shields.io/github/repo-size/avaloniaui/avalonia.svg) -Avalonia - ## 📖 About AvaloniaUI Avalonia is a cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of Operating Systems such as Windows via .NET Framework and .NET Core, Linux via Xorg, macOS. Avalonia is ready for **General-Purpose Desktop App Development**. However, there may be some bugs and breaking changes as we continue along into this project's development.