From 70056ba56e4756b9c09e6d419d1903e0f6f07afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 23 May 2014 00:20:08 +0200 Subject: [PATCH] window-list: Don't unnecessarily add/remove window buttons Since commit 191c7ccc24d, 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. --- extensions/window-list/extension.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 934f9c11..f84248c3 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -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) {