diff options
author | Sebastian Keller <skeller@gnome.org> | 2023-04-15 22:04:39 +0200 |
---|---|---|
committer | Sebastian Keller <skeller@gnome.org> | 2023-04-16 11:48:37 +0200 |
commit | 6b57ab897582dfc8dce09ca343bdca6f3371f037 (patch) | |
tree | 8ca8f1a9e7280d6ebdcfc05fc8fd25ff77366c6c | |
parent | a86900091de30715da5f2f3181cb5314358e8e13 (diff) | |
download | mutter-6b57ab897582dfc8dce09ca343bdca6f3371f037.tar.gz |
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>
-rw-r--r-- | src/core/window-private.h | 3 | ||||
-rw-r--r-- | src/core/window.c | 18 | ||||
-rw-r--r-- | src/core/workspace.c | 3 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/core/window-private.h b/src/core/window-private.h index 1e188d0c7..1c1215972 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -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); diff --git a/src/core/window.c b/src/core/window.c index 2ce0b6687..e1ac1f7eb 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -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) diff --git a/src/core/workspace.c b/src/core/workspace.c index 2c091768e..a70791b46 100644 --- a/src/core/workspace.c +++ b/src/core/workspace.c @@ -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 |