workspacesView: Add back overview transition

The transition was temporarily removed when switching to the new
workspace layout manager. Now everything is in place to reimplement
it with a combination of the layout manager's state adjustment and
the view's allocation.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1345
This commit is contained in:
Florian Müllner 2020-06-25 19:54:54 +02:00
parent 96f63b08c2
commit 602078cbde
2 changed files with 28 additions and 25 deletions

View File

@ -636,7 +636,7 @@ var WorkspaceLayout = GObject.registerClass({
// example if the container height is being animated, we want to // example if the container height is being animated, we want to
// avoid animating the children allocations to make sure they // avoid animating the children allocations to make sure they
// don't "lag behind" the other animation). // don't "lag behind" the other animation).
if (layoutChanged) { if (layoutChanged && !Main.overview.animationInProgress) {
const transition = animateAllocation(child, childBox); const transition = animateAllocation(child, childBox);
if (transition) { if (transition) {
windowInfo.currentTransition = transition; windowInfo.currentTransition = transition;
@ -1149,6 +1149,15 @@ class Workspace extends St.Widget {
} }
zoomToOverview() { zoomToOverview() {
const animate =
this.metaWorkspace === null || this.metaWorkspace.active;
const adj = this.layout_manager.stateAdjustment;
adj.value = 0;
adj.ease(1, {
duration: animate ? Overview.ANIMATION_TIME : 0,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
} }
zoomFromOverview() { zoomFromOverview() {
@ -1166,29 +1175,10 @@ class Workspace extends St.Widget {
if (this.metaWorkspace !== null && !this.metaWorkspace.active) if (this.metaWorkspace !== null && !this.metaWorkspace.active)
return; return;
// Position and scale the windows. this.layout_manager.stateAdjustment.ease(0, {
for (let i = 0; i < this._windows.length; i++)
this._zoomWindowFromOverview(i);
}
_zoomWindowFromOverview(index) {
let clone = this._windows[index];
clone.hideOverlay(false);
if (clone.metaWindow.showing_on_its_workspace()) {
clone.ease({
opacity: 255,
duration: Overview.ANIMATION_TIME, duration: Overview.ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD, mode: Clutter.AnimationMode.EASE_OUT_QUAD,
}); });
} else {
// The window is hidden, make it shrink and fade it out
clone.ease({
opacity: 0,
duration: Overview.ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
}
} }
_onDestroy() { _onDestroy() {

View File

@ -7,6 +7,7 @@ const Main = imports.ui.main;
const SwipeTracker = imports.ui.swipeTracker; const SwipeTracker = imports.ui.swipeTracker;
const Workspace = imports.ui.workspace; const Workspace = imports.ui.workspace;
var { ANIMATION_TIME } = imports.ui.overview;
var WORKSPACE_SWITCH_TIME = 250; var WORKSPACE_SWITCH_TIME = 250;
var SCROLL_TIMEOUT_TIME = 150; var SCROLL_TIMEOUT_TIME = 150;
@ -579,6 +580,14 @@ class WorkspacesDisplay extends St.Widget {
animateFromOverview(fadeOnPrimary) { animateFromOverview(fadeOnPrimary) {
for (let i = 0; i < this._workspacesViews.length; i++) { for (let i = 0; i < this._workspacesViews.length; i++) {
const { x, y, width, height } =
Main.layoutManager.getWorkAreaForMonitor(i);
this._workspacesViews[i].ease({
x, y, width, height,
duration: ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
let animationType; let animationType;
if (fadeOnPrimary && i == this._primaryIndex) if (fadeOnPrimary && i == this._primaryIndex)
animationType = AnimationType.FADE; animationType = AnimationType.FADE;
@ -707,7 +716,11 @@ class WorkspacesDisplay extends St.Widget {
if (!primaryView) if (!primaryView)
return; return;
primaryView.set(this._actualGeometry); primaryView.ease({
...this._actualGeometry,
duration: Main.overview.animationInProgress ? ANIMATION_TIME : 0,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
} }
_onRestacked(overview, stackIndices) { _onRestacked(overview, stackIndices) {