|
|
|
@ -469,10 +469,14 @@ namespace Avalonia.Win32 |
|
|
|
{ |
|
|
|
GetWindowRect(_hwnd, out var rc); |
|
|
|
|
|
|
|
return new PixelPoint(rc.left, rc.top); |
|
|
|
var border = HiddenBorderSize; |
|
|
|
return new PixelPoint(rc.left + border.Width, rc.top + border.Height); |
|
|
|
} |
|
|
|
set |
|
|
|
{ |
|
|
|
var border = HiddenBorderSize; |
|
|
|
value = new PixelPoint(value.X - border.Width, value.Y - border.Height); |
|
|
|
|
|
|
|
SetWindowPos( |
|
|
|
Handle.Handle, |
|
|
|
IntPtr.Zero, |
|
|
|
@ -486,6 +490,24 @@ namespace Avalonia.Win32 |
|
|
|
|
|
|
|
private bool HasFullDecorations => _windowProperties.Decorations == SystemDecorations.Full; |
|
|
|
|
|
|
|
private PixelSize HiddenBorderSize |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
// Windows 10 and 11 add a 7 pixel invisible border on the left/right/bottom of windows for resizing
|
|
|
|
if (Win32Platform.WindowsVersion.Major < 10 || !HasFullDecorations) |
|
|
|
{ |
|
|
|
return PixelSize.Empty; |
|
|
|
} |
|
|
|
|
|
|
|
DwmGetWindowAttribute(_hwnd, (int)DwmWindowAttribute.DWMWA_EXTENDED_FRAME_BOUNDS, out var clientRect, Marshal.SizeOf(typeof(RECT))); |
|
|
|
GetWindowRect(_hwnd, out var frameRect); |
|
|
|
var borderWidth = GetSystemMetrics(SystemMetric.SM_CXBORDER); |
|
|
|
|
|
|
|
return new PixelSize(clientRect.left - frameRect.left - borderWidth, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void Move(PixelPoint point) => Position = point; |
|
|
|
|
|
|
|
public void SetMinMaxSize(Size minSize, Size maxSize) |
|
|
|
|