mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
workspace: Don't try to use per-workspace MRU lists as a hint for focusing
Commit 2fc880db
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
This commit is contained in:
parent
402b477458
commit
a3bf9b01aa
@ -31,8 +31,7 @@ workspaces. In these cases, there needs to be a rule consistent with
|
|||||||
the above about the new window to choose.
|
the above about the new window to choose.
|
||||||
|
|
||||||
Focus method Behavior
|
Focus method Behavior
|
||||||
click Focus the most recently used window (same as the window
|
click Focus the window on top
|
||||||
on top)
|
|
||||||
sloppy Focus the window containing the pointer if there is such
|
sloppy Focus the window containing the pointer if there is such
|
||||||
a window, otherwise focus the most recently used window.
|
a window, otherwise focus the most recently used window.
|
||||||
mouse Focus the non-DESKTOP window containing the pointer if
|
mouse Focus the non-DESKTOP window containing the pointer if
|
||||||
|
@ -42,6 +42,16 @@ struct _MetaWorkspace
|
|||||||
MetaScreen *screen;
|
MetaScreen *screen;
|
||||||
|
|
||||||
GList *windows;
|
GList *windows;
|
||||||
|
|
||||||
|
/* The "MRU list", or "most recently used" list, is a list of
|
||||||
|
* MetaWindows ordered based on the time the the user interacted
|
||||||
|
* with the window most recently.
|
||||||
|
*
|
||||||
|
* For historical reasons, we keep an MRU list per workspace.
|
||||||
|
* It used to be used to calculate the default focused window,
|
||||||
|
* but isn't anymore, as the window next in the stacking order
|
||||||
|
* can sometimes be not the window the user interacted with last,
|
||||||
|
*/
|
||||||
GList *mru_list;
|
GList *mru_list;
|
||||||
|
|
||||||
GList *list_containing_self;
|
GList *list_containing_self;
|
||||||
|
@ -46,7 +46,7 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
|
||||||
static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
static void focus_ancestor_or_top_window (MetaWorkspace *workspace,
|
||||||
MetaWindow *not_this_one,
|
MetaWindow *not_this_one,
|
||||||
guint32 timestamp);
|
guint32 timestamp);
|
||||||
static void free_this (gpointer candidate,
|
static void free_this (gpointer candidate,
|
||||||
@ -1201,7 +1201,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
|
|||||||
|
|
||||||
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
|
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK ||
|
||||||
!workspace->screen->display->mouse_mode)
|
!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
|
else
|
||||||
{
|
{
|
||||||
MetaWindow * window;
|
MetaWindow * window;
|
||||||
@ -1238,7 +1238,7 @@ meta_workspace_focus_default_window (MetaWorkspace *workspace,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_SLOPPY)
|
else if (meta_prefs_get_focus_mode () == G_DESKTOP_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 () == G_DESKTOP_FOCUS_MODE_MOUSE)
|
else if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_MOUSE)
|
||||||
{
|
{
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
@ -1261,17 +1261,13 @@ record_ancestor (MetaWindow *window,
|
|||||||
return FALSE; /* quit with the first ancestor we find */
|
return FALSE; /* quit with the first ancestor we find */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Focus ancestor of not_this_one if there is one, otherwise focus the MRU
|
/* Focus ancestor of not_this_one if there is one */
|
||||||
* window on active workspace
|
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
focus_ancestor_or_top_window (MetaWorkspace *workspace,
|
||||||
MetaWindow *not_this_one,
|
MetaWindow *not_this_one,
|
||||||
guint32 timestamp)
|
guint32 timestamp)
|
||||||
{
|
{
|
||||||
MetaWindow *window = NULL;
|
MetaWindow *window = NULL;
|
||||||
MetaWindow *desktop_window = NULL;
|
|
||||||
GList *tmp;
|
|
||||||
|
|
||||||
if (not_this_one)
|
if (not_this_one)
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
@ -1305,36 +1301,9 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No ancestor, look for the MRU window */
|
window = meta_stack_get_default_focus_window (workspace->screen->stack,
|
||||||
tmp = workspace->mru_list;
|
workspace,
|
||||||
|
NULL);
|
||||||
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;
|
|
||||||
|
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user