window-list: Don't unnecessarily add/remove window buttons

Since commit 191c7ccc24, we check whether we already have a window
in the list before re-adding it on MetaWorkspace::window-added.
We can do something similar on MetaWorkspace::window-removed to
avoid some extra work when a window is moved between workspaces
rather than destroyed.
This commit is contained in:
Florian Müllner
2014-05-23 00:20:08 +02:00
parent 4af36f41fa
commit 70056ba56e
+7
View File
@@ -217,6 +217,9 @@ const WindowButton = new Lang.Class({
this._switchWorkspaceId =
global.window_manager.connect('switch-workspace',
Lang.bind(this, this._updateVisibility));
this._workspaceChangedId =
this.metaWindow.connect('workspace-changed',
Lang.bind(this, this._updateVisibility));
this._updateVisibility();
this._notifyFocusId =
@@ -281,6 +284,7 @@ const WindowButton = new Lang.Class({
},
_onDestroy: function() {
this.metaWindow.disconnect(this._workspaceChangedId);
global.window_manager.disconnect(this._switchWorkspaceId);
global.display.disconnect(this._notifyFocusId);
this._contextMenu.destroy();
@@ -1006,6 +1010,9 @@ const WindowList = new Lang.Class({
return;
}
if (win.get_compositor_private())
return; // not actually removed, just moved to another workspace
let children = this._windowList.get_children();
for (let i = 0; i < children.length; i++) {
if (children[i]._delegate.metaWindow == win) {