The state change might have applied the new config already, or might have triggered some new requests which would override the new config.
It's also necessary to call again to compute the visible rect from the window rect after taking the new state into account. Minimized windows have a different window / visible rect offset than normal windows for instance.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57577
-- v2: win32u: Check window state updates again after applying new state. winex11: Improve GetWindowStateUpdates traces.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winex11.drv/window.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index bf415f19cb9..1d43c4edbdb 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1622,8 +1622,6 @@ BOOL X11DRV_GetWindowStateUpdates( HWND hwnd, UINT *state_cmd, UINT *config_cmd, { struct x11drv_win_data *data;
- TRACE( "hwnd %p, state_cmd %p, config_cmd %p, rect %p\n", hwnd, state_cmd, config_cmd, rect ); - if (!(data = get_win_data( hwnd ))) return FALSE;
*state_cmd = window_update_client_state( data ); @@ -1632,7 +1630,7 @@ BOOL X11DRV_GetWindowStateUpdates( HWND hwnd, UINT *state_cmd, UINT *config_cmd,
release_win_data( data );
- TRACE( "returning state_cmd %#x, config_cmd %#x, rect %s\n", *state_cmd, *config_cmd, wine_dbgstr_rect(rect) ); + TRACE( "hwnd %p, returning state_cmd %#x, config_cmd %#x, rect %s\n", hwnd, *state_cmd, *config_cmd, wine_dbgstr_rect(rect) ); return *state_cmd || *config_cmd; }
From: Rémi Bernon rbernon@codeweavers.com
The state change might have applied the new config already, or might have triggered some new requests which would override the new config.
It's also necessary to call again to compute the visible rect from the window rect after taking the new state into account. Minimized windows have a different window / visible rect offset than normal windows for instance.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57577 --- dlls/win32u/message.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/win32u/message.c b/dlls/win32u/message.c index d8da5a0f48f..2f1e14c82c8 100644 --- a/dlls/win32u/message.c +++ b/dlls/win32u/message.c @@ -2136,6 +2136,10 @@ static LRESULT handle_internal_message( HWND hwnd, UINT msg, WPARAM wparam, LPAR { if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); 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, &config_cmd, &window_rect ); + if (state_cmd) WARN( "window %p state needs another update, ignoring\n", hwnd ); } if (config_cmd) {
v2: Drop the configure_serial change, it might not be entirely correct: although we won't receive a ConfigureNotify for stack mode only and although it might cause window state updates to be delayed it's not the issue here.
It's incorrect because there might still be some requests and events in-flight, and resetting the serial to 0 will make us consider them as unexpected, and will apply possibly old ConfigureNotify events as if they were used-originated.
We should maybe just not change the serial for such requests, the same is also possibly the case for WM_STATE changes on unmanaged windows where we do the same. It's not been causing any obvious issue so far though, so lets keep it like this for now.