workspacesView: Clean up scroll code a bit

There's no code path that results in us not animating.

https://bugzilla.gnome.org/show_bug.cgi?id=689062
This commit is contained in:
Jasper St. Pierre 2012-11-25 23:54:11 -05:00
parent 5fc16bb05b
commit 57d9e7d5aa

View File

@ -208,11 +208,11 @@ const WorkspacesView = new Lang.Class({
this._workspaces[w].positionWindows(Workspace.WindowPositionFlags.ANIMATE); this._workspaces[w].positionWindows(Workspace.WindowPositionFlags.ANIMATE);
}, },
_scrollToActive: function(showAnimation) { _scrollToActive: function() {
let active = global.screen.get_active_workspace_index(); let active = global.screen.get_active_workspace_index();
this._updateWorkspaceActors(showAnimation); this._updateWorkspaceActors(true);
this._updateScrollAdjustment(active, showAnimation); this._updateScrollAdjustment(active);
}, },
// Update workspace actors parameters // Update workspace actors parameters
@ -270,13 +270,12 @@ const WorkspacesView = new Lang.Class({
} }
}, },
_updateScrollAdjustment: function(index, showAnimation) { _updateScrollAdjustment: function(index) {
if (this._scrolling) if (this._scrolling)
return; return;
this._animatingScroll = true; this._animatingScroll = true;
if (showAnimation) {
Tweener.addTween(this.scrollAdjustment, { Tweener.addTween(this.scrollAdjustment, {
value: index, value: index,
time: WORKSPACE_SWITCH_TIME, time: WORKSPACE_SWITCH_TIME,
@ -286,10 +285,6 @@ const WorkspacesView = new Lang.Class({
this._animatingScroll = false; this._animatingScroll = false;
}) })
}); });
} else {
this.scrollAdjustment.value = index;
this._animatingScroll = false;
}
}, },
updateWorkspaces: function(oldNumWorkspaces, newNumWorkspaces) { updateWorkspaces: function(oldNumWorkspaces, newNumWorkspaces) {
@ -316,7 +311,7 @@ const WorkspacesView = new Lang.Class({
if (this._scrolling) if (this._scrolling)
return; return;
this._scrollToActive(true); this._scrollToActive();
}, },
_onDestroy: function() { _onDestroy: function() {