|
|
@ -271,9 +271,7 @@ namespace Avalonia.Win32 |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_decorated = value; |
|
|
UpdateWMStyles(()=> _decorated = value); |
|
|
|
|
|
|
|
|
UpdateWMStyles(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Invalidate(Rect rect) |
|
|
public void Invalidate(Rect rect) |
|
|
@ -886,8 +884,13 @@ namespace Avalonia.Win32 |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void UpdateWMStyles() |
|
|
private void UpdateWMStyles(Action change) |
|
|
{ |
|
|
{ |
|
|
|
|
|
var decorated = _decorated; |
|
|
|
|
|
var resizable = _resizable; |
|
|
|
|
|
|
|
|
|
|
|
change(); |
|
|
|
|
|
|
|
|
var style = (WindowStyles)GetWindowLong(_hwnd, (int)WindowLongParam.GWL_STYLE); |
|
|
var style = (WindowStyles)GetWindowLong(_hwnd, (int)WindowLongParam.GWL_STYLE); |
|
|
|
|
|
|
|
|
const WindowStyles controlledFlags = WindowStyles.WS_OVERLAPPEDWINDOW; |
|
|
const WindowStyles controlledFlags = WindowStyles.WS_OVERLAPPEDWINDOW; |
|
|
@ -912,31 +915,33 @@ namespace Avalonia.Win32 |
|
|
|
|
|
|
|
|
UnmanagedMethods.GetWindowRect(_hwnd, out var windowRect); |
|
|
UnmanagedMethods.GetWindowRect(_hwnd, out var windowRect); |
|
|
|
|
|
|
|
|
Rect newRect; |
|
|
if (decorated != _decorated) |
|
|
|
|
|
|
|
|
if (_decorated) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var thickness = BorderThickness; |
|
|
Rect newRect; |
|
|
|
|
|
|
|
|
newRect = new Rect( |
|
|
if (_decorated) |
|
|
windowRect.left - thickness.Left, |
|
|
{ |
|
|
windowRect.top - thickness.Top, |
|
|
var thickness = BorderThickness; |
|
|
(windowRect.right - windowRect.left) + (thickness.Left + thickness.Right), |
|
|
|
|
|
(windowRect.bottom - windowRect.top) + (thickness.Top + thickness.Bottom)); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
newRect = new Rect( |
|
|
|
|
|
windowRect.left + oldThickness.Left, |
|
|
|
|
|
windowRect.top + oldThickness.Top, |
|
|
|
|
|
(windowRect.right - windowRect.left) - (oldThickness.Left + oldThickness.Right), |
|
|
|
|
|
(windowRect.bottom - windowRect.top) - (oldThickness.Top + oldThickness.Bottom)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UnmanagedMethods.SetWindowPos(_hwnd, IntPtr.Zero, (int)newRect.X, (int)newRect.Y, (int)newRect.Width, |
|
|
newRect = new Rect( |
|
|
(int)newRect.Height, |
|
|
windowRect.left - thickness.Left, |
|
|
UnmanagedMethods.SetWindowPosFlags.SWP_NOZORDER | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_FRAMECHANGED); |
|
|
windowRect.top - thickness.Top, |
|
|
|
|
|
(windowRect.right - windowRect.left) + (thickness.Left + thickness.Right), |
|
|
|
|
|
(windowRect.bottom - windowRect.top) + (thickness.Top + thickness.Bottom)); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
newRect = new Rect( |
|
|
|
|
|
windowRect.left + oldThickness.Left, |
|
|
|
|
|
windowRect.top + oldThickness.Top, |
|
|
|
|
|
(windowRect.right - windowRect.left) - (oldThickness.Left + oldThickness.Right), |
|
|
|
|
|
(windowRect.bottom - windowRect.top) - (oldThickness.Top + oldThickness.Bottom)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
UnmanagedMethods.SetWindowPos(_hwnd, IntPtr.Zero, (int)newRect.X, (int)newRect.Y, (int)newRect.Width, |
|
|
|
|
|
(int)newRect.Height, |
|
|
|
|
|
UnmanagedMethods.SetWindowPosFlags.SWP_NOZORDER | UnmanagedMethods.SetWindowPosFlags.SWP_NOACTIVATE | SetWindowPosFlags.SWP_FRAMECHANGED); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void CanResize(bool value) |
|
|
public void CanResize(bool value) |
|
|
@ -946,9 +951,7 @@ namespace Avalonia.Win32 |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_resizable = value; |
|
|
UpdateWMStyles(()=> _resizable = value); |
|
|
|
|
|
|
|
|
UpdateWMStyles(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void SetTopmost(bool value) |
|
|
public void SetTopmost(bool value) |
|
|
|