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
This commit is contained in:
Florian Müllner
2017-06-09 17:17:47 +02:00
parent 61a2e5ab9e
commit eafdd1d78d

View File

@@ -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() {