core: Be more selective looking for a focusable ancestor

find_focusable_ancestor() may pick an ancestor window which is not
mapped or hidden, and setting focus on that window will fail.

Be a tad more selective when looking for a focusable ancestor, to reduce
the chance of meta_window_focus() not focusing the happy chosen one.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1643>
This commit is contained in:
Olivier Fourdan 2020-12-16 17:59:02 +01:00 committed by Marge Bot
parent afa431547b
commit 76d1a64204

View File

@ -1346,7 +1346,10 @@ find_focusable_ancestor (MetaWindow *window,
{
MetaWorkspaceFocusableAncestorData *data = user_data;
if (!window->unmanaging && meta_window_is_focusable (window) &&
if (!window->unmanaging &&
window->mapped &&
!window->hidden &&
meta_window_is_focusable (window) &&
meta_window_located_on_workspace (window, data->workspace) &&
meta_window_showing_on_its_workspace (window))
{