From 8bbc193178b209962c97a88c1557441484aa5157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 14 Nov 2024 11:26:41 +0100 Subject: [PATCH] winex11: Wait for pending _NET_WM_STATE before updating the client state. --- dlls/winex11.drv/event.c | 10 +++++++++- dlls/winex11.drv/window.c | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 82e82e6bc71..7a9626b4542 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1247,12 +1247,20 @@ static void handle_xembed_info_notify( HWND hwnd, XPropertyEvent *event ) static void handle_net_wm_state_notify( HWND hwnd, XPropertyEvent *event ) { struct x11drv_win_data *data; - UINT value = 0; + UINT value = 0, state_cmd = 0; if (!(data = get_win_data( hwnd ))) return; if (event->state == PropertyNewValue) value = get_window_net_wm_state( event->display, event->window ); window_net_wm_state_notify( data, event->serial, value ); + + state_cmd = window_update_client_state( data ); release_win_data( data ); + + if (state_cmd) + { + if (LOWORD(state_cmd) == SC_RESTORE && HIWORD(state_cmd)) NtUserSetActiveWindow( hwnd ); + send_message( hwnd, WM_SYSCOMMAND, LOWORD(state_cmd), 0 ); + } } /*********************************************************************** diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 66a78e868ec..53220120fb0 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1503,6 +1503,9 @@ UINT window_update_client_state( struct x11drv_win_data *data ) if (!data->managed) return 0; /* unmanaged windows are managed by the Win32 side */ if (!data->mapped) return 0; /* ignore state changes on invisible windows */ + if (data->wm_state_serial) return 0; /* another WM_STATE update is pending, wait for it to complete */ + if (data->net_wm_state_serial) return 0; /* another _NET_WM_STATE update is pending, wait for it to complete */ + if (data->iconic && data->current_state.wm_state == NormalState) /* restore window */ { data->iconic = FALSE;