From e75192fe72fc8b61526edc0aee0c6c0c65383873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Thu, 14 Nov 2024 10:43:14 +0100 Subject: [PATCH] winex11: Use the new window state tracker to get _NET_WM_STATE value. --- dlls/winex11.drv/event.c | 8 +++----- dlls/winex11.drv/window.c | 8 ++------ dlls/winex11.drv/x11drv.h | 1 - 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 7c3b2d5ade3..76da5da7886 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -1168,13 +1168,12 @@ static BOOL X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev ) style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); if ((style & WS_CAPTION) == WS_CAPTION || !data->is_fullscreen) { - data->net_wm_state = get_window_net_wm_state( event->display, data->whole_window ); - if ((data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) && !(style & WS_MAXIMIZE)) + if ((data->current_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) && !(style & WS_MAXIMIZE)) { TRACE( "window %p/%lx is maximized\n", data->hwnd, data->whole_window ); config_cmd = SC_MAXIMIZE; } - else if (!(data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) && (style & WS_MAXIMIZE)) + else if (!(data->current_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED)) && (style & WS_MAXIMIZE)) { TRACE( "window %p/%lx is no longer maximized\n", data->hwnd, data->whole_window ); config_cmd = SC_RESTORE; @@ -1294,8 +1293,7 @@ static void handle_wm_state_notify( HWND hwnd, XPropertyEvent *event, BOOL updat if (data->iconic && data->wm_state == NormalState) /* restore window */ { data->iconic = FALSE; - data->net_wm_state = get_window_net_wm_state( event->display, data->whole_window ); - if ((style & WS_CAPTION) == WS_CAPTION && (data->net_wm_state & (1 << NET_WM_STATE_MAXIMIZED))) + if ((style & WS_CAPTION) == WS_CAPTION && (data->current_state.net_wm_state & (1 << NET_WM_STATE_MAXIMIZED))) { if ((style & WS_MAXIMIZEBOX) && !(style & WS_DISABLED)) { diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index aa1eee354ac..878bf3ca157 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -1160,7 +1160,7 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data ) long monitors[4]; XEvent xev; - if (!(data->net_wm_state & (1 << NET_WM_STATE_FULLSCREEN)) || is_virtual_desktop() + if (!(data->pending_state.net_wm_state & (1 << NET_WM_STATE_FULLSCREEN)) || is_virtual_desktop() || NtUserGetWindowLongW( data->hwnd, GWL_STYLE ) & WS_MINIMIZE) return; @@ -1328,7 +1328,7 @@ static void update_net_wm_states( struct x11drv_win_data *data ) style = NtUserGetWindowLongW( data->hwnd, GWL_STYLE ); if (style & WS_MINIMIZE) - new_state |= data->net_wm_state & ((1 << NET_WM_STATE_FULLSCREEN)|(1 << NET_WM_STATE_MAXIMIZED)); + new_state |= data->pending_state.net_wm_state & ((1 << NET_WM_STATE_FULLSCREEN)|(1 << NET_WM_STATE_MAXIMIZED)); if (data->is_fullscreen) { if ((style & WS_MAXIMIZE) && (style & WS_CAPTION) == WS_CAPTION) @@ -1352,7 +1352,6 @@ static void update_net_wm_states( struct x11drv_win_data *data ) } window_set_net_wm_state( data, new_state ); - data->net_wm_state = new_state; update_net_wm_fullscreen_monitors( data ); } @@ -1490,7 +1489,6 @@ static void unmap_window( HWND hwnd ) TRACE( "win %p/%lx\n", data->hwnd, data->whole_window ); window_set_wm_state( data, WithdrawnState ); data->mapped = FALSE; - data->net_wm_state = 0; } release_win_data( data ); } @@ -1613,7 +1611,6 @@ void make_window_embedded( struct x11drv_win_data *data ) { /* the window cannot be mapped before being embedded */ window_set_wm_state( data, WithdrawnState ); - data->net_wm_state = 0; data->embedded = TRUE; data->managed = TRUE; sync_window_style( data ); @@ -2025,7 +2022,6 @@ static void destroy_whole_window( struct x11drv_win_data *data, BOOL already_des data->whole_window = data->client_window = 0; data->whole_colormap = 0; data->wm_state = WithdrawnState; - data->net_wm_state = 0; data->mapped = FALSE; memset( &data->pending_state, 0, sizeof(data->pending_state) ); diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index aecd49ac042..4147e5a0337 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -634,7 +634,6 @@ struct x11drv_win_data UINT is_fullscreen : 1; /* is the window visible rect fullscreen */ UINT parent_invalid : 1; /* is the parent host window possibly invalid */ int wm_state; /* current value of the WM_STATE property */ - DWORD net_wm_state; /* bit mask of active x11drv_net_wm_state values */ Window embedder; /* window id of embedder */ Pixmap icon_pixmap; Pixmap icon_mask;