Slide out removed workspaces in linear view

Instead of deleting workspaces immediately, animate the removal - it may
be useless eye-candy, but it's pretty sexy nonetheless ...
More seriously, the animation improves consistency with both workspace
additions and the mosaic view.

https://bugzilla.gnome.org/show_bug.cgi?id=609673
This commit is contained in:
Florian Müllner 2010-02-11 15:52:49 +01:00
parent b84a7042f1
commit 3c8ba348c2

View File

@ -466,6 +466,7 @@ SingleView.prototype = {
this._indicatorsPanel = null;
this._indicatorsPanelWidth = null;
this._scroll = null;
this._lostWorkspaces = [];
this._scrolling = false;
this._animatingScroll = false;
},
@ -539,6 +540,37 @@ SingleView.prototype = {
workspace.actor.hide();
}
}
for (let l = 0; l < this._lostWorkspaces.length; l++) {
let workspace = this._lostWorkspaces[l];
workspace.gridX += dx;
workspace.actor.show();
workspace._hideAllOverlays();
if (showAnimation) {
Tweener.addTween(workspace.actor,
{ x: workspace.gridX,
time: WORKSPACE_SWITCH_TIME,
transition: 'easeOutQuad',
onComplete: Lang.bind(this, this._cleanWorkspaces)
});
} else {
this._cleanWorkspaces();
}
}
},
_cleanWorkspaces: function() {
if (this._lostWorkspaces.length == 0)
return;
for (let l = 0; l < this._lostWorkspaces.length; l++)
this._lostWorkspaces[l].destroy();
this._lostWorkspaces = [];
this._positionWorkspaces();
this._updateWorkspaceActors();
},
_scrollScrollBarToIndex: function(index, showAnimation) {
@ -583,18 +615,27 @@ SingleView.prototype = {
this._scrollScrollBarToIndex(active + 1, false);
} else {
for (let i = 0; i < this._workspaces.length; i++)
this._workspaces[i].destroy();
this._workspaces = [];
this._actor.remove_all();
let active = global.screen.get_active_workspace_index();
let removedNum = oldNumWorkspaces - newNumWorkspaces;
let removedIndex = active + 1;
this._lostWorkspaces = this._workspaces.splice(removedIndex,
removedNum);
// Without this there will be lots of warnings
this._actor.hide();
for (let w = 0; w < global.screen.n_workspaces; w++)
this._addWorkspaceActor(w);
this._actor.show();
this._positionWorkspaces();
this._updateWorkspaceActors();
// Don't let the user try to select this workspace as it's
// making its exit.
for (let l = 0; l < this._lostWorkspaces.length; l++)
this._lostWorkspaces[l]._desktop.actor.reactive = false;
// reassign workspaceNum and metaWorkspace, as lost workspaces
// have not necessarily been removed from the end
for (let i = removedIndex; i < this._workspaces.length; i++) {
let metaWorkspace = global.screen.get_workspace_by_index(i);
this._workspaces[i].workspaceNum = i;
this._workspaces[i]._metaWorkspace = metaWorkspace;
}
this._scrollScrollBarToIndex(active, false);
this._scrollToActive(true);
}
this._updatePanelVisibility();