[PATCH v2 0/1] MR10949: winex11.drv: Return WithdrawnState when get_window_wm_state() fails.
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. -- v2: https://gitlab.winehq.org/wine/wine/-/merge_requests/10949
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
On Fri May 22 13:38:43 2026 +0000, Zhiyi Zhang wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/10949/diffs?diff_id=269662&start_sha=a5e0385ea4d31cc7460bbb37c0c7ec5c26c02aec#05752921556c31c592c0243a9ac965ee9808be87_1870_1868) You're right. Maybe I missed something. I will double-check. Let's get the get_window_wm_state() fix in first.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/10949#note_141053
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10949
participants (3)
-
Rémi Bernon (@rbernon) -
Zhiyi Zhang -
Zhiyi Zhang (@zhiyi)