core: Synchronize client window mapped state before showing window

The meta_window_show() method internally relies on window->mapped being
up-to-date, or attempting to focus it may fail since the window is not
mapped yet, resulting on the window being mapped, but not focused as
it would be expected.

This is moot so far, since windows with frames are created sort-of
synchronously and showing them will result in the focus attempt happening
when the window is already mapped, but things will break when this
becomes an asynchronous step.

Ensure to synchronize client state before showing, so any attempts to
focus the window are able to succeed despite the initial state when
calling meta_window_update_visibility().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
This commit is contained in:
Carlos Garnacho 2022-11-20 19:24:07 +01:00 committed by Marge Bot
parent 9135931385
commit a60863838e

View File

@ -1741,13 +1741,18 @@ implement_showing (MetaWindow *window,
meta_window_force_placement (window, FALSE); meta_window_force_placement (window, FALSE);
meta_window_hide (window); meta_window_hide (window);
}
else
meta_window_show (window);
if (!window->override_redirect) if (!window->override_redirect)
sync_client_window_mapped (window); sync_client_window_mapped (window);
} }
else
{
if (!window->override_redirect)
sync_client_window_mapped (window);
meta_window_show (window);
}
}
void void
meta_window_update_visibility (MetaWindow *window) meta_window_update_visibility (MetaWindow *window)