From: Cwooper <cwooperm@gmail.com> When a window is at the offscreen sentinel position (-32000,-32000), has WS_MINIMIZE set, and the compositor sends a configure event, ack the configure to avoid a protocol violation and send SC_RESTORE to let Win32 handle the full restore sequence. This matches the XWayland behavior where the user clicks the taskbar to restore. Wine-Bug: http://bugs.winehq.org/show_bug.cgi?id=59577 --- dlls/winewayland.drv/window.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index ea98618ca36..3052429a7aa 100644 --- a/dlls/winewayland.drv/window.c +++ b/dlls/winewayland.drv/window.c @@ -501,6 +501,7 @@ static void wayland_configure_window(HWND hwnd) DWORD style; BOOL needs_enter_size_move = FALSE; BOOL needs_exit_size_move = FALSE; + BOOL restoring_from_minimize = FALSE; struct wayland_win_data *data; RECT rect; LONG saved_window_left, saved_window_top; @@ -589,6 +590,27 @@ static void wayland_configure_window(HWND hwnd) saved_window_left = data->rects.window.left; saved_window_top = data->rects.window.top; + /* Detect restore from minimize: the window is at the offscreen sentinel + * position (-32000,-32000) and the compositor is sending a configure. + * Send SC_RESTORE to let Win32 handle the full restore sequence (clearing + * WS_MINIMIZE, restoring position/size, sending WM_SIZE, etc.). + * We must ack the configure before returning to avoid a protocol + * violation, then let SC_RESTORE trigger a new configure cycle. */ + restoring_from_minimize = saved_window_left <= -32000 && + saved_window_top <= -32000 && + (NtUserGetWindowLongW(hwnd, GWL_STYLE) & WS_MINIMIZE); + if (restoring_from_minimize) + { + TRACE("hwnd=%p restoring from minimize\n", hwnd); + surface->current = surface->processing; + memset(&surface->processing, 0, sizeof(surface->processing)); + xdg_surface_ack_configure(surface->xdg_surface, + surface->current.serial); + wayland_win_data_release(data); + send_message(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); + return; + } + wayland_win_data_release(data); TRACE("processing=%dx%d,%#x\n", width, height, state); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10487