Skip to content

Commit 8a61eca

Browse files
Extend the client area when a Win32 window is opened in maximised state (#16593)
1 parent 228ecc5 commit 8a61eca

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

+13-8
Original file line numberDiff line numberDiff line change
@@ -614,12 +614,7 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam,
614614
break;
615615

616616
case WindowsMessage.WM_SHOWWINDOW:
617-
_shown = wParam != default;
618-
619-
if (_isClientAreaExtended)
620-
{
621-
ExtendClientArea();
622-
}
617+
OnShowHideMessage(wParam != default);
623618
break;
624619

625620
case WindowsMessage.WM_SIZE:
@@ -801,11 +796,11 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam,
801796
var winPos = Marshal.PtrToStructure<WINDOWPOS>(lParam);
802797
if((winPos.flags & (uint)SetWindowPosFlags.SWP_SHOWWINDOW) != 0)
803798
{
804-
_shown = true;
799+
OnShowHideMessage(true);
805800
}
806801
else if ((winPos.flags & (uint)SetWindowPosFlags.SWP_HIDEWINDOW) != 0)
807802
{
808-
_shown = false;
803+
OnShowHideMessage(false);
809804
}
810805
break;
811806
}
@@ -854,6 +849,16 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam,
854849
return DefWindowProc(hWnd, msg, wParam, lParam);
855850
}
856851

852+
private void OnShowHideMessage(bool shown)
853+
{
854+
_shown = shown;
855+
856+
if (_isClientAreaExtended)
857+
{
858+
ExtendClientArea();
859+
}
860+
}
861+
857862
private Lazy<IReadOnlyList<RawPointerPoint>?>? CreateLazyIntermediatePoints(POINTER_INFO info)
858863
{
859864
var historyCount = Math.Min((int)info.historyCount, MaxPointerHistorySize);

0 commit comments

Comments
 (0)