Browse Source

Merge pull request #5622 from AvaloniaUI/fixes/win32-window-sizing-extended-client-area

fix window sizing when client area is extended on win32
pull/5648/head
Dan Walmsley 5 years ago
committed by GitHub
parent
commit
5b458740a9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/Windows/Avalonia.Win32/WindowImpl.cs

14
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -84,6 +84,7 @@ namespace Avalonia.Win32
private WindowImpl _parent; private WindowImpl _parent;
private ExtendClientAreaChromeHints _extendChromeHints = ExtendClientAreaChromeHints.Default; private ExtendClientAreaChromeHints _extendChromeHints = ExtendClientAreaChromeHints.Default;
private bool _isCloseRequested; private bool _isCloseRequested;
private bool _shown;
public WindowImpl() public WindowImpl()
{ {
@ -565,6 +566,7 @@ namespace Avalonia.Win32
public void Hide() public void Hide()
{ {
UnmanagedMethods.ShowWindow(_hwnd, ShowWindowCommand.Hide); UnmanagedMethods.ShowWindow(_hwnd, ShowWindowCommand.Hide);
_shown = false;
} }
public virtual void Show(bool activate) public virtual void Show(bool activate)
@ -871,6 +873,11 @@ namespace Avalonia.Win32
private void ExtendClientArea() private void ExtendClientArea()
{ {
if (!_shown)
{
return;
}
if (DwmIsCompositionEnabled(out bool compositionEnabled) < 0 || !compositionEnabled) if (DwmIsCompositionEnabled(out bool compositionEnabled) < 0 || !compositionEnabled)
{ {
_isClientAreaExtended = false; _isClientAreaExtended = false;
@ -916,6 +923,13 @@ namespace Avalonia.Win32
private void ShowWindow(WindowState state, bool activate) private void ShowWindow(WindowState state, bool activate)
{ {
_shown = true;
if (_isClientAreaExtended)
{
ExtendClientArea();
}
ShowWindowCommand? command; ShowWindowCommand? command;
var newWindowProperties = _windowProperties; var newWindowProperties = _windowProperties;

Loading…
Cancel
Save