From: Rémi Bernon rbernon@codeweavers.com
When restoring a window, so that the window gets restored to the size it currently has from the host point of view. Either the host already has restored it to its original size, or it will shortly, but we should avoid requesting config changes concurrently if possible.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58804 --- dlls/win32u/message.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index ba6299d3dcd..a38ac1eff77 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2229,18 +2229,27 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR HWND foreground;
if (!user_driver->pGetWindowStateUpdates( hwnd, &state_cmd, &swp_flags, &window_rect, &foreground )) return 0; + window_rect = map_rect_raw_to_virt( window_rect, get_thread_dpi() ); + if (foreground) NtUserSetForegroundWindow( foreground ); - if (state_cmd) + switch (LOWORD(state_cmd)) { - if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); + case SC_MAXIMIZE: + case SC_MINIMIZE: send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); - - /* state change might have changed the window config already, check again */ - user_driver->pGetWindowStateUpdates( hwnd, &state_cmd, &swp_flags, &window_rect, &foreground ); - if (foreground) NtUserSetForegroundWindow( foreground ); - if (state_cmd) WARN( "window %p state needs another update, ignoring\n", hwnd ); + break; + case SC_RESTORE: + if (HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); + NtUserSetInternalWindowPos( hwnd, SW_SHOW, &window_rect, NULL ); + send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); + break; + default: + if (!swp_flags) break; + NtUserSetWindowPos( hwnd, 0, window_rect.left, window_rect.top, window_rect.right - window_rect.left, + window_rect.bottom - window_rect.top, swp_flags ); + break; } - if (swp_flags) NtUserSetRawWindowPos( hwnd, window_rect, swp_flags, FALSE ); + return 0; } case WM_WINE_UPDATEWINDOWSTATE: