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:
parent
b84a7042f1
commit
3c8ba348c2
@ -466,6 +466,7 @@ SingleView.prototype = {
|
|||||||
this._indicatorsPanel = null;
|
this._indicatorsPanel = null;
|
||||||
this._indicatorsPanelWidth = null;
|
this._indicatorsPanelWidth = null;
|
||||||
this._scroll = null;
|
this._scroll = null;
|
||||||
|
this._lostWorkspaces = [];
|
||||||
this._scrolling = false;
|
this._scrolling = false;
|
||||||
this._animatingScroll = false;
|
this._animatingScroll = false;
|
||||||
},
|
},
|
||||||
@ -539,6 +540,37 @@ SingleView.prototype = {
|
|||||||
workspace.actor.hide();
|
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) {
|
_scrollScrollBarToIndex: function(index, showAnimation) {
|
||||||
@ -583,18 +615,27 @@ SingleView.prototype = {
|
|||||||
this._scrollScrollBarToIndex(active + 1, false);
|
this._scrollScrollBarToIndex(active + 1, false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < this._workspaces.length; i++)
|
let active = global.screen.get_active_workspace_index();
|
||||||
this._workspaces[i].destroy();
|
let removedNum = oldNumWorkspaces - newNumWorkspaces;
|
||||||
this._workspaces = [];
|
let removedIndex = active + 1;
|
||||||
this._actor.remove_all();
|
this._lostWorkspaces = this._workspaces.splice(removedIndex,
|
||||||
|
removedNum);
|
||||||
|
|
||||||
// Without this there will be lots of warnings
|
// Don't let the user try to select this workspace as it's
|
||||||
this._actor.hide();
|
// making its exit.
|
||||||
for (let w = 0; w < global.screen.n_workspaces; w++)
|
for (let l = 0; l < this._lostWorkspaces.length; l++)
|
||||||
this._addWorkspaceActor(w);
|
this._lostWorkspaces[l]._desktop.actor.reactive = false;
|
||||||
this._actor.show();
|
|
||||||
this._positionWorkspaces();
|
// reassign workspaceNum and metaWorkspace, as lost workspaces
|
||||||
this._updateWorkspaceActors();
|
// 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();
|
this._updatePanelVisibility();
|
||||||
|
Loading…
Reference in New Issue
Block a user