diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 648f01c8c6be..dbde23f71292 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -614,12 +614,7 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam, break; case WindowsMessage.WM_SHOWWINDOW: - _shown = wParam != default; - - if (_isClientAreaExtended) - { - ExtendClientArea(); - } + OnShowHideMessage(wParam != default); break; case WindowsMessage.WM_SIZE: @@ -801,11 +796,11 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam, var winPos = Marshal.PtrToStructure(lParam); if((winPos.flags & (uint)SetWindowPosFlags.SWP_SHOWWINDOW) != 0) { - _shown = true; + OnShowHideMessage(true); } else if ((winPos.flags & (uint)SetWindowPosFlags.SWP_HIDEWINDOW) != 0) { - _shown = false; + OnShowHideMessage(false); } break; } @@ -854,6 +849,16 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam, return DefWindowProc(hWnd, msg, wParam, lParam); } + private void OnShowHideMessage(bool shown) + { + _shown = shown; + + if (_isClientAreaExtended) + { + ExtendClientArea(); + } + } + private Lazy?>? CreateLazyIntermediatePoints(POINTER_INFO info) { var historyCount = Math.Min((int)info.historyCount, MaxPointerHistorySize);