[gnome-shell/wip/message-tray: 2/18] messageTray: Clone, clip & move the window_group when tray is toggled
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/message-tray: 2/18] messageTray: Clone, clip & move the window_group when tray is toggled
- Date: Wed, 8 Aug 2012 20:52:43 +0000 (UTC)
commit 9858879c3d09226c35968c08dd52a9a50fe4b5ce
Author: Debarshi Ray <debarshir gnome org>
Date: Wed Aug 8 22:48:17 2012 +0200
messageTray: Clone, clip & move the window_group when tray is toggled
1) straddling windows get clipped at the monitor boundary
2) we move the bottom monitor and not the primary because that is
where the tray is
3) to stop the wallpaper from the bottom monitor leaking into the
primary, we adjust the clip as the clone animates up/down
https://bugzilla.gnome.org/show_bug.cgi?id=681392
js/ui/messageTray.js | 91 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 89 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index c71d7f6..2f12ba1 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1551,6 +1551,9 @@ const MessageTray = new Lang.Class({
this._notificationRemoved = false;
this._reNotifyAfterHideNotification = null;
this._inFullscreen = false;
+ this._desktopClone = null;
+ this._tweening = 0;
+ this._windowsShifted = 0;
this._corner = new Clutter.Rectangle({ width: 1,
height: 1,
@@ -2260,19 +2263,103 @@ const MessageTray = new Lang.Class({
},
_showTray: function() {
+ // Bail out if we are in the middle of tweening the tray or the
+ // windows.
+ if (this._tweening != 0)
+ return;
+
this._tween(this.actor, '_trayState', State.SHOWN,
{ y: -this.actor.height,
time: ANIMATION_TIME,
- transition: 'easeOutQuad'
+ transition: 'easeOutQuad',
+ onComplete:
+ { apply: Lang.bind(this, function() {
+ this._tweening--;
+ })
+ }
});
+ this._tweening++;
+
+ // Don't move the windows up if we are in the overview.
+ if (this._overviewVisible)
+ return;
+
+ let bottomMonitor = Main.layoutManager.bottomMonitor;
+ let geometry = new Clutter.Geometry({ x: bottomMonitor.x,
+ y: bottomMonitor.y,
+ width: bottomMonitor.width,
+ height: bottomMonitor.height
+ });
+ this._desktopClone = new Clutter.Clone({ source: global.window_group, clip: geometry });
+ Main.uiGroup.insert_child_above(this._desktopClone, global.window_group);
+ this._desktopClone.x = 0;
+ this._desktopClone.y = 0;
+ this._desktopClone.show();
+
+ Tweener.addTween(this._desktopClone,
+ { y: this._desktopClone.y - this.actor.height,
+ time: ANIMATION_TIME,
+ transition: 'easeOutQuad',
+ onComplete: Lang.bind(this, function() {
+ this._tweening--;
+ }),
+ onUpdate: Lang.bind(this, function() {
+ let progress = -1 * this._desktopClone.y;
+ this._desktopClone.set_clip(geometry.x,
+ geometry.y + progress,
+ geometry.width,
+ geometry.height - progress);
+ })
+ });
+ this._windowsShifted++;
+ this._tweening++;
},
_hideTray: function() {
+ // Bail out if we are in the middle of tweening the tray or the
+ // windows.
+ if (this._tweening != 0)
+ return;
+
this._tween(this.actor, '_trayState', State.HIDDEN,
{ y: 0,
time: ANIMATION_TIME,
- transition: 'easeOutQuad'
+ transition: 'easeOutQuad',
+ onComplete:
+ { apply: Lang.bind(this, function() {
+ this._tweening--;
+ })
+ }
});
+ this._tweening++;
+
+ // Don't move the windows down if had not moved them up. We can't use
+ // this._overviewVisible to check whether we were in the overview
+ // because it gets unset before this method is invoked.
+ if (this._windowsShifted == 0)
+ return;
+
+ let geometry = this._desktopClone.clip;
+ Tweener.addTween(this._desktopClone,
+ { y: this._desktopClone.y + this.actor.height,
+ time: ANIMATION_TIME,
+ transition: 'easeOutQuad',
+ onComplete: Lang.bind(this, function() {
+ this._windowsShifted--;
+ this._tweening--;
+ this._desktopClone.hide();
+ Main.uiGroup.remove_actor(this._desktopClone);
+ this._desktopClone = null;
+ }),
+ onUpdate: Lang.bind(this, function() {
+ let progress = this.actor.height + this._desktopClone.y; // y is -ve
+ this._desktopClone.set_clip(geometry.x,
+ geometry.y - progress,
+ geometry.width,
+ geometry.height + progress);
+ })
+ });
+ this._tweening++;
},
_onIdleMonitorWatch: function(monitor, id, userBecameIdle) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]