1
0
Fork 0

workspace: Only consider windows that should be showing as focusable

When selecting the default focus window, is_focusable() was not
considering the new conditions for whether a window should be shown or
hidden that were added to meta_window_should_be_showing() in 39942974.
As a result the default focus window could end up a window already
hidden or hidden once meta_window_flush_calc_showing() is called by
meta_window_focus() when focusing the default window. This would cause
meta_window_focus() to fail, which is an issue if it prevents us from
unfocusing a window when it is getting unmanaged.

Fixes: 399429742 ("x11: Integrate frames client into Mutter")
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2644
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2962>
This commit is contained in:
Sebastian Keller 2023-04-15 22:04:39 +02:00
parent a86900091d
commit 6b57ab8975
3 changed files with 17 additions and 7 deletions

View file

@ -669,6 +669,9 @@ void meta_window_resize_frame_with_gravity (MetaWindow *window,
int h,
MetaGravity gravity);
gboolean meta_window_should_be_showing_on_workspace (MetaWindow *window,
MetaWorkspace *workspace);
/* Return whether the window should be currently mapped */
gboolean meta_window_should_be_showing (MetaWindow *window);

View file

@ -1691,10 +1691,9 @@ meta_window_showing_on_its_workspace (MetaWindow *window)
}
gboolean
meta_window_should_be_showing (MetaWindow *window)
meta_window_should_be_showing_on_workspace (MetaWindow *window,
MetaWorkspace *workspace)
{
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
#ifdef HAVE_WAYLAND
if (window->client_type == META_WINDOW_CLIENT_TYPE_WAYLAND)
{
@ -1709,11 +1708,20 @@ meta_window_should_be_showing (MetaWindow *window)
return FALSE;
/* Windows should be showing if they're located on the
* active workspace and they're showing on their own workspace. */
return (meta_window_located_on_workspace (window, workspace_manager->active_workspace) &&
* workspace and they're showing on their own workspace. */
return (meta_window_located_on_workspace (window, workspace) &&
meta_window_showing_on_its_workspace (window));
}
gboolean
meta_window_should_be_showing (MetaWindow *window)
{
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
MetaWorkspace *active_workspace = workspace_manager->active_workspace;
return meta_window_should_be_showing_on_workspace (window, active_workspace);
}
static void
implement_showing (MetaWindow *window,
gboolean showing)

View file

@ -1436,8 +1436,7 @@ is_focusable (MetaWindow *window,
window->unmaps_pending == 0 &&
window->type != META_WINDOW_DOCK &&
meta_window_is_focusable (window) &&
meta_window_located_on_workspace (window, workspace) &&
meta_window_showing_on_its_workspace (window);
meta_window_should_be_showing_on_workspace (window, workspace);
}
static gboolean