From: Rémi Bernon rbernon@codeweavers.com
It is updated in window_wm_state_notify on unexpected state changes to match the host state and to avoid requesting the Win32 state again. We can use the window style instead to decide what needs to be changed.
https://bugs.winehq.org/show_bug.cgi?id=57481 --- dlls/winex11.drv/window.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index b99c96f644b..b4895e6c2c6 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1520,7 +1520,7 @@ static void unmap_window( HWND hwnd )
static UINT window_update_client_state( struct x11drv_win_data *data ) { - UINT old_style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); + UINT old_style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ), new_style;
if (!data->managed) return 0; /* unmanaged windows are managed by the Win32 side */ if (data->desired_state.wm_state == WithdrawnState) return 0; /* ignore state changes on invisible windows */ @@ -1529,9 +1529,13 @@ static UINT window_update_client_state( struct x11drv_win_data *data ) if (data->net_wm_state_serial) return 0; /* another _NET_WM_STATE update is pending, wait for it to complete */ if (data->configure_serial) return 0; /* another config update is pending, wait for it to complete */
- switch (MAKELONG(data->desired_state.wm_state, data->current_state.wm_state)) + new_style = old_style & ~(WS_VISIBLE | WS_MINIMIZE | WS_MAXIMIZE); + if (data->current_state.wm_state != WithdrawnState) new_style |= WS_VISIBLE; + if (data->current_state.wm_state == IconicState) new_style |= WS_MINIMIZE; + if (data->current_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) new_style |= WS_MAXIMIZE; + + if ((old_style & WS_MINIMIZE) && !(new_style & WS_MINIMIZE)) { - case MAKELONG(IconicState, NormalState): if ((old_style & WS_CAPTION) == WS_CAPTION && (data->current_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED))) { if ((old_style & WS_MAXIMIZEBOX) && !(old_style & WS_DISABLED)) @@ -1546,14 +1550,14 @@ static UINT window_update_client_state( struct x11drv_win_data *data ) TRACE( "restoring win %p/%lx\n", data->hwnd, data->whole_window ); return MAKELONG(SC_RESTORE, activate); } - break; - case MAKELONG(NormalState, IconicState): + } + if (!(old_style & WS_MINIMIZE) && (new_style & WS_MINIMIZE)) + { if ((old_style & WS_MINIMIZEBOX) && !(old_style & WS_DISABLED)) { TRACE( "minimizing win %p/%lx\n", data->hwnd, data->whole_window ); return SC_MINIMIZE; } - break; }
return 0;