Rémi Bernon (@rbernon) commented about dlls/win32u/message.c:
{ case SC_RESTORE: if (HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); + + /* window config might have been changed by set_foreground_window() or NtUserSetActiveWindow(), check again */ + if (foreground || HIWORD(state_cmd)) + { + user_driver->pGetWindowStateUpdates( hwnd, &state_cmd, &swp_flags, &window_rect, &foreground ); + window_rect = map_rect_raw_to_virt( window_rect, get_thread_dpi() ); + }
I think this then depends on whether events have been received already or not, and that's maybe not very deterministic? It is rather a regression from d56f36c1aa0927a19d74bef66586572ad57322de as I believe the NtSetForegroundWindow call above can only be made by the current foreground window, to give foreground to a different window, so it won't trigger extra requests. The requests are caused by the now restored `NtUserSetActiveWindow( hwnd );` call. If we need to avoid doing more operations after changing foreground / focus, which is very much possible, maybe unconditionally skipping the SC_RESTORE message if we called NtUserSetActiveWindow, and wait until we get another state update message is better? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10725#note_137428