summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Adams <readams@readams.net>2004-02-28 02:53:56 +0000
committerRob Adams <readams@src.gnome.org>2004-02-28 02:53:56 +0000
commit16a8add6f80eaa804315cae03d4a640d878dbeca (patch)
tree14bea29f2e57aff02f6708de929b5ca99ec2bb64
parent036a61d19810ef2b3c164f148e72d3f60b2dd199 (diff)
downloadmetacity-16a8add6f80eaa804315cae03d4a640d878dbeca.tar.gz
only move on MRU list if the window belongs on the workspace, since the
2004-02-27 Rob Adams <readams@readams.net> * src/window.c (meta_window_notify_focus): only move on MRU list if the window belongs on the workspace, since the FocusIn event could be for a window whose workspace we've since switched away from. Possible fix for #122016. * src/workspace.c (meta_workspace_contains_window): search for the workspace in window->workspaces rather than the window in workspace->windows. Since the number of workspaces is at most 36, this is a O(1) lookup rather than a O(n) lookup. Sorry; couldn't resist.
-rw-r--r--ChangeLog13
-rw-r--r--src/window.c32
-rw-r--r--src/workspace.c2
3 files changed, 33 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 59013337..667ec74d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2004-02-27 Rob Adams <readams@readams.net>
+ * src/window.c (meta_window_notify_focus): only move on MRU list
+ if the window belongs on the workspace, since the FocusIn event
+ could be for a window whose workspace we've since switched away
+ from. Possible fix for #122016.
+
+ * src/workspace.c (meta_workspace_contains_window): search for the
+ workspace in window->workspaces rather than the window in
+ workspace->windows. Since the number of workspaces is at most 36,
+ this is a O(1) lookup rather than a O(n) lookup. Sorry; couldn't
+ resist.
+
+2004-02-27 Rob Adams <readams@readams.net>
+
* src/metacity.schemas.in: Change
move_to_workspace_left/right/up/down keybindings to
<Control><Alt><Shift> arrow to avoid conflicting with new
diff --git a/src/window.c b/src/window.c
index a2d0d543..4bacd6b3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4126,21 +4126,27 @@ meta_window_notify_focus (MetaWindow *window,
window->display->focus_window = window;
window->has_focus = TRUE;
- /* Move to the front of the focusing workspace's MRU list We
- * should only be "removing" it from the MRU list if it's
- * not already there.
+ /* Move to the front of the focusing workspace's MRU list.
+ * We should only be "removing" it from the MRU list if it's
+ * not already there. Note that it's possible that we might
+ * be processing this FocusIn after we've changed to a
+ * different workspace; we should therefore update the MRU
+ * list only if the window is actually on the active
+ * workspace.
*/
- if (window->screen->active_workspace)
+ if (window->screen->active_workspace &&
+ meta_window_visible_on_workspace (window,
+ window->screen->active_workspace))
{
- GList* link;
- link = g_list_find (window->screen->active_workspace->mru_list,
- window);
- g_assert (link);
-
- window->screen->active_workspace->mru_list =
- g_list_remove_link (window->screen->active_workspace->mru_list,
- link);
- g_list_free (link);
+ GList* link;
+ link = g_list_find (window->screen->active_workspace->mru_list,
+ window);
+ g_assert (link);
+
+ window->screen->active_workspace->mru_list =
+ g_list_remove_link (window->screen->active_workspace->mru_list,
+ link);
+ g_list_free (link);
window->screen->active_workspace->mru_list =
g_list_prepend (window->screen->active_workspace->mru_list,
diff --git a/src/workspace.c b/src/workspace.c
index 9d69af69..83c642c9 100644
--- a/src/workspace.c
+++ b/src/workspace.c
@@ -240,7 +240,7 @@ gboolean
meta_workspace_contains_window (MetaWorkspace *workspace,
MetaWindow *window)
{
- return g_list_find (workspace->windows, window) != NULL;
+ return g_list_find (window->workspaces, workspace) != NULL;
}
void