diff --git a/js/ui/chrome.js b/js/ui/chrome.js index c90390fd4..4fbaf8d5f 100644 --- a/js/ui/chrome.js +++ b/js/ui/chrome.js @@ -233,7 +233,7 @@ Chrome.prototype = { }, _windowsRestacked: function() { - let windows = global.get_window_actors(); + let windows = Main.getWindowActorsForWorkspace(global.screen.get_active_workspace_index()); let primary = global.get_primary_monitor(); // The chrome layer should be visible unless there is a window diff --git a/js/ui/main.js b/js/ui/main.js index 8f8725bec..204ccd4f9 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -303,6 +303,17 @@ function _relayout() { overview.hide(); } +function isWindowActorDisplayedOnWorkspace(win, workspaceIndex) { + return win.get_workspace() == workspaceIndex || + (win.get_meta_window() && win.get_meta_window().is_on_all_workspaces()); +} + +function getWindowActorsForWorkspace(workspaceIndex) { + return global.get_window_actors().filter(function (win) { + return isWindowActorDisplayedOnWorkspace(win, workspaceIndex); + }); +} + // metacity-clutter currently uses the same prefs as plain metacity, // which probably means we'll be starting out with multiple workspaces; // remove any unused ones. (We do this from an idle handler, because diff --git a/js/ui/workspace.js b/js/ui/workspace.js index ebb3f1e9f..09faf91de 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -552,7 +552,7 @@ Workspace.prototype = { this.actor.height = global.screen_height; this.scale = 1.0; - let windows = global.get_window_actors().filter(this._isMyWindow, this); + let windows = Main.getWindowActorsForWorkspace(this.metaWorkspace.index()); // Create clones for remaining windows that should be // visible in the Overview @@ -1308,8 +1308,7 @@ Workspace.prototype = { // Tests if @win belongs to this workspaces _isMyWindow : function (win) { - return win.get_workspace() == this.metaWorkspace.index() || - (win.get_meta_window() && win.get_meta_window().is_on_all_workspaces()); + return Main.isWindowActorDisplayedOnWorkspace(win, this.metaWorkspace.index()); }, // Tests if @win should be shown in the Overview