From 5c46a5b533a6a7103453796d2bd27fa746548f75 Mon Sep 17 00:00:00 2001 From: Gwendal Le Bihan Date: Wed, 18 Jan 2012 22:31:39 +0100 Subject: [PATCH] Added missing code for second panel in layout.js and fixed top panel hiding (issue #150) --- js/ui/layout.js | 60 +++++++++++++++++++++++++++++++++++-------------- js/ui/panel.js | 28 +++++++++++------------ 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/js/ui/layout.js b/js/ui/layout.js index 0714bb4f0e..cf73f67ff0 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -30,6 +30,8 @@ LayoutManager.prototype = { this._hotCorners = []; this._leftPanelBarrier = 0; this._rightPanelBarrier = 0; + this._leftPanelBarrier2 = 0; + this._rightPanelBarrier2 = 0; this._trayBarrier = 0; this._chrome = new Chrome(this); @@ -272,40 +274,56 @@ LayoutManager.prototype = { this.bottomMonitor.width, this.bottomMonitor.height); }, - _updatePanelBarriers: function() { - if (this._leftPanelBarrier) - global.destroy_pointer_barrier(this._leftPanelBarrier); - if (this._rightPanelBarrier) - global.destroy_pointer_barrier(this._rightPanelBarrier); + _updatePanelBarriers: function(panelBox) { + let leftPanelBarrier; + let rightPanelBarrier; + if (panelBox==this.panelBox){ + leftPanelBarrier = this._leftPanelBarrier; + rightPanelBarrier = this._rightPanelBarrier; + }else{ + leftPanelBarrier = this._leftPanelBarrier2; + rightPanelBarrier = this._rightPanelBarrier2; + } + if (leftPanelBarrier) + global.destroy_pointer_barrier(leftPanelBarrier); + if (rightPanelBarrier) + global.destroy_pointer_barrier(rightPanelBarrier); - if (this.panelBox.height) { - if (Main.desktop_layout == Main.LAYOUT_TRADITIONAL) { + if (panelBox.height) { + if (Main.desktop_layout == Main.LAYOUT_TRADITIONAL && panelBox==this.panelBox) { let monitor = this.bottomMonitor; - this._leftPanelBarrier = - global.create_pointer_barrier(monitor.x, monitor.y + monitor.height - this.panelBox.height, + leftPanelBarrier = + global.create_pointer_barrier(monitor.x, monitor.y + monitor.height - panelBox.height, monitor.x, monitor.y + monitor.height, 1 /* BarrierPositiveX */); - this._rightPanelBarrier = - global.create_pointer_barrier(monitor.x + monitor.width, monitor.y + monitor.height - this.panelBox.height, + rightPanelBarrier = + global.create_pointer_barrier(monitor.x + monitor.width, monitor.y + monitor.height - panelBox.height, monitor.x + monitor.width, monitor.y + monitor.height, 4 /* BarrierNegativeX */); } else { let primary = this.primaryMonitor; - this._leftPanelBarrier = + leftPanelBarrier = global.create_pointer_barrier(primary.x, primary.y, -- primary.x, primary.y + this.panelBox.height, +- primary.x, primary.y + panelBox.height, 1 /* BarrierPositiveX */); - this._rightPanelBarrier = + rightPanelBarrier = global.create_pointer_barrier(primary.x + primary.width, primary.y, -- primary.x + primary.width, primary.y + this.panelBox.height, +- primary.x + primary.width, primary.y + panelBox.height, 4 /* BarrierNegativeX */); } } else { - this._leftPanelBarrier = 0; - this._rightPanelBarrier = 0; + leftPanelBarrier = 0; + rightPanelBarrier = 0; + } + if (panelBox==this.panelBox){ + this._leftPanelBarrier = leftPanelBarrier; + this._rightPanelBarrier = rightPanelBarrier; + }else{ + this._leftPanelBarrier2 = leftPanelBarrier; + this._rightPanelBarrier2 = rightPanelBarrier; } }, @@ -381,6 +399,14 @@ LayoutManager.prototype = { onComplete: this._startupAnimationComplete, onCompleteScope: this }); + this.panelBox2.anchor_y = this.panelBox2.height; + Tweener.addTween(this.panelBox2, + { anchor_y: 0, + time: STARTUP_ANIMATION_TIME, + transition: 'easeOutQuad', + onComplete: this._startupAnimationComplete, + onCompleteScope: this + }); }, _startupAnimationComplete: function() { diff --git a/js/ui/panel.js b/js/ui/panel.js index cf00a973ce..3efe8972b9 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -678,11 +678,11 @@ Panel.prototype = { transition: 'easeOutQuad' }; - Tweener.addTween(Main.panel._leftCorner.actor, params); - Tweener.addTween(Main.panel._rightCorner.actor, params); + Tweener.addTween(this._leftCorner.actor, params); + Tweener.addTween(this._rightCorner.actor, params); - Tweener.addTween(Main.panel.actor, - { height: PANEL_HEIGHT, + Tweener.addTween(this.actor, + { y: 0, time: AUTOHIDE_ANIMATION_TIME, transition: 'easeOutQuad' }); @@ -692,9 +692,9 @@ Panel.prototype = { transition: 'easeOutQuad' }; - Tweener.addTween(Main.panel._leftBox, params); - Tweener.addTween(Main.panel._centerBox, params); - Tweener.addTween(Main.panel._rightBox, params); + Tweener.addTween(this._leftBox, params); + Tweener.addTween(this._centerBox, params); + Tweener.addTween(this._rightBox, params); } this._hidden = false; @@ -728,8 +728,8 @@ Panel.prototype = { Tweener.addTween(this._rightBox, params); } else { - Tweener.addTween(Main.panel.actor, - { height: 1, + Tweener.addTween(this.actor, + { y: -PANEL_HEIGHT + 1, time: AUTOHIDE_ANIMATION_TIME, transition: 'easeOutQuad' }); @@ -739,17 +739,17 @@ Panel.prototype = { transition: 'easeOutQuad' }; - Tweener.addTween(Main.panel._leftCorner.actor, params); - Tweener.addTween(Main.panel._rightCorner.actor, params); + Tweener.addTween(this._leftCorner.actor, params); + Tweener.addTween(this._rightCorner.actor, params); params = { opacity: 0, time: AUTOHIDE_ANIMATION_TIME - 0.1, transition: 'easeOutQuad' }; - Tweener.addTween(Main.panel._leftBox, params); - Tweener.addTween(Main.panel._centerBox, params); - Tweener.addTween(Main.panel._rightBox, params); + Tweener.addTween(this._leftBox, params); + Tweener.addTween(this._centerBox, params); + Tweener.addTween(this._rightBox, params); } this._hidden = true;