workspace, workspacesView: Cleanup animation methods

Remove Workspace.zoomTo/FromOverview(), they're unused now. Rename
everything up to ControlsManager to prepareToEnter/LeaveOverview(),
since these classes don't run the animation anymore.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1624>
This commit is contained in:
Georges Basile Stavracas Neto 2021-01-02 16:17:17 -03:00 committed by Marge Bot
parent d221215ab6
commit 22f4a6b7f6
4 changed files with 12 additions and 45 deletions

View File

@ -178,7 +178,7 @@ class ControlsManager extends St.Widget {
} }
animateToOverview(callback) { animateToOverview(callback) {
this.viewSelector.animateToOverview(); this.viewSelector.prepareToEnterOverview();
this._stateAdjustment.value = ControlsState.HIDDEN; this._stateAdjustment.value = ControlsState.HIDDEN;
this._stateAdjustment.ease(ControlsState.WINDOW_PICKER, { this._stateAdjustment.ease(ControlsState.WINDOW_PICKER, {
@ -194,7 +194,7 @@ class ControlsManager extends St.Widget {
animateFromOverview(callback) { animateFromOverview(callback) {
this._ignoreShowAppsButtonToggle = true; this._ignoreShowAppsButtonToggle = true;
this.viewSelector.animateFromOverview(); this.viewSelector.prepareToLeaveOverview();
this._stateAdjustment.ease(ControlsState.HIDDEN, { this._stateAdjustment.ease(ControlsState.HIDDEN, {
duration: Overview.ANIMATION_TIME, duration: Overview.ANIMATION_TIME,

View File

@ -403,10 +403,10 @@ var ViewSelector = GObject.registerClass({
Main.overview.show(); Main.overview.show();
} }
animateToOverview() { prepareToEnterOverview() {
this.show(); this.show();
this.reset(); this.reset();
this._workspacesDisplay.animateToOverview(); this._workspacesDisplay.prepareToEnterOverview();
this._activePage = null; this._activePage = null;
this._showPage(this._activitiesPage); this._showPage(this._activitiesPage);
@ -414,8 +414,8 @@ var ViewSelector = GObject.registerClass({
Main.overview.fadeOutDesktop(); Main.overview.fadeOutDesktop();
} }
animateFromOverview() { prepareToLeaveOverview() {
this._workspacesDisplay.animateFromOverview(); this._workspacesDisplay.prepareToLeaveOverview();
if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows())
Main.overview.fadeInDesktop(); Main.overview.fadeInDesktop();

View File

@ -6,7 +6,6 @@ const { Clutter, GLib, GObject, Graphene, Meta, St } = imports.gi;
const Background = imports.ui.background; const Background = imports.ui.background;
const DND = imports.ui.dnd; const DND = imports.ui.dnd;
const Main = imports.ui.main; const Main = imports.ui.main;
const Overview = imports.ui.overview;
const Params = imports.misc.params; const Params = imports.misc.params;
const Util = imports.misc.util; const Util = imports.misc.util;
const { WindowPreview } = imports.ui.windowPreview; const { WindowPreview } = imports.ui.windowPreview;
@ -1154,17 +1153,6 @@ class Workspace extends St.Widget {
return false; return false;
} }
zoomToOverview() {
const animate =
this.metaWorkspace === null || this.metaWorkspace.active;
const adj = this.layout_manager.stateAdjustment;
adj.ease(1, {
duration: animate ? Overview.ANIMATION_TIME : 0,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
}
prepareToLeaveOverview() { prepareToLeaveOverview() {
for (let i = 0; i < this._windows.length; i++) for (let i = 0; i < this._windows.length; i++)
this._windows[i].remove_all_transitions(); this._windows[i].remove_all_transitions();
@ -1178,18 +1166,6 @@ class Workspace extends St.Widget {
this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this)); this._overviewHiddenId = Main.overview.connect('hidden', this._doneLeavingOverview.bind(this));
} }
zoomFromOverview() {
this.prepareToLeaveOverview();
if (this.metaWorkspace !== null && !this.metaWorkspace.active)
return;
this.layout_manager.stateAdjustment.ease(0, {
duration: Overview.ANIMATION_TIME,
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
});
}
_onDestroy() { _onDestroy() {
if (this._overviewHiddenId) { if (this._overviewHiddenId) {
Main.overview.disconnect(this._overviewHiddenId); Main.overview.disconnect(this._overviewHiddenId);

View File

@ -130,6 +130,7 @@ class WorkspacesView extends WorkspacesViewBase {
this._switchWorkspaceNotifyId = this._switchWorkspaceNotifyId =
global.window_manager.connect('switch-workspace', global.window_manager.connect('switch-workspace',
this._activeWorkspaceChanged.bind(this)); this._activeWorkspaceChanged.bind(this));
this._updateVisibility();
} }
_getFitAllBox(box, spacing, vertical) { _getFitAllBox(box, spacing, vertical) {
@ -320,11 +321,7 @@ class WorkspacesView extends WorkspacesViewBase {
return this._workspaces[active]; return this._workspaces[active];
} }
animateToOverview() { prepareToLeaveOverview() {
this._updateVisibility();
}
animateFromOverview() {
for (let w = 0; w < this._workspaces.length; w++) for (let w = 0; w < this._workspaces.length; w++)
this._workspaces[w].prepareToLeaveOverview(); this._workspaces[w].prepareToLeaveOverview();
} }
@ -487,10 +484,7 @@ class ExtraWorkspaceView extends WorkspacesViewBase {
return this._workspace; return this._workspace;
} }
animateToOverview() { prepareToLeaveOverview() {
}
animateFromOverview() {
this._workspace.prepareToLeaveOverview(); this._workspace.prepareToLeaveOverview();
} }
@ -709,13 +703,10 @@ class WorkspacesDisplay extends St.Widget {
primaryWorkspace.visible = visible; primaryWorkspace.visible = visible;
} }
animateToOverview() { prepareToEnterOverview() {
this.show(); this.show();
this._updateWorkspacesViews(); this._updateWorkspacesViews();
for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].animateToOverview();
this._restackedNotifyId = this._restackedNotifyId =
Main.overview.connect('windows-restacked', Main.overview.connect('windows-restacked',
this._onRestacked.bind(this)); this._onRestacked.bind(this));
@ -726,9 +717,9 @@ class WorkspacesDisplay extends St.Widget {
this._keyPressEventId = global.stage.connect('key-press-event', this._onKeyPressEvent.bind(this)); this._keyPressEventId = global.stage.connect('key-press-event', this._onKeyPressEvent.bind(this));
} }
animateFromOverview() { prepareToLeaveOverview() {
for (let i = 0; i < this._workspacesViews.length; i++) for (let i = 0; i < this._workspacesViews.length; i++)
this._workspacesViews[i].animateFromOverview(); this._workspacesViews[i].prepareToLeaveOverview();
this._leavingOverview = true; this._leavingOverview = true;
this._updateSwipeTracker(); this._updateSwipeTracker();