From fac7010411a2e7ec19629847e67c3e098c3dc074 Mon Sep 17 00:00:00 2001 From: Kyle Ambroff Date: Mon, 16 Jan 2006 06:07:29 +0000 Subject: [PATCH] If no valid window is found in the MRU list, then set focus to the desktop 2006-01-15 Kyle Ambroff * src/workspace.c (focus_ancestor_or_mru_window): If no valid window is found in the MRU list, then set focus to the desktop window. (#317405) --- ChangeLog | 6 ++++++ src/workspace.c | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 34e88c0c5..ff9753bff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-01-15 Kyle Ambroff + + * src/workspace.c (focus_ancestor_or_mru_window): + If no valid window is found in the MRU list, then set focus to the + desktop window. (#317405) + 2006-01-15 Elijah Newren Fix accidental overzealous focus holding by the terminal diff --git a/src/workspace.c b/src/workspace.c index 3988cb963..f4a71da13 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -950,6 +950,7 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, Time timestamp) { MetaWindow *window = NULL; + MetaWindow *desktop_window = NULL; GList *tmp; if (not_this_one) @@ -994,12 +995,24 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace, tmp_window->type != META_WINDOW_DESKTOP) { window = tmp->data; - break; + 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) { meta_topic (META_DEBUG_FOCUS,