[PATCH 0/1] MR10987: winex11.drv: Wait for the previous request when transitioning from IconicState to NormalState.
Fix a regression from 4c07e556. ea44fc34 is also related. Due to ea44fc34, when calling window_set_wm_state(WithdrawnState), Wine doesn't wait for the previous WM_STATE update to be completed. So when calling window_set_wm_state(WithdrawnState) and then window_set_wm_state(NormalState), the queued NormalState can be overwritten by an unexpected IconicState property notify event from a previous request, causing a window to be stuck in IconicState. For example, ``` 40551.339:012c:fixme:x11drv:window_set_wm_state calling XIconifyWindow for hwnd 0x200ae. ... 40551.340:012c:warn:x11drv:window_set_wm_state window 0x200ae/aa00003 is iconic, remapping to workaround Mutter issues. data->current_state.wm_state 1 data->pending_state.wm_state 3. 40551.340:012c:trace:x11drv:window_set_wm_state window 0x200ae/aa00003, requesting WM_STATE 0x3 -> 0 serial 5227, foreground 0x10020, activate 0 ... 40551.342:012c:warn:x11drv:handle_state_change window 0x200ae/aa00003 mismatch WM_STATE 0x3/5232, expected 0/5227 ``` Fix RiME(493200) sometimes fails to restore from Alt+Tab. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10987
From: Zhiyi Zhang <zzhang@codeweavers.com> Fix a regression from 4c07e556. ea44fc34 is also related. Due to ea44fc34, when calling window_set_wm_state(WithdrawnState), Wine doesn't wait for the previous WM_STATE update to be completed. So when calling window_set_wm_state(WithdrawnState) and then window_set_wm_state(NormalState), the queued NormalState can be overwritten by an unexpected IconicState property notify event from a previous request, causing a window to be stuck in IconicState. For example, ``` 40551.339:012c:fixme:x11drv:window_set_wm_state calling XIconifyWindow for hwnd 0x200ae. ... 40551.340:012c:warn:x11drv:window_set_wm_state window 0x200ae/aa00003 is iconic, remapping to workaround Mutter issues. data->current_state.wm_state 1 data->pending_state.wm_state 3. 40551.340:012c:trace:x11drv:window_set_wm_state window 0x200ae/aa00003, requesting WM_STATE 0x3 -> 0 serial 5227, foreground 0x10020, activate 0 ... 40551.342:012c:warn:x11drv:handle_state_change window 0x200ae/aa00003 mismatch WM_STATE 0x3/5232, expected 0/5227 ``` Fix RiME(493200) sometimes fails to restore from Alt+Tab. --- dlls/winex11.drv/window.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index d2d53a40be3..c3d3312581d 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1588,6 +1588,10 @@ static void window_set_wm_state( struct x11drv_win_data *data, UINT new_state, B * to WithdrawnState first, then to NormalState */ if (data->managed && MAKELONG(old_state, new_state) == MAKELONG(IconicState, NormalState)) { + /* Previous IconicState request is still pending, wait for it to complete so that there is no + * unexpected IconicState WM_STATE notify that will override the NormalState soon to be queued */ + if (data->wm_state_serial) return; + WARN( "window %p/%lx is iconic, remapping to workaround Mutter issues.\n", data->hwnd, data->whole_window ); window_set_wm_state( data, WithdrawnState, FALSE ); window_set_wm_state( data, NormalState, activate ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10987
Fix the bug on KWin mentioned at https://gitlab.winehq.org/wine/wine/-/merge_requests/10949 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10987#note_141165
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10987
participants (3)
-
Rémi Bernon (@rbernon) -
Zhiyi Zhang -
Zhiyi Zhang (@zhiyi)