2448151
From 0734ddbfaacff73b80747272ad7044ff904290f6 Mon Sep 17 00:00:00 2001
2448151
From: "Owen W. Taylor" <otaylor@fishsoup.net>
97b0323
Date: Mon, 19 Oct 2009 18:43:00 -0400
97b0323
Subject: [PATCH] Don't focus ancestor window on a different workspace
97b0323
97b0323
When we are moving a window with a modal dialog to a different
97b0323
workspace, meta_workspace_focus_default_window() can be called
97b0323
with 'not_this_one' being the focused modal dialog.
97b0323
97b0323
Since the ancestor of that window is also being moved, we must
97b0323
not focus it as an alternative to the current window; this will
97b0323
cause windows to be moved back and Metacity to get into an
97b0323
inconsistent confused state.
97b0323
97b0323
https://bugzilla.redhat.com/show_bug.cgi?id=237158
97b0323
97b0323
https://bugzilla.gnome.org/show_bug.cgi?id=598995
97b0323
---
97b0323
 src/core/workspace.c |    5 ++++-
97b0323
 1 files changed, 4 insertions(+), 1 deletions(-)
97b0323
97b0323
diff --git a/src/core/workspace.c b/src/core/workspace.c
2448151
index e877b19..6ffea30 100644
97b0323
--- a/src/core/workspace.c
97b0323
+++ b/src/core/workspace.c
2448151
@@ -975,7 +975,10 @@ focus_ancestor_or_mru_window (MetaWorkspace *workspace,
97b0323
       MetaWindow *ancestor;
97b0323
       ancestor = NULL;
97b0323
       meta_window_foreach_ancestor (not_this_one, record_ancestor, &ancestor);
97b0323
-      if (ancestor != NULL)
97b0323
+      if (ancestor != NULL &&
97b0323
+          (ancestor->on_all_workspaces ||
97b0323
+           ancestor->workspace == workspace) &&
97b0323
+          meta_window_showing_on_its_workspace (ancestor))
97b0323
         {
97b0323
           meta_topic (META_DEBUG_FOCUS,
97b0323
                       "Focusing %s, ancestor of %s\n", 
97b0323
-- 
2448151
1.7.9
2448151