Browse Source
Merge pull request #9695 from AvaloniaUI/rounded_corner
Windows - Set rounded corners when client is extended
pull/9763/head
Max Katz
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
20 additions and
0 deletions
-
src/Windows/Avalonia.Win32/Interop/UnmanagedMethods.cs
-
src/Windows/Avalonia.Win32/WindowImpl.cs
|
|
|
@ -820,6 +820,14 @@ namespace Avalonia.Win32.Interop |
|
|
|
DWMWA_LAST |
|
|
|
}; |
|
|
|
|
|
|
|
public enum DwmWindowCornerPreference : uint |
|
|
|
{ |
|
|
|
DWMWCP_DEFAULT = 0, |
|
|
|
DWMWCP_DONOTROUND, |
|
|
|
DWMWCP_ROUND, |
|
|
|
DWMWCP_ROUNDSMALL |
|
|
|
} |
|
|
|
|
|
|
|
public enum MapVirtualKeyMapTypes : uint |
|
|
|
{ |
|
|
|
MAPVK_VK_TO_VSC = 0x00, |
|
|
|
|
|
|
|
@ -1029,6 +1029,12 @@ namespace Avalonia.Win32 |
|
|
|
{ |
|
|
|
var margins = UpdateExtendMargins(); |
|
|
|
DwmExtendFrameIntoClientArea(_hwnd, ref margins); |
|
|
|
|
|
|
|
unsafe |
|
|
|
{ |
|
|
|
int cornerPreference = (int)DwmWindowCornerPreference.DWMWCP_ROUND; |
|
|
|
DwmSetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(int)); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -1039,6 +1045,12 @@ namespace Avalonia.Win32 |
|
|
|
_extendedMargins = new Thickness(); |
|
|
|
|
|
|
|
Resize(new Size(rcWindow.Width / RenderScaling, rcWindow.Height / RenderScaling), PlatformResizeReason.Layout); |
|
|
|
|
|
|
|
unsafe |
|
|
|
{ |
|
|
|
int cornerPreference = (int)DwmWindowCornerPreference.DWMWCP_DEFAULT; |
|
|
|
DwmSetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_WINDOW_CORNER_PREFERENCE, &cornerPreference, sizeof(int)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!_isClientAreaExtended || (_extendChromeHints.HasAllFlags(ExtendClientAreaChromeHints.SystemChrome) && |
|
|
|
|