main: Remove isWindowActorDisplayedOnWorkspace

We now have a convenience method in mutter.

https://bugzilla.gnome.org/show_bug.cgi?id=691746
This commit is contained in:
Jasper St. Pierre 2013-01-14 12:38:02 -05:00
parent 12ac2e5534
commit f738c2be9d
3 changed files with 15 additions and 19 deletions

View File

@ -472,14 +472,11 @@ function notifyError(msg, details) {
notify(msg, details);
}
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);
let workspace = global.screen.get_workspace_by_index(workspaceIndex);
return global.get_window_actors().filter(function (actor) {
let win = actor.meta_window;
return win.located_on_workspace(workspace);
});
}

View File

@ -1532,9 +1532,10 @@ const Workspace = new Lang.Class({
},
// Tests if @win belongs to this workspaces and monitor
_isMyWindow : function (win) {
return (this.metaWorkspace == null || Main.isWindowActorDisplayedOnWorkspace(win, this.metaWorkspace.index())) &&
(!win.get_meta_window() || win.get_meta_window().get_monitor() == this.monitorIndex);
_isMyWindow : function (actor) {
let win = actor.meta_window;
return (this.metaWorkspace == null || win.located_on_workspace(this.metaWorkspace)) &&
(!win.get_monitor() == this.monitorIndex);
},
// Tests if @win should be shown in the Overview

View File

@ -176,7 +176,9 @@ const WorkspaceThumbnail = new Lang.Class({
let monitor = Main.layoutManager.primaryMonitor;
this.setPorthole(monitor.x, monitor.y, monitor.width, monitor.height);
let windows = global.get_window_actors().filter(this._isWorkspaceWindow, this);
let windows = global.get_window_actors().filter(Lang.bind(this, function(win) {
return win.located_on_workspace(metaWorkspace);
}));
// Create clones for windows that should be visible in the Overview
this._windows = [];
@ -377,15 +379,11 @@ const WorkspaceThumbnail = new Lang.Class({
this.actor = null;
},
// Tests if @win belongs to this workspace
_isWorkspaceWindow : function (win) {
return Main.isWindowActorDisplayedOnWorkspace(win, this.metaWorkspace.index());
},
// Tests if @win belongs to this workspace and monitor
_isMyWindow : function (win) {
return this._isWorkspaceWindow(win) &&
(!win.get_meta_window() || win.get_meta_window().get_monitor() == this.monitorIndex);
_isMyWindow : function (actor) {
let win = actor.meta_window;
return win.located_on_workspace(this.metaWorkspace) &&
(!win.get_monitor() == this.monitorIndex);
},
// Tests if @win should be shown in the Overview