[gnome-shell-extensions] window-list: Respect MWM hints
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] window-list: Respect MWM hints
- Date: Fri, 9 Jun 2017 15:54:49 +0000 (UTC)
commit eafdd1d78da17d6f7944d12938d4309e3bb27ef9
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jun 9 17:17:47 2017 +0200
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 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index b804d3d..f01b872 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() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]