From 22f4a6b7f6c8383e085556cd3809d03ffd29ebe0 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 2 Jan 2021 16:17:17 -0300 Subject: [PATCH] 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: --- js/ui/overviewControls.js | 4 ++-- js/ui/viewSelector.js | 8 ++++---- js/ui/workspace.js | 24 ------------------------ js/ui/workspacesView.js | 21 ++++++--------------- 4 files changed, 12 insertions(+), 45 deletions(-) diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js index 756943630..9dbda1459 100644 --- a/js/ui/overviewControls.js +++ b/js/ui/overviewControls.js @@ -178,7 +178,7 @@ class ControlsManager extends St.Widget { } animateToOverview(callback) { - this.viewSelector.animateToOverview(); + this.viewSelector.prepareToEnterOverview(); this._stateAdjustment.value = ControlsState.HIDDEN; this._stateAdjustment.ease(ControlsState.WINDOW_PICKER, { @@ -194,7 +194,7 @@ class ControlsManager extends St.Widget { animateFromOverview(callback) { this._ignoreShowAppsButtonToggle = true; - this.viewSelector.animateFromOverview(); + this.viewSelector.prepareToLeaveOverview(); this._stateAdjustment.ease(ControlsState.HIDDEN, { duration: Overview.ANIMATION_TIME, diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index 1ad725d0b..95d6d7e5c 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -403,10 +403,10 @@ var ViewSelector = GObject.registerClass({ Main.overview.show(); } - animateToOverview() { + prepareToEnterOverview() { this.show(); this.reset(); - this._workspacesDisplay.animateToOverview(); + this._workspacesDisplay.prepareToEnterOverview(); this._activePage = null; this._showPage(this._activitiesPage); @@ -414,8 +414,8 @@ var ViewSelector = GObject.registerClass({ Main.overview.fadeOutDesktop(); } - animateFromOverview() { - this._workspacesDisplay.animateFromOverview(); + prepareToLeaveOverview() { + this._workspacesDisplay.prepareToLeaveOverview(); if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) Main.overview.fadeInDesktop(); diff --git a/js/ui/workspace.js b/js/ui/workspace.js index b37a7e39e..954812bdc 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -6,7 +6,6 @@ const { Clutter, GLib, GObject, Graphene, Meta, St } = imports.gi; const Background = imports.ui.background; const DND = imports.ui.dnd; const Main = imports.ui.main; -const Overview = imports.ui.overview; const Params = imports.misc.params; const Util = imports.misc.util; const { WindowPreview } = imports.ui.windowPreview; @@ -1154,17 +1153,6 @@ class Workspace extends St.Widget { 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() { for (let i = 0; i < this._windows.length; i++) 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)); } - 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() { if (this._overviewHiddenId) { Main.overview.disconnect(this._overviewHiddenId); diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 5cdeb3185..67936c597 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -130,6 +130,7 @@ class WorkspacesView extends WorkspacesViewBase { this._switchWorkspaceNotifyId = global.window_manager.connect('switch-workspace', this._activeWorkspaceChanged.bind(this)); + this._updateVisibility(); } _getFitAllBox(box, spacing, vertical) { @@ -320,11 +321,7 @@ class WorkspacesView extends WorkspacesViewBase { return this._workspaces[active]; } - animateToOverview() { - this._updateVisibility(); - } - - animateFromOverview() { + prepareToLeaveOverview() { for (let w = 0; w < this._workspaces.length; w++) this._workspaces[w].prepareToLeaveOverview(); } @@ -487,10 +484,7 @@ class ExtraWorkspaceView extends WorkspacesViewBase { return this._workspace; } - animateToOverview() { - } - - animateFromOverview() { + prepareToLeaveOverview() { this._workspace.prepareToLeaveOverview(); } @@ -709,13 +703,10 @@ class WorkspacesDisplay extends St.Widget { primaryWorkspace.visible = visible; } - animateToOverview() { + prepareToEnterOverview() { this.show(); this._updateWorkspacesViews(); - for (let i = 0; i < this._workspacesViews.length; i++) - this._workspacesViews[i].animateToOverview(); - this._restackedNotifyId = Main.overview.connect('windows-restacked', 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)); } - animateFromOverview() { + prepareToLeaveOverview() { for (let i = 0; i < this._workspacesViews.length; i++) - this._workspacesViews[i].animateFromOverview(); + this._workspacesViews[i].prepareToLeaveOverview(); this._leavingOverview = true; this._updateSwipeTracker();