x11/window: Update _NET_WM_DESKTOP when a window becomes all-workspace

When an X11 window becomes an all-workspace window its `workspace` is
set to NULL before `meta_window_x11_current_workspace_changed()` is
called. The latter then checks for `workspace` being NULL (which also
happens when unmanaging) and then returns early. So this does not update
`_NET_WM_DESKTOP` to 0xFFFFFFFF. Instead it remains at the workspace the
window was on before. This was causing programs like `wmctrl` to switch
to this old workspace when activating such a window.

Fix this by checking if the window is unmanaging instead.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2242
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2387>
This commit is contained in:
Sebastian Keller 2022-04-26 19:30:00 +02:00 committed by Marge Bot
parent f361e8032c
commit 5e5480e620

View File

@ -1308,11 +1308,8 @@ meta_window_x11_current_workspace_changed (MetaWindow *window)
*/ */
unsigned long data[1]; unsigned long data[1];
if (window->workspace == NULL) if (window->unmanaging)
{ return;
/* this happens when unmanaging windows */
return;
}
data[0] = meta_window_get_net_wm_desktop (window); data[0] = meta_window_get_net_wm_desktop (window);