[PATCH resend] winex11.drv: Always enable minimize/maximize functions for minimized windows.
Zhiyi Zhang
zzhang at codeweavers.com
Thu Nov 12 19:54:18 CST 2020
On 11/12/20 11:36 PM, Gabriel Ivăncescu wrote:
> A window without a minimize or maximize box can still be programmatically
> minimized by the Windows API. However, some WMs will refuse to change the
> state and not allow it to be maximized again, despite it being minimized,
> due to lacking those functions, thus not sending WM_STATE change notifications
> when clicking the minimized window on the taskbar.
>
> Heroes of Might and Magic V does this, for example, when losing focus. It
> minimizes itself. When maximizing it by clicking on the taskbar it won't
> send a WM_STATE change notification (since it was never changed) and fail
> to maximize properly, showing a black screen (the game will still think it
> is minimized).
>
> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
> ---
> dlls/winex11.drv/window.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
> index 4571739..aba6a1a 100644
> --- a/dlls/winex11.drv/window.c
> +++ b/dlls/winex11.drv/window.c
> @@ -750,6 +750,10 @@ static void set_mwm_hints( struct x11drv_win_data *data, DWORD style, DWORD ex_s
> if (style & WS_MINIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MINIMIZE;
> if (style & WS_MAXIMIZEBOX) mwm_hints.functions |= MWM_FUNC_MAXIMIZE;
> if (style & WS_SYSMENU) mwm_hints.functions |= MWM_FUNC_CLOSE;
> +
> + /* The window can be programmatically minimized even without
> + a minimize box button. Allow the WM to restore it. */
> + if (data->iconic) mwm_hints.functions |= MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE;
I think you can use if (style & WS_MINIMIZE) here and not moving set_wm_hints() after data->iconic.
> }
> }
>
> @@ -2487,8 +2491,8 @@ void CDECL X11DRV_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags
> }
> else if ((swp_flags & SWP_STATECHANGED) && (!data->iconic != !(new_style & WS_MINIMIZE)))
> {
> - set_wm_hints( data );
> data->iconic = (new_style & WS_MINIMIZE) != 0;
> + set_wm_hints( data );
> TRACE( "changing win %p iconic state to %u\n", data->hwnd, data->iconic );
> if (data->iconic)
> XIconifyWindow( data->display, data->whole_window, data->vis.screen );
More information about the wine-devel
mailing list