summaryrefslogtreecommitdiff
path: root/src/core/workspace.c
diff options
context:
space:
mode:
authorrcaridade145 <[email protected]>2020-03-03 20:51:17 +0000
committerVictor Kareh <[email protected]>2020-05-27 11:25:49 -0400
commitf96255beb1b23e47048d1e0479fc53ef4c36b747 (patch)
treedface6d32a02beaacc491d68261ccf6cd82663a1 /src/core/workspace.c
parent8966925b5f7f014e7a809f743ab1725238583790 (diff)
downloadmarco-f96255beb1b23e47048d1e0479fc53ef4c36b747.tar.bz2
marco-f96255beb1b23e47048d1e0479fc53ef4c36b747.tar.xz
workspace: Don't try to use per-workspace MRU lists as a hint for focusing
A prior commit switched from focusing the topmost window as the default window to focusing the MRU window. This was done in alignment with the introduction of per-workspace MRU lists to avoid problems where the window stack was inadvertently changed when focusing windows during window switches. Now that focusing windows don't have as big an impact on the stacking order, we can revert back to focusing the top window, which is less confusing to the user. For now, leave per-workspace MRU lists, as they're a pretty good approximation of a global MRU list, and it works well enough. https://bugzilla.gnome.org/show_bug.cgi?id=620744 Based on commit https://gitlab.gnome.org/GNOME/metacity/-/commit/f628d8f8901f46fa9e00707ae9d7ccfd1e85f427
Diffstat (limited to 'src/core/workspace.c')
-rw-r--r--src/core/workspace.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/src/core/workspace.c b/src/core/workspace.c
index 98c33e20..04ba575b 100644
--- a/src/core/workspace.c
+++ b/src/core/workspace.c
@@ -33,7 +33,7 @@
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
static void set_active_space_hint (MetaScreen *screen);
-static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
+static void focus_ancestor_or_top_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp);
static void free_this (gpointer candidate,
@@ -971,7 +971,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_CLICK ||
!workspace->screen->display->mouse_mode)
- focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
+ focus_ancestor_or_top_window (workspace, not_this_one, timestamp);
else
{
MetaWindow * window;
@@ -1008,7 +1008,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
}
}
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_SLOPPY)
- focus_ancestor_or_mru_window (workspace, not_this_one, timestamp);
+ focus_ancestor_or_top_window (workspace, not_this_one, timestamp);
else if (meta_prefs_get_focus_mode () == META_FOCUS_MODE_MOUSE)
{
meta_topic (META_DEBUG_FOCUS,
@@ -1035,13 +1035,11 @@ record_ancestor (MetaWindow *window,
* window on active workspace
*/
static void
-focus_ancestor_or_mru_window (MetaWorkspace *workspace,
+focus_ancestor_or_top_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp)
{
MetaWindow *window = NULL;
- MetaWindow *desktop_window = NULL;
- GList *tmp;
if (not_this_one)
meta_topic (META_DEBUG_FOCUS,
@@ -1072,36 +1070,8 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace,
}
}
- /* No ancestor, look for the MRU window */
- tmp = workspace->mru_list;
-
- while (tmp)
- {
- MetaWindow* tmp_window;
- tmp_window = ((MetaWindow*) tmp->data);
- if (tmp_window != not_this_one &&
- meta_window_showing_on_its_workspace (tmp_window) &&
- tmp_window->type != META_WINDOW_DOCK &&
- tmp_window->type != META_WINDOW_DESKTOP)
- {
- window = tmp->data;
- break;
- }
- else if (tmp_window != not_this_one &&
- desktop_window == NULL &&
- meta_window_showing_on_its_workspace (tmp_window) &&
- tmp_window->type == META_WINDOW_DESKTOP)
- {
- /* Found the most recently used desktop window */
- desktop_window = tmp_window;
- }
-
- tmp = tmp->next;
- }
-
- /* If no window was found, default to the MRU desktop-window */
- if (window == NULL)
- window = desktop_window;
+ window = meta_stack_get_default_focus_window (workspace->screen->stack,
+ workspace, NULL);
if (window)
{