From eafdd1d78da17d6f7944d12938d4309e3bb27ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 9 Jun 2017 17:17:47 +0200 Subject: [PATCH] window-list: Respect MWM hints The window context menu contains minimize, maximize and close items that are currently enabled unconditionally, regardless of whether the window indicates support. Respect those hints by updating the items' sensitivity every time the popup is shown. https://bugzilla.gnome.org/show_bug.cgi?id=783601 --- extensions/window-list/extension.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js index b804d3de..f01b8727 100644 --- a/extensions/window-list/extension.js +++ b/extensions/window-list/extension.js @@ -107,13 +107,22 @@ const WindowContextMenu = new Lang.Class({ Lang.bind(this, this._updateMaximizeItem)); this._updateMaximizeItem(); - let item = new PopupMenu.PopupMenuItem(_("Close")); - item.connect('activate', Lang.bind(this, function() { + this._closeItem = new PopupMenu.PopupMenuItem(_("Close")); + this._closeItem.connect('activate', Lang.bind(this, function() { this._metaWindow.delete(global.get_current_time()); })); - this.addMenuItem(item); + this.addMenuItem(this._closeItem); this.actor.connect('destroy', Lang.bind(this, this._onDestroy)); + + this.connect('open-state-changed', () => { + if (!this.isOpen) + return; + + this._minimizeItem.setSensitive(this._metaWindow.can_minimize()); + this._maximizeItem.setSensitive(this._metaWindow.can_maximize()); + this._closeItem.setSensitive(this._metaWindow.can_close()); + }); }, _updateMinimizeItem: function() {