From 87ea0d2ffab5244da0a93c74405d556c8d46ee05 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Tue, 18 Jun 2024 09:07:25 +0000 Subject: [PATCH] Win32 - set internal _shown flag if ShowWindow will make window visible (#16029) * win32- set internal _shown flag if ShowWindow will make window visible * check window visibility state from WM_WINDOWPOSCHANGED message --- src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs index 737172943b7..29d4a614dea 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs @@ -790,6 +790,17 @@ protected virtual unsafe IntPtr AppWndProc(IntPtr hWnd, uint msg, IntPtr wParam, return UiaCoreProviderApi.UiaReturnRawElementProvider(_hwnd, wParam, lParam, node); } break; + case WindowsMessage.WM_WINDOWPOSCHANGED: + var winPos = Marshal.PtrToStructure(lParam); + if((winPos.flags & (uint)SetWindowPosFlags.SWP_SHOWWINDOW) != 0) + { + _shown = true; + } + else if ((winPos.flags & (uint)SetWindowPosFlags.SWP_HIDEWINDOW) != 0) + { + _shown = false; + } + break; } #if USE_MANAGED_DRAG