From b87ddf1195ed97e322a90994fc8f1ec2c8ec8614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sat, 15 Feb 2014 00:17:39 +0100 Subject: [PATCH] window-list: Only have a single context menu at any time Depending on the number of windows, AppButtons use different right-click menus ("Minimize" vs. "Minimize all"). As the menu for the multiple-windows case remains the same, it is created and added just once. However this means that in the single-window case, the corresponding PopupMenuManager will track two menus for the same source actor, resulting in various misbehaviors. Fix these issues by adding and removing the app context menu appropriately, so that the PopupMenuManager tracks a single menu at any time. https://bugzilla.gnome.org/show_bug.cgi?id=724688 --- extensions/window-list/extension.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index 0531b400..d83fa00e 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -391,7 +391,6 @@ const AppButton = new Lang.Class({ this._appContextMenu = new AppContextMenu(this.actor, this.app); this._appContextMenu.connect('open-state-changed', _onMenuStateChanged); this._appContextMenu.actor.hide(); - this._contextMenuManager.addMenu(this._appContextMenu); Main.uiGroup.add_actor(this._appContextMenu.actor); this._textureCache = St.TextureCache.get_default(); @@ -470,6 +469,7 @@ const AppButton = new Lang.Class({ this._windowContextMenu.actor.hide(); this._contextMenuManager.addMenu(this._windowContextMenu); } + this._contextMenuManager.removeMenu(this._appContextMenu); this._contextMenu = this._windowContextMenu; } else { if (this._windowTitle) { @@ -480,6 +480,7 @@ const AppButton = new Lang.Class({ this._windowContextMenu = null; } this._contextMenu = this._appContextMenu; + this._contextMenuManager.addMenu(this._appContextMenu); } },