From: Zhiyi Zhang <zzhang@codeweavers.com> KWin deletes WM_STATE property from a window when entering WithdrawnState. Please see X11Window::exportMappingState() in the KWin source code. So when get_window_wm_state() fails, -1 is returned before this patch. Since -1 is not a valid WM_STATE, it might cause Wine to expect an invalid value. We also can't simply ignore the invalid -1 because we might be expecting the WM_STATE property notify event to change to the desired state. Treating missing WM_STATE property as WithdrawnState seems like the best way to go. Help fix RiME(493200) sometimes fails to restore from Alt+Tab. --- dlls/winex11.drv/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 2983d7bfe8a..c7c97d04527 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1176,7 +1176,7 @@ static int get_window_wm_state( Display *display, Window window ) XID icon; } *state; Atom type; - int format, ret = -1; + int format, ret = WithdrawnState; unsigned long count, remaining; if (!XGetWindowProperty( display, window, x11drv_atom(WM_STATE), 0, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10949