winex11: Avoid requesting unnecessary _NET_WM_STATE changes.

This commit is contained in:
Rémi Bernon 2024-10-24 08:28:09 +02:00 committed by Alexandre Julliard
parent 1f42d452aa
commit 7ac35f13cb
Notes: Alexandre Julliard 2024-11-13 22:30:56 +01:00
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6809

View file

@ -1211,9 +1211,10 @@ static void update_net_wm_fullscreen_monitors( struct x11drv_win_data *data )
static void window_set_net_wm_state( struct x11drv_win_data *data, UINT new_state )
{
UINT i, count;
UINT i, count, old_state = data->pending_state.net_wm_state;
if (!data->whole_window) return; /* no window, nothing to update */
if (old_state == new_state) return; /* states are the same, nothing to update */
if (!data->mapped) /* set the _NET_WM_STATE atom directly */
{
@ -1250,6 +1251,8 @@ static void window_set_net_wm_state( struct x11drv_win_data *data, UINT new_stat
for (i = 0; i < NB_NET_WM_STATES; i++)
{
if (!((old_state ^ new_state) & (1 << i))) continue;
xev.xclient.data.l[0] = (new_state & (1 << i)) ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
xev.xclient.data.l[1] = X11DRV_Atoms[net_wm_state_atoms[i] - FIRST_XATOM];
xev.xclient.data.l[2] = ((net_wm_state_atoms[i] == XATOM__NET_WM_STATE_MAXIMIZED_VERT) ?