From: Rémi Bernon rbernon@codeweavers.com
The new state tracker desired_state.wm_state can now be used instead. --- dlls/winex11.drv/window.c | 29 +++++++++++++++-------------- dlls/winex11.drv/x11drv.h | 1 - 2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index baa053ef601..837aaacb25f 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1486,7 +1486,6 @@ static void map_window( HWND hwnd, DWORD new_style ) TRACE( "win %p/%lx\n", data->hwnd, data->whole_window ); window_set_wm_state( data, (new_style & WS_MINIMIZE) ? IconicState : NormalState ); data->mapped = TRUE; - data->iconic = (new_style & WS_MINIMIZE) != 0; } release_win_data( data ); } @@ -1521,9 +1520,9 @@ 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 */
- if (data->iconic && data->current_state.wm_state == NormalState) /* restore window */ + switch (MAKELONG(data->desired_state.wm_state, data->current_state.wm_state)) { - data->iconic = FALSE; + 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)) @@ -1538,15 +1537,14 @@ 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); } - } - else if (!data->iconic && data->current_state.wm_state == IconicState) - { - data->iconic = TRUE; + break; + case MAKELONG(NormalState, IconicState): 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; @@ -1558,8 +1556,7 @@ UINT window_update_client_config( struct x11drv_win_data *data ) RECT rect, old_rect = data->rects.window, new_rect;
if (!data->managed) return 0; /* unmanaged windows are managed by the Win32 side */ - if (!data->mapped) return 0; /* ignore config changes on invisible windows */ - if (data->iconic) return 0; /* ignore config changes on minimized windows */ + if (data->desired_state.wm_state != NormalState) return 0; /* ignore config changes on invisible/minimized windows */
if (data->wm_state_serial) return 0; /* another WM_STATE update is pending, wait for it to complete */ if (data->net_wm_state_serial) return 0; /* another _NET_WM_STATE update is pending, wait for it to complete */ @@ -1736,7 +1733,7 @@ static void sync_window_position( struct x11drv_win_data *data, UINT swp_flags ) DWORD ex_style = NtUserGetWindowLongW( data->hwnd, GWL_EXSTYLE ); BOOL above = FALSE;
- if (data->managed && data->iconic) return; + if (data->managed && data->desired_state.wm_state == IconicState) return;
if (!(swp_flags & SWP_NOZORDER) || (swp_flags & SWP_SHOWWINDOW)) { @@ -2889,13 +2886,18 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN { struct x11drv_thread_data *thread_data; struct x11drv_win_data *data; - UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ); + UINT new_style = NtUserGetWindowLongW( hwnd, GWL_STYLE ), old_style; struct window_rects old_rects; BOOL was_fullscreen; int event_type;
if (!(data = get_win_data( hwnd ))) return;
+ old_style = new_style & ~(WS_VISIBLE | WS_MINIMIZE | WS_MAXIMIZE); + if (data->desired_state.wm_state != WithdrawnState) old_style |= WS_VISIBLE; + if (data->desired_state.wm_state == IconicState) old_style |= WS_MINIMIZE; + if (data->desired_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) old_style |= WS_MAXIMIZE; + thread_data = x11drv_thread_data();
old_rects = data->rects; @@ -2982,9 +2984,8 @@ void X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, HWND owner_hint, UIN if (needs_map) map_window( hwnd, new_style ); return; } - else if ((swp_flags & SWP_STATECHANGED) && (!data->iconic != !(new_style & WS_MINIMIZE))) + else if ((swp_flags & SWP_STATECHANGED) && ((old_style ^ new_style) & WS_MINIMIZE)) { - data->iconic = (new_style & WS_MINIMIZE) != 0; window_set_wm_state( data, (new_style & WS_MINIMIZE) ? IconicState : NormalState ); update_net_wm_states( data ); } @@ -3034,7 +3035,7 @@ UINT X11DRV_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp ) } goto done; } - if (!data->managed || !data->mapped || data->iconic) goto done; + if (!data->managed || data->desired_state.wm_state != NormalState) goto done;
/* only fetch the new rectangle if the ShowWindow was a result of a window manager event */
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 38503667f23..20f7e76bfe4 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -623,7 +623,6 @@ struct x11drv_win_data XIC xic; /* X input context */ UINT managed : 1; /* is window managed? */ UINT mapped : 1; /* is window mapped? (in either normal or iconic state) */ - UINT iconic : 1; /* is window in iconic state? */ UINT embedded : 1; /* is window an XEMBED client? */ UINT shaped : 1; /* is window using a custom region shape? */ UINT layered : 1; /* is window layered and with valid attributes? */