summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/how-to-get-focus-right.txt2
-rw-r--r--src/core/stack.c1
-rw-r--r--src/core/window.c2
-rw-r--r--src/core/workspace.c42
-rw-r--r--src/core/workspace.h11
5 files changed, 18 insertions, 40 deletions
diff --git a/doc/how-to-get-focus-right.txt b/doc/how-to-get-focus-right.txt
index 45c0f378..b9ccee6d 100644
--- a/doc/how-to-get-focus-right.txt
+++ b/doc/how-to-get-focus-right.txt
@@ -7,7 +7,7 @@ end of the discussion for how these special cases are handled.) The
basics are easy:
Focus method Behavior
- click When a user clicks on a window, focus it
+ click Focus the window on top
sloppy When an EnterNotify is received, focus the window
mouse Same as sloppy, but also defocus when mouse enters DESKTOP
window
diff --git a/src/core/stack.c b/src/core/stack.c
index fa4dbee3..d2eb7acf 100644
--- a/src/core/stack.c
+++ b/src/core/stack.c
@@ -237,7 +237,6 @@ meta_stack_freeze (MetaStack *stack)
stack->freeze_count += 1;
}
-
void
meta_stack_thaw (MetaStack *stack)
{
diff --git a/src/core/window.c b/src/core/window.c
index 603bedf3..bc04b644 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6214,7 +6214,6 @@ idle_update_icon (gpointer data)
return FALSE;
}
-
MetaWorkspace *
meta_window_get_workspace (MetaWindow *window)
{
@@ -6224,7 +6223,6 @@ meta_window_get_workspace (MetaWindow *window)
return window->workspace;
}
-
GList*
meta_window_get_workspaces (MetaWindow *window)
{
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)
{
diff --git a/src/core/workspace.h b/src/core/workspace.h
index 7d02861e..b8ea3c97 100644
--- a/src/core/workspace.h
+++ b/src/core/workspace.h
@@ -52,6 +52,17 @@ struct _MetaWorkspace
MetaScreen *screen;
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 *list_containing_self;