From: Cwooper <cwooperm@gmail.com> When the last requested config placed the window at the offscreen sentinel position (-32000,-32000) with 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c index c75197c826e..88eee3421d7 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; @@ -583,6 +584,28 @@ static void wayland_configure_window(HWND hwnd) wayland_surface_coords_to_window(surface, width, height, &window_width, &window_height); + /* Detect a restore from an application-initiated minimize: the last + * requested config placed the window at the offscreen sentinel position + * with WS_MINIMIZE, and the compositor is now sending a configure. Ack + * the configure to avoid a protocol violation and send SC_RESTORE so + * Win32 runs the full restore sequence (clearing WS_MINIMIZE, restoring + * position/size, sending WM_SIZE, etc.), which triggers a new configure + * cycle. */ + restoring_from_minimize = surface->window.rect.left <= -32000 && + surface->window.rect.top <= -32000 && + surface->window.minimized; + 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; + } + SetRect(&rect, 0, 0, window_width, window_height); OffsetRect(&rect, data->rects.window.left, data->rects.window.top); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10487