[gnome-shell/wip/message-tray: 3/3] windowManager: Move the windows up/down when the tray is toggled



commit 502c0c8d1a2c5f25a5068aae1419c6f801aae103
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Jul 14 13:10:40 2012 +0200

    windowManager: Move the windows up/down when the tray is toggled
    
    Only the windows on the primary monitor are moved because the
    secondary does not have a message tray.
    
    Fixes: https://bugzilla.gnome.org/677215

 js/ui/windowManager.js |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index dafe131..54939d1 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -122,6 +122,12 @@ const WindowManager = new Lang.Class({
                                       Meta.KeyBindingFlags.NONE,
                                       Lang.bind(this, this._openAppMenu));
 
+        this.messageTrayRevealed = false;
+        global.display.add_keybinding('toggle-message-tray',
+                                      new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
+                                      Meta.KeyBindingFlags.NONE,
+                                      Lang.bind(this, this._toggleMessageTray));
+
         Main.overview.connect('showing', Lang.bind(this, function() {
             for (let i = 0; i < this._dimmedWindows.length; i++)
                 this._undimWindow(this._dimmedWindows[i]);
@@ -541,6 +547,27 @@ const WindowManager = new Lang.Class({
         Main.panel.openAppMenu();
     },
 
+    _toggleMessageTray : function(display, screen, window, event, binding) {
+        this.messageTrayRevealed = !this.messageTrayRevealed;
+        Main.layoutManager.togglePanelStruts();
+        Main.messageTray.toggle();
+
+        let height = Main.messageTray.actor.height;
+        let actors = global.get_window_actors();
+
+        for (let i = 0; i < actors.length; i++) {
+            let window = actors[i].metaWindow;
+            if (!window.is_on_primary_monitor())
+                continue;
+
+            let rect = window.get_outer_rect();
+            if (this.messageTrayRevealed)
+                window.move_frame(true, rect.x, rect.y - height);
+            else
+                window.move_frame(true, rect.x, rect.y + height);
+        }
+    },
+
     _showWorkspaceSwitcher : function(display, screen, window, binding) {
         if (screen.n_workspaces == 1)
             return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]