diff options
author | Florian Müllner <fmuellner@gnome.org> | 2014-05-24 03:32:44 +0200 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2014-05-27 19:49:05 +0200 |
commit | 8811ba2ec033fb52547fbcd14eb3fefc153c90fa (patch) | |
tree | bab76f57a4d515ba0a7600168ec1963fffcf05a1 /js/ui/windowMenu.js | |
parent | 38d8e465b37e06e935f6d5bbb9da05e1c171f426 (diff) |
Support (fallback) app menu in SSD
We now allow "appmenu" in the button layout to make synchronizing it
with GTK+'s client-side decorations easier, but as some people tweak
their settings to get in-window app menus even when using the shell,
actually pop up the app menu when the button is activated.
https://bugzilla.gnome.org/show_bug.cgi?id=730752
Diffstat (limited to 'js/ui/windowMenu.js')
-rw-r--r-- | js/ui/windowMenu.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js index 3dc85c66..c6dc7295 100644 --- a/js/ui/windowMenu.js +++ b/js/ui/windowMenu.js @@ -9,6 +9,7 @@ const Shell = imports.gi.Shell; const BoxPointer = imports.ui.boxpointer; const Main = imports.ui.main; const PopupMenu = imports.ui.popupMenu; +const RemoteMenu = imports.ui.remoteMenu; const WindowMenu = new Lang.Class({ Name: 'WindowMenu', @@ -122,6 +123,22 @@ const WindowMenu = new Lang.Class({ } }); +const AppMenu = new Lang.Class({ + Name: 'AppMenu', + Extends: RemoteMenu.RemoteMenu, + + _init: function(window) { + let app = Shell.WindowTracker.get_default().get_window_app(window); + + this.parent(Main.layoutManager.dummyCursor, app.menu, app.action_group); + + this.actor.add_style_class_name('fallback-app-menu'); + + Main.layoutManager.uiGroup.add_actor(this.actor); + this.actor.hide(); + } +}); + const WindowMenuManager = new Lang.Class({ Name: 'WindowMenuManager', @@ -129,8 +146,10 @@ const WindowMenuManager = new Lang.Class({ this._manager = new PopupMenu.PopupMenuManager({ actor: Main.layoutManager.dummyCursor }); }, - showForWindow: function(window, x, y) { - let menu = new WindowMenu(window); + showWindowMenuForWindow: function(window, type, x, y) { + let menu = (type == Meta.WindowMenuType.WM) ? new WindowMenu(window) + : new AppMenu(window); + this._manager.addMenu(menu); Main.layoutManager.setDummyCursorGeometry(x, y, 0, 0); @@ -140,5 +159,5 @@ const WindowMenuManager = new Lang.Class({ if (!isOpen) menu.destroy(); })); - }, + } }); |