stack: Check workspace in get_default_focus_window()

Check against the window argument, instead of active workspace.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/850>
This commit is contained in:
Alexander Mikhaylenko 2019-10-12 23:53:19 +05:00
parent 26e06845e3
commit 448ffaefc5

View File

@ -34,6 +34,7 @@
#include "core/frame.h" #include "core/frame.h"
#include "core/meta-workspace-manager-private.h" #include "core/meta-workspace-manager-private.h"
#include "core/window-private.h" #include "core/window-private.h"
#include "core/workspace-private.h"
#include "meta/group.h" #include "meta/group.h"
#include "meta/prefs.h" #include "meta/prefs.h"
#include "meta/workspace.h" #include "meta/workspace.h"
@ -1020,7 +1021,8 @@ window_contains_point (MetaWindow *window,
} }
static gboolean static gboolean
window_can_get_default_focus (MetaWindow *window) window_can_get_default_focus (MetaWindow *window,
MetaWorkspace *workspace)
{ {
if (window->unmaps_pending > 0) if (window->unmaps_pending > 0)
return FALSE; return FALSE;
@ -1031,7 +1033,10 @@ window_can_get_default_focus (MetaWindow *window)
if (!meta_window_is_focusable (window)) if (!meta_window_is_focusable (window))
return FALSE; return FALSE;
if (!meta_window_should_be_showing (window)) if (!meta_window_showing_on_its_workspace (window))
return FALSE;
if (!meta_window_located_on_workspace (window, workspace))
return FALSE; return FALSE;
if (window->type == META_WINDOW_DOCK) if (window->type == META_WINDOW_DOCK)
@ -1067,7 +1072,7 @@ get_default_focus_window (MetaStack *stack,
if (window == not_this_one) if (window == not_this_one)
continue; continue;
if (!window_can_get_default_focus (window)) if (!window_can_get_default_focus (window, workspace))
continue; continue;
if (must_be_at_point && !window_contains_point (window, root_x, root_y)) if (must_be_at_point && !window_contains_point (window, root_x, root_y))
@ -1138,7 +1143,7 @@ meta_stack_get_default_focus_candidates (MetaStack *stack,
{ {
GList *next = l->next; GList *next = l->next;
if (!window_can_get_default_focus (l->data)) if (!window_can_get_default_focus (l->data, workspace))
windows = g_list_delete_link (windows, l); windows = g_list_delete_link (windows, l);
l = next; l = next;