[gnome-shell/wip/fmuellner/notification-redux+sass: 119/141] messageTray: Remove the bottom tray



commit 8f3dbbd7a814a335fb8561d83fbc8fd4caf70736
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 11 17:29:23 2015 +0100

    messageTray: Remove the bottom tray
    
    It no longer does anything useful by now, so kill it off.
    Even more complexity gone, yay!

 data/theme/_common.scss    |   20 --
 data/theme/gnome-shell.css |   20 --
 js/ui/layout.js            |   42 ----
 js/ui/messageTray.js       |  474 +-------------------------------------------
 4 files changed, 5 insertions(+), 551 deletions(-)
---
diff --git a/data/theme/_common.scss b/data/theme/_common.scss
index ffb4d25..31db0be 100644
--- a/data/theme/_common.scss
+++ b/data/theme/_common.scss
@@ -1318,26 +1318,6 @@ StScrollBar {
 
 /* NOTIFICATIONS & MESSAGE TRAY */
 
-#message-tray {
-  background: darken($osd_bg_color,10%) url("noise-texture.png");
-  background-repeat: repeat;
-  height: 72px;
-  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
-  padding: 4px;
-  .message-tray-summary { height: 72px; }
-  
-  .message-tray-menu-button {
-    StIcon {
-      padding: 0 20px;
-      color: $fg_color;
-      icon-size: 24px;
-      opacity: 1;
-    }
-    &:hover StIcon { color: lighten($fg_color, 15%); } 
-    &:active StIcon { color: lighten($selected_bg_color, 10%); }
-  } 
-  .no-messages-label { color: darken($fg_color,10%); }
-}
   .url-highlighter { link-color: $selected_bg_color; }
   
   // Banners
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index a75de23..27d9218 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -1143,26 +1143,6 @@ StScrollBar {
   color: #eeeeec; }
 
 /* NOTIFICATIONS & MESSAGE TRAY */
-#message-tray {
-  background: #17191a url("noise-texture.png");
-  background-repeat: repeat;
-  height: 72px;
-  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
-  padding: 4px; }
-  #message-tray .message-tray-summary {
-    height: 72px; }
-  #message-tray .message-tray-menu-button StIcon {
-    padding: 0 20px;
-    color: #eeeeec;
-    icon-size: 24px;
-    opacity: 1; }
-  #message-tray .message-tray-menu-button:hover StIcon {
-    color: white; }
-  #message-tray .message-tray-menu-button:active StIcon {
-    color: #2a76c6; }
-  #message-tray .no-messages-label {
-    color: #d6d6d1; }
-
 .url-highlighter {
   link-color: #215d9c; }
 
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 204ab94..43930f1 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -209,7 +209,6 @@ const LayoutManager = new Lang.Class({
         this.trayBox = new St.Widget({ name: 'trayBox',
                                        layout_manager: new Clutter.BinLayout() }); 
         this.addChrome(this.trayBox);
-        this._setupTrayPressure();
 
         this.modalDialogGroup = new St.Widget({ name: 'modalDialogGroup',
                                                 layout_manager: new Clutter.BinLayout() });
@@ -455,50 +454,9 @@ const LayoutManager = new Lang.Class({
         }
     },
 
-    _setupTrayPressure: function() {
-        this._trayPressure = new PressureBarrier(MESSAGE_TRAY_PRESSURE_THRESHOLD,
-                                                 MESSAGE_TRAY_PRESSURE_TIMEOUT,
-                                                 Shell.ActionMode.NORMAL |
-                                                 Shell.ActionMode.OVERVIEW);
-        this._trayPressure.setEventFilter(this._trayBarrierEventFilter);
-        this._trayPressure.connect('trigger', function(barrier) {
-            if (Main.layoutManager.bottomMonitor.inFullscreen)
-                return;
-
-            Main.messageTray.openTray();
-        });
-    },
-
-    _updateTrayBarrier: function() {
-        let monitor = this.bottomMonitor;
-
-        if (this._trayBarrier) {
-            this._trayPressure.removeBarrier(this._trayBarrier);
-            this._trayBarrier.destroy();
-            this._trayBarrier = null;
-        }
-
-        this._trayBarrier = new Meta.Barrier({ display: global.display,
-                                               x1: monitor.x, x2: monitor.x + monitor.width,
-                                               y1: monitor.y + monitor.height, y2: monitor.y + 
monitor.height,
-                                               directions: Meta.BarrierDirection.NEGATIVE_Y });
-        this._trayPressure.addBarrier(this._trayBarrier);
-    },
-
-    _trayBarrierEventFilter: function(event) {
-        // Throw out all events where the pointer was grabbed by another
-        // client, as the client that grabbed the pointer expects to have
-        // complete control over it
-        if (event.grabbed && Main.modalCount == 0)
-            return true;
-
-        return false;
-    },
-
     _monitorsChanged: function() {
         this._updateMonitors();
         this._updateBoxes();
-        this._updateTrayBarrier();
         this._updateHotCorners();
         this._updateBackgrounds();
         this._updateFullscreen();
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 5443c78..3e23aa9 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
 const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
-const GnomeDesktop = imports.gi.GnomeDesktop;
 const Atk = imports.gi.Atk;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
@@ -13,28 +12,17 @@ const Pango = imports.gi.Pango;
 const Shell = imports.gi.Shell;
 const Signals = imports.signals;
 const St = imports.gi.St;
-const Tp = imports.gi.TelepathyGLib;
 
-const EdgeDragAction = imports.ui.edgeDragAction;
-const BoxPointer = imports.ui.boxpointer;
-const CtrlAltTab = imports.ui.ctrlAltTab;
 const GnomeSession = imports.misc.gnomeSession;
-const GrabHelper = imports.ui.grabHelper;
-const Lightbox = imports.ui.lightbox;
 const Main = imports.ui.main;
-const PointerWatcher = imports.ui.pointerWatcher;
-const PopupMenu = imports.ui.popupMenu;
 const Params = imports.misc.params;
 const Tweener = imports.ui.tweener;
 const Util = imports.misc.util;
-const ViewSelector = imports.ui.viewSelector;
 
 const SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
 
 const ANIMATION_TIME = 0.2;
 const NOTIFICATION_TIMEOUT = 4;
-const SUMMARY_TIMEOUT = 1;
-const LONGER_SUMMARY_TIMEOUT = 4;
 
 const HIDE_TIMEOUT = 0.2;
 const LONGER_HIDE_TIMEOUT = 0.6;
@@ -43,11 +31,6 @@ const LONGER_HIDE_TIMEOUT = 0.6;
 // range from the point where it left the tray.
 const MOUSE_LEFT_ACTOR_THRESHOLD = 20;
 
-// Time the user needs to leave the mouse on the bottom pixel row to open the tray
-const TRAY_DWELL_TIME = 1000; // ms
-// Time resolution when tracking the mouse to catch the open tray dwell
-const TRAY_DWELL_CHECK_INTERVAL = 100; // ms
-
 const IDLE_TIME = 1000;
 
 const State = {
@@ -1356,164 +1339,6 @@ const Source = new Lang.Class({
 });
 Signals.addSignalMethods(Source.prototype);
 
-const MessageTrayMenu = new Lang.Class({
-    Name: 'MessageTrayMenu',
-    Extends: PopupMenu.PopupMenu,
-
-    _init: function(button, tray) {
-        this.parent(button, 0, St.Side.BOTTOM);
-
-        this._tray = tray;
-
-        this._presence = new GnomeSession.Presence(Lang.bind(this, function(proxy, error) {
-            if (error) {
-                logError(error, 'Error while reading gnome-session presence');
-                return;
-            }
-
-            this._onStatusChanged(proxy.status);
-        }));
-        this._presence.connectSignal('StatusChanged', Lang.bind(this, function(proxy, senderName, [status]) {
-            this._onStatusChanged(status);
-        }));
-
-        this._accountManager = Tp.AccountManager.dup();
-        this._accountManager.connect('most-available-presence-changed',
-                                     Lang.bind(this, this._onIMPresenceChanged));
-        this._accountManager.prepare_async(null, Lang.bind(this, this._onIMPresenceChanged));
-
-        this.actor.hide();
-        Main.layoutManager.addChrome(this.actor);
-
-        this._busyItem = new PopupMenu.PopupSwitchMenuItem(_("Notifications"));
-        this._busyItem.connect('toggled', Lang.bind(this, this._updatePresence));
-        this.addMenuItem(this._busyItem);
-
-        let separator = new PopupMenu.PopupSeparatorMenuItem();
-        this.addMenuItem(separator);
-
-        this._clearItem = this.addAction(_("Clear Messages"), function() {
-            let toDestroy = tray.getSources().filter(function(source) {
-                return source.isClearable;
-            });
-
-            toDestroy.forEach(function(source) {
-                source.destroy();
-            });
-
-            tray.close();
-        });
-
-        tray.connect('source-added', Lang.bind(this, this._updateClearSensitivity));
-        tray.connect('source-removed', Lang.bind(this, this._updateClearSensitivity));
-        this._updateClearSensitivity();
-
-        let separator = new PopupMenu.PopupSeparatorMenuItem();
-        this.addMenuItem(separator);
-
-        let settingsItem = this.addSettingsAction(_("Notification Settings"), 
'gnome-notifications-panel.desktop');
-        settingsItem.connect('activate', function() { tray.close(); });
-    },
-
-    _onStatusChanged: function(status) {
-        this._sessionStatus = status;
-        this._busyItem.setToggleState(status != GnomeSession.PresenceStatus.BUSY);
-    },
-
-    _onIMPresenceChanged: function(am, type) {
-        if (type == Tp.ConnectionPresenceType.AVAILABLE &&
-            this._sessionStatus == GnomeSession.PresenceStatus.BUSY)
-            this._presence.SetStatusRemote(GnomeSession.PresenceStatus.AVAILABLE);
-    },
-
-    _updateClearSensitivity: function() {
-        this._clearItem.setSensitive(this._tray.clearableCount > 0);
-    },
-
-    _updatePresence: function(item, state) {
-        let status = state ? GnomeSession.PresenceStatus.AVAILABLE
-                           : GnomeSession.PresenceStatus.BUSY;
-        this._presence.SetStatusRemote(status);
-
-        let [type, s ,msg] = this._accountManager.get_most_available_presence();
-        let newType = 0;
-        let newStatus;
-        if (status == GnomeSession.PresenceStatus.BUSY &&
-            type == Tp.ConnectionPresenceType.AVAILABLE) {
-            newType = Tp.ConnectionPresenceType.BUSY;
-            newStatus = 'busy';
-        } else if (status == GnomeSession.PresenceStatus.AVAILABLE &&
-                 type == Tp.ConnectionPresenceType.BUSY) {
-            newType = Tp.ConnectionPresenceType.AVAILABLE;
-            newStatus = 'available';
-        }
-
-        if (newType > 0)
-            this._accountManager.set_all_requested_presences(newType,
-                                                             newStatus, msg);
-    }
-});
-
-const MessageTrayMenuButton = new Lang.Class({
-    Name: 'MessageTrayMenuButton',
-
-    _init: function(tray) {
-        this._icon = new St.Icon();
-        this.actor = new St.Button({ style_class: 'message-tray-menu-button',
-                                     reactive: true,
-                                     track_hover: true,
-                                     can_focus: true,
-                                     button_mask: St.ButtonMask.ONE | St.ButtonMask.TWO | 
St.ButtonMask.THREE,
-                                     accessible_name: _("Tray Menu"),
-                                     accessible_role: Atk.Role.MENU,
-                                     child: this._icon });
-
-        // Standard hack for ClutterBinLayout.
-        this.actor.set_x_expand(true);
-        this.actor.set_y_expand(true);
-        this.actor.set_x_align(Clutter.ActorAlign.START);
-
-        this._menu = new MessageTrayMenu(this.actor, tray);
-        this._manager = new PopupMenu.PopupMenuManager({ actor: this.actor });
-        this._manager.addMenu(this._menu);
-        this._menu.connect('open-state-changed', Lang.bind(this, function(menu, open) {
-            if (open)
-                this.actor.add_style_pseudo_class('active');
-            else
-                this.actor.remove_style_pseudo_class('active');
-        }));
-
-        this.actor.connect('clicked', Lang.bind(this, function() {
-            this._menu.toggle();
-        }));
-
-        this._accountManager = Tp.AccountManager.dup();
-        this._accountManager.connect('most-available-presence-changed',
-                                     Lang.bind(this, this._sync));
-        this._accountManager.prepare_async(null, Lang.bind(this, this._sync));
-    },
-
-    _iconForPresence: function(presence) {
-        if (presence == Tp.ConnectionPresenceType.AVAILABLE)
-            return 'user-available-symbolic';
-        else if (presence == Tp.ConnectionPresenceType.BUSY)
-            return 'user-busy-symbolic';
-        else if (presence == Tp.ConnectionPresenceType.HIDDEN)
-            return 'user-hidden-symbolic';
-        else if (presence == Tp.ConnectionPresenceType.AWAY)
-            return 'user-away-symbolic';
-        else if (presence == Tp.ConnectionPresenceType.EXTENDED_AWAY)
-            return 'user-idle-symbolic';
-        else
-            return 'emblem-system-symbolic';
-    },
-
-    _sync: function() {
-        let [presence, status, message] = this._accountManager.get_most_available_presence();
-        this._icon.icon_name = this._iconForPresence(presence);
-    },
-});
-
 const MessageTray = new Lang.Class({
     Name: 'MessageTray',
 
@@ -1526,14 +1351,6 @@ const MessageTray = new Lang.Class({
             this._onStatusChanged(status);
         }));
 
-        this.actor = new St.Widget({ name: 'message-tray',
-                                     reactive: true,
-                                     layout_manager: new Clutter.BinLayout(),
-                                     x_expand: true,
-                                     y_expand: true,
-                                     y_align: Clutter.ActorAlign.START,
-                                   });
-
         this._notificationWidget = new St.Widget({ name: 'notification-container',
                                                    reactive: true,
                                                    track_hover: true,
@@ -1554,13 +1371,6 @@ const MessageTray = new Lang.Class({
         this._notification = null;
         this._notificationClickedId = 0;
 
-        this.actor.connect('button-release-event', Lang.bind(this, function(actor, event) {
-            this._updateState();
-            actor.grab_key_focus();
-            return Clutter.EVENT_PROPAGATE;
-        }));
-        global.focus_manager.add_group(this.actor);
-
         this._closeButton = Util.makeCloseButton();
         this._closeButton.hide();
         this._closeButton.connect('clicked', Lang.bind(this, this._closeNotification));
@@ -1570,16 +1380,7 @@ const MessageTray = new Lang.Class({
 
         this.idleMonitor = Meta.IdleMonitor.get_core();
 
-        this._grabHelper = new GrabHelper.GrabHelper(this.actor,
-                                                     { actionMode: Shell.ActionMode.MESSAGE_TRAY });
-        this._grabHelper.addActor(this.actor);
-
-        Main.layoutManager.connect('keyboard-visible-changed', Lang.bind(this, 
this._onKeyboardVisibleChanged));
-
-        this._trayState = State.HIDDEN;
-        this._traySummoned = false;
         this._useLongerNotificationLeftTimeout = false;
-        this._trayLeftTimeoutId = 0;
 
         // pointerInNotification is sort of a misnomer -- it tracks whether
         // a message tray notification should expand. The value is
@@ -1592,40 +1393,18 @@ const MessageTray = new Lang.Class({
         // out non-changing hover notifications in onNotificationHoverChanged.
         this._notificationHovered = false;
 
-        this._keyboardVisible = false;
         this._notificationState = State.HIDDEN;
         this._notificationTimeoutId = 0;
         this._notificationExpandedId = 0;
-        this._desktopCloneState = State.HIDDEN;
         this._notificationRemoved = false;
-        this._reNotifyAfterHideNotification = null;
-        this._desktopClone = null;
-        this._inCtrlAltTab = false;
 
         this.clearableCount = 0;
 
-        this._lightboxes = [];
-        let lightboxContainers = [global.window_group,
-                                  Main.layoutManager.overviewGroup];
-        for (let i = 0; i < lightboxContainers.length; i++)
-            this._lightboxes.push(new Lightbox.Lightbox(lightboxContainers[i],
-                                                        { inhibitEvents: true,
-                                                          fadeFactor: 0.2
-                                                        }));
-
-        Main.layoutManager.trayBox.add_actor(this.actor);
         Main.layoutManager.trayBox.add_actor(this._notificationWidget);
-        Main.layoutManager.trackChrome(this.actor);
         Main.layoutManager.trackChrome(this._notificationWidget);
         Main.layoutManager.trackChrome(this._closeButton);
 
         global.screen.connect('in-fullscreen-changed', Lang.bind(this, this._updateState));
-        Main.layoutManager.connect('hot-corners-changed', Lang.bind(this, this._hotCornersChanged));
-
-        // If the overview shows or hides while we're in
-        // the message tray, revert back to normal mode.
-        Main.overview.connect('showing', Lang.bind(this, this._escapeTray));
-        Main.overview.connect('hiding', Lang.bind(this, this._escapeTray));
 
         Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
 
@@ -1639,110 +1418,13 @@ const MessageTray = new Lang.Class({
 
         this._sources = new Map();
 
-        this._trayDwellTimeoutId = 0;
-        this._setupTrayDwellIfNeeded();
         this._sessionUpdated();
-        this._hotCornersChanged();
-
-        this._noMessages = new St.Label({ text: _("No Messages"),
-                                          style_class: 'no-messages-label',
-                                          x_align: Clutter.ActorAlign.CENTER,
-                                          x_expand: true,
-                                          y_align: Clutter.ActorAlign.CENTER,
-                                          y_expand: true });
-        this.actor.add_actor(this._noMessages);
-        this._updateNoMessagesLabel();
-
-        this._messageTrayMenuButton = new MessageTrayMenuButton(this);
-        this.actor.add_actor(this._messageTrayMenuButton.actor);
-
-        let gesture = new EdgeDragAction.EdgeDragAction(St.Side.BOTTOM,
-                                                        Shell.ActionMode.NORMAL |
-                                                        Shell.ActionMode.OVERVIEW);
-        gesture.connect('activated', Lang.bind(this, this.toggle));
-        global.stage.add_action(gesture);
-    },
-
-    close: function() {
-        this._escapeTray();
-    },
-
-    _setupTrayDwellIfNeeded: function() {
-        // If we don't have extended barrier features, then we need
-        // to support the old tray dwelling mechanism.
-        if (!global.display.supports_extended_barriers()) {
-            let pointerWatcher = PointerWatcher.getPointerWatcher();
-            pointerWatcher.addWatch(TRAY_DWELL_CHECK_INTERVAL, Lang.bind(this, this._checkTrayDwell));
-            this._trayDwelling = false;
-            this._trayDwellUserTime = 0;
-        }
-    },
-
-    _updateNoMessagesLabel: function() {
-        this._noMessages.visible = this._sources.size == 0;
     },
 
     _sessionUpdated: function() {
         this._updateState();
     },
 
-    _checkTrayDwell: function(x, y) {
-        let monitor = Main.layoutManager.bottomMonitor;
-        let shouldDwell = (x >= monitor.x && x <= monitor.x + monitor.width &&
-                           y == monitor.y + monitor.height - 1);
-        if (shouldDwell) {
-            // We only set up dwell timeout when the user is not hovering over the tray
-            // (!this._notificationHovered). This avoids bringing up the message tray after the
-            // user clicks on a notification with the pointer on the bottom pixel
-            // of the monitor. The _trayDwelling variable is used so that we only try to
-            // fire off one tray dwell - if it fails (because, say, the user has the mouse down),
-            // we don't try again until the user moves the mouse up and down again.
-            if (!this._trayDwelling && !this._notificationHovered && this._trayDwellTimeoutId == 0) {
-                // Save the interaction timestamp so we can detect user input
-                let focusWindow = global.display.focus_window;
-                this._trayDwellUserTime = focusWindow ? focusWindow.user_time : 0;
-
-                this._trayDwellTimeoutId = Mainloop.timeout_add(TRAY_DWELL_TIME,
-                                                                Lang.bind(this, this._trayDwellTimeout));
-                GLib.Source.set_name_by_id(this._trayDwellTimeoutId, '[gnome-shell] this._trayDwellTimeout');
-            }
-            this._trayDwelling = true;
-        } else {
-            this._cancelTrayDwell();
-            this._trayDwelling = false;
-        }
-    },
-
-    _cancelTrayDwell: function() {
-        if (this._trayDwellTimeoutId != 0) {
-            Mainloop.source_remove(this._trayDwellTimeoutId);
-            this._trayDwellTimeoutId = 0;
-        }
-    },
-
-    _trayDwellTimeout: function() {
-        this._trayDwellTimeoutId = 0;
-
-        if (Main.layoutManager.bottomMonitor.inFullscreen)
-            return GLib.SOURCE_REMOVE;
-
-        // We don't want to open the tray when a modal dialog
-        // is up, so we check the modal count for that. When we are in the
-        // overview we have to take the overview's modal push into account
-        if (Main.modalCount > (Main.overview.visible ? 1 : 0))
-            return GLib.SOURCE_REMOVE;
-
-        // If the user interacted with the focus window since we started the tray
-        // dwell (by clicking or typing), don't activate the message tray
-        let focusWindow = global.display.focus_window;
-        let currentUserTime = focusWindow ? focusWindow.user_time : 0;
-        if (currentUserTime != this._trayDwellUserTime)
-            return GLib.SOURCE_REMOVE;
-
-        this.openTray();
-        return GLib.SOURCE_REMOVE;
-    },
-
     _onNotificationKeyRelease: function(actor, event) {
         if (event.get_key_symbol() == Clutter.KEY_Escape && event.get_state() == 0) {
             this._expireNotification();
@@ -1799,8 +1481,6 @@ const MessageTray = new Lang.Class({
         obj.destroyId = source.connect('destroy', Lang.bind(this, this._onSourceDestroy));
 
         this.emit('source-added', source);
-
-        this._updateNoMessagesLabel();
     },
 
     _removeSource: function(source) {
@@ -1814,8 +1494,6 @@ const MessageTray = new Lang.Class({
         source.disconnect(obj.destroyId);
 
         this.emit('source-removed', source);
-
-        this._updateNoMessagesLabel();
     },
 
     getSources: function() {
@@ -1851,28 +1529,6 @@ const MessageTray = new Lang.Class({
             this._notificationQueue.splice(index, 1);
     },
 
-    openTray: function() {
-        if (Main.overview.animationInProgress)
-            return;
-
-        this._traySummoned = true;
-        this._updateState();
-    },
-
-    toggle: function() {
-        if (Main.overview.animationInProgress)
-            return false;
-
-        this._traySummoned = !this._traySummoned;
-        this._updateState();
-        return true;
-    },
-
-    hide: function() {
-        this._traySummoned = false;
-        this._updateState();
-    },
-
     _onNotify: function(source, notification) {
         if (this._notification == notification) {
             // If a notification that is being shown is updated, we update
@@ -1891,13 +1547,6 @@ const MessageTray = new Lang.Class({
         this._updateState();
     },
 
-    _hotCornersChanged: function() {
-        let primary = Main.layoutManager.primaryIndex;
-        let corner = Main.layoutManager.hotCorners[primary];
-        if (corner && corner.actor)
-            this._grabHelper.addActor(corner.actor);
-    },
-
     _resetNotificationLeftTimeout: function() {
         this._useLongerNotificationLeftTimeout = false;
         if (this._notificationLeftTimeoutId) {
@@ -1914,9 +1563,6 @@ const MessageTray = new Lang.Class({
 
         this._notificationHovered = this._notificationWidget.hover;
         if (this._notificationHovered) {
-            // No dwell inside notifications at the bottom of the screen
-            this._cancelTrayDwell();
-
             this._resetNotificationLeftTimeout();
 
             if (this._showNotificationMouseX >= 0) {
@@ -1929,7 +1575,7 @@ const MessageTray = new Lang.Class({
                 // automatically. Instead, the user is able to expand the notification by mousing away from 
it and then
                 // mousing back in. Because this is an expected action, we set the boolean flag that 
indicates that a longer
                 // timeout should be used before popping down the notification.
-                if (this.actor.contains(actorAtShowNotificationPosition)) {
+                if (this._notificationWidget.contains(actorAtShowNotificationPosition)) {
                     this._useLongerNotificationLeftTimeout = true;
                     return;
                 }
@@ -1955,11 +1601,6 @@ const MessageTray = new Lang.Class({
         }
     },
 
-    _onKeyboardVisibleChanged: function(layoutManager, keyboardVisible) {
-        this._keyboardVisible = keyboardVisible;
-        this._updateState();
-    },
-
     _onStatusChanged: function(status) {
         if (status == GnomeSession.PresenceStatus.BUSY) {
             // remove notification and allow the summary to be closed now
@@ -2000,7 +1641,6 @@ const MessageTray = new Lang.Class({
 
     _escapeTray: function() {
         this._pointerInNotification = false;
-        this._traySummoned = false;
         this._updateNotificationTimeout(0);
         this._updateState();
     },
@@ -2026,9 +1666,8 @@ const MessageTray = new Lang.Class({
         let hasNotifications = Main.sessionMode.hasNotifications;
 
         if (this._notificationState == State.HIDDEN) {
-            let shouldShowNotification = (hasNotifications && this._trayState == State.HIDDEN && 
!this._traySummoned);
             let nextNotification = this._notificationQueue[0] || null;
-            if (shouldShowNotification && nextNotification) {
+            if (hasNotifications && nextNotification) {
                 let limited = this._busy || Main.layoutManager.bottomMonitor.inFullscreen;
                 let showNextNotification = (!limited || nextNotification.forFeedback || 
nextNotification.urgency == Urgency.CRITICAL);
                 if (showNextNotification)
@@ -2040,7 +1679,7 @@ const MessageTray = new Lang.Class({
                            this._notification.urgency != Urgency.CRITICAL &&
                            !this._notification.focused &&
                            !this._pointerInNotification) || this._notificationExpired;
-            let mustClose = (this._notificationRemoved || !hasNotifications || expired || 
this._traySummoned);
+            let mustClose = (this._notificationRemoved || !hasNotifications || expired);
 
             if (mustClose) {
                 let animate = hasNotifications && !this._notificationRemoved;
@@ -2052,25 +1691,6 @@ const MessageTray = new Lang.Class({
             }
         }
 
-        // Tray itself
-        let trayIsVisible = (this._trayState == State.SHOWING ||
-                             this._trayState == State.SHOWN);
-        let trayShouldBeVisible = this._traySummoned && !this._keyboardVisible && hasNotifications;
-        if (!trayIsVisible && trayShouldBeVisible)
-            trayShouldBeVisible = this._showTray();
-        else if (trayIsVisible && !trayShouldBeVisible)
-            this._hideTray();
-
-        // Desktop clone
-        let desktopCloneIsVisible = (this._desktopCloneState == State.SHOWING ||
-                                     this._desktopCloneState == State.SHOWN);
-        let desktopCloneShouldBeVisible = (trayShouldBeVisible);
-
-        if (!desktopCloneIsVisible && desktopCloneShouldBeVisible)
-            this._showDesktopClone();
-        else if (desktopCloneIsVisible && !desktopCloneShouldBeVisible)
-            this._hideDesktopClone();
-
         this._updatingState = false;
 
         // Clean transient variables that are used to communicate actions
@@ -2102,90 +1722,6 @@ const MessageTray = new Lang.Class({
         this._updateState();
     },
 
-    _showTray: function() {
-        if (!this._grabHelper.grab({ actor: this.actor,
-                                     onUngrab: Lang.bind(this, this._escapeTray) })) {
-            this._traySummoned = false;
-            return false;
-        }
-
-        this.emit('showing');
-        this._tween(this.actor, '_trayState', State.SHOWN,
-                    { y: -this.actor.height,
-                      time: ANIMATION_TIME,
-                      transition: 'easeOutQuad'
-                    });
-
-        for (let i = 0; i < this._lightboxes.length; i++)
-            this._lightboxes[i].show(ANIMATION_TIME);
-
-        return true;
-    },
-
-    _updateDesktopCloneClip: function() {
-        let geometry = this._bottomMonitorGeometry;
-        let progress = -Math.round(this._desktopClone.y);
-        this._desktopClone.set_clip(geometry.x,
-                                    geometry.y + progress,
-                                    geometry.width,
-                                    geometry.height - progress);
-    },
-
-    _showDesktopClone: function() {
-        let bottomMonitor = Main.layoutManager.bottomMonitor;
-        this._bottomMonitorGeometry = { x: bottomMonitor.x,
-                                        y: bottomMonitor.y,
-                                        width: bottomMonitor.width,
-                                        height: bottomMonitor.height };
-
-        if (this._desktopClone)
-            this._desktopClone.destroy();
-        let cloneSource = Main.overview.visible ? Main.layoutManager.overviewGroup : global.window_group;
-        this._desktopClone = new Clutter.Clone({ source: cloneSource,
-                                                 clip: new Clutter.Geometry(this._bottomMonitorGeometry) });
-        Main.uiGroup.insert_child_above(this._desktopClone, cloneSource);
-        this._desktopClone.x = 0;
-        this._desktopClone.y = 0;
-        this._desktopClone.show();
-
-        this._tween(this._desktopClone, '_desktopCloneState', State.SHOWN,
-                    { y: -this.actor.height,
-                      time: ANIMATION_TIME,
-                      transition: 'easeOutQuad',
-                      onUpdate: Lang.bind(this, this._updateDesktopCloneClip)
-                    });
-    },
-
-    _hideTray: function() {
-        this.emit('hiding');
-        this._tween(this.actor, '_trayState', State.HIDDEN,
-                    { y: 0,
-                      time: ANIMATION_TIME,
-                      transition: 'easeOutQuad'
-                    });
-
-        // Note that we might have entered here without a grab,
-        // which would happen if GrabHelper ungrabbed for us.
-        // This is a no-op in that case.
-        this._grabHelper.ungrab({ actor: this.actor });
-        for (let i = 0; i < this._lightboxes.length; i++)
-            this._lightboxes[i].hide(ANIMATION_TIME);
-    },
-
-    _hideDesktopClone: function() {
-        this._tween(this._desktopClone, '_desktopCloneState', State.HIDDEN,
-                    { y: 0,
-                      time: ANIMATION_TIME,
-                      transition: 'easeOutQuad',
-                      onComplete: Lang.bind(this, function() {
-                          this._desktopClone.destroy();
-                          this._desktopClone = null;
-                          this._bottomMonitorGeometry = null;
-                      }),
-                      onUpdate: Lang.bind(this, this._updateDesktopCloneClip)
-                    });
-    },
-
     _onIdleMonitorBecameActive: function() {
         this._userActiveWhileNotificationShown = true;
         this._updateNotificationTimeout(2000);
@@ -2326,7 +1862,7 @@ const MessageTray = new Lang.Class({
 
         if (animate) {
             this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,
-                        { y: this.actor.height,
+                        { y: this._notificationWidget.height,
                           opacity: 0,
                           time: ANIMATION_TIME,
                           transition: 'easeOutQuad',
@@ -2335,7 +1871,7 @@ const MessageTray = new Lang.Class({
                         });
         } else {
             Tweener.removeTweens(this._notificationWidget);
-            this._notificationWidget.y = this.actor.height;
+            this._notificationWidget.y = this._notificationWidget.height;
             this._notificationWidget.opacity = 0;
             this._notificationState = State.HIDDEN;
             this._hideNotificationCompleted();


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