From eaa1f9a0f4f7c6561a36a5c82f55e08becf4f6ac Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Tue, 2 Feb 2010 14:02:32 +0100 Subject: [PATCH] [MessageTray] Fix positioning for multi-monitor environments We can't assume that the primary monitor is at position (0, 0); there may be another monitor configured at the left or at the top. --- js/ui/messageTray.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 92eb30ed8..076024be1 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -126,7 +126,7 @@ MessageTray.prototype = { this._summaryBin.connect('notify::allocation', Lang.bind(this, function() { let primary = global.get_primary_monitor(); - this._summaryBin.x = primary.width - this._summaryBin.width; + this._summaryBin.x = primary.x + primary.width - this._summaryBin.width; })); Main.chrome.addActor(this.actor, { affectsStruts: false }); @@ -147,8 +147,8 @@ MessageTray.prototype = { _setSizePosition: function() { let primary = global.get_primary_monitor(); - this.actor.x = 0; - this.actor.y = primary.height - 1; + this.actor.x = primary.x; + this.actor.y = primary.y + primary.height - 1; this.actor.width = primary.width; }, @@ -311,7 +311,7 @@ MessageTray.prototype = { _showTray: function() { let primary = global.get_primary_monitor(); Tweener.addTween(this.actor, - { y: primary.height - this.actor.height, + { y: primary.y + primary.height - this.actor.height, time: ANIMATION_TIME, transition: "easeOutQuad" }); @@ -321,7 +321,7 @@ MessageTray.prototype = { let primary = global.get_primary_monitor(); Tweener.addTween(this.actor, - { y: primary.height - 1, + { y: primary.y + primary.height - 1, time: ANIMATION_TIME, transition: "easeOutQuad" }); @@ -332,13 +332,14 @@ MessageTray.prototype = { this._notificationBox.setContent(this._notificationQueue.shift()); let notification = this._notificationBox.actor; - notification.opacity = 0; - notification.y = this.actor.height; + let primary = global.get_primary_monitor(); + notification.opacity = 0; + notification.y = primary.y + this.actor.height; notification.show(); - let futureY = this.actor.height - notification.height; + let futureY = primary.y + this.actor.height - notification.height; Tweener.addTween(notification, - { y: this.actor.height - notification.height, + { y: futureY, opacity: 255, time: ANIMATION_TIME, transition: "easeOutQuad" }); @@ -358,11 +359,12 @@ MessageTray.prototype = { }, _showSummary: function() { + let primary = global.get_primary_monitor(); this._summaryBin.opacity = 0; this._summaryBin.y = this.actor.height; this._summaryBin.show(); Tweener.addTween(this._summaryBin, - { y: this.actor.height - this._summaryBin.height, + { y: primary.y + this.actor.height - this._summaryBin.height, opacity: 255, time: ANIMATION_TIME, transition: "easeOutQuad" });