Skip to content

Commit

Permalink
Added missing code for second panel in layout.js and fixed top panel …
Browse files Browse the repository at this point in the history
…hiding (issue #150)
  • Loading branch information
glebihan committed Jan 18, 2012
1 parent 311d82c commit 5c46a5b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 31 deletions.
60 changes: 43 additions & 17 deletions js/ui/layout.js
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}
},

Expand Down Expand Up @@ -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() {
Expand Down
28 changes: 14 additions & 14 deletions js/ui/panel.js
Expand Up @@ -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'
});
Expand All @@ -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;
Expand Down Expand Up @@ -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'
});
Expand All @@ -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;
Expand Down

0 comments on commit 5c46a5b

Please sign in to comment.