diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 335344eb0a0b6b335dd42f084b5b058abe36e53d..a4ed18d486c9d8af0d992201fff73bf6d178068a 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -453,6 +453,7 @@ class WorkspacesDisplay extends St.Widget { this._keyPressEventId = 0; this._scrollTimeoutId = 0; + this._actualGeometry = null; this._fullGeometry = null; this._inWindowDrag = false; @@ -614,13 +615,16 @@ class WorkspacesDisplay extends St.Widget { animateToOverview(fadeOnPrimary) { this.show(); this._updateWorkspacesViews(); - for (let i = 0; i < this._workspacesViews.length; i++) { - let animationType; - if (fadeOnPrimary && i == this._primaryIndex) - animationType = AnimationType.FADE; - else - animationType = AnimationType.ZOOM; - this._workspacesViews[i].animateToOverview(animationType); + + if (this._actualGeometry && this._fullGeometry) { + for (let i = 0; i < this._workspacesViews.length; i++) { + let animationType; + if (fadeOnPrimary && i == this._primaryIndex) + animationType = AnimationType.FADE; + else + animationType = AnimationType.ZOOM; + this._workspacesViews[i].animateToOverview(animationType); + } } this._restackedNotifyId = @@ -696,8 +700,10 @@ class WorkspacesDisplay extends St.Widget { this._workspacesViews.forEach(v => v.show()); - this._updateWorkspacesFullGeometry(); - this._updateWorkspacesActualGeometry(); + if (this._fullGeometry) + this._syncWorkspacesFullGeometry(); + if (this._actualGeometry) + this._syncWorkspacesActualGeometry(); } _getMonitorIndexForEvent(event) { @@ -749,10 +755,10 @@ class WorkspacesDisplay extends St.Widget { // the sliding controls were never slid in at all. setWorkspacesFullGeometry(geom) { this._fullGeometry = geom; - this._updateWorkspacesFullGeometry(); + this._syncWorkspacesFullGeometry(); } - _updateWorkspacesFullGeometry() { + _syncWorkspacesFullGeometry() { if (!this._workspacesViews.length) return; @@ -764,18 +770,21 @@ class WorkspacesDisplay extends St.Widget { } _updateWorkspacesActualGeometry() { + const [x, y] = this.get_transformed_position(); + const width = this.allocation.get_width(); + const height = this.allocation.get_height(); + + this._actualGeometry = { x, y, width, height }; + this._syncWorkspacesActualGeometry(); + } + + _syncWorkspacesActualGeometry() { if (!this._workspacesViews.length) return; - let [x, y] = this.get_transformed_position(); - let allocation = this.allocation; - let width = allocation.x2 - allocation.x1; - let height = allocation.y2 - allocation.y1; - let primaryGeometry = { x, y, width, height }; - let monitors = Main.layoutManager.monitors; for (let i = 0; i < monitors.length; i++) { - let geometry = i == this._primaryIndex ? primaryGeometry : monitors[i]; + let geometry = i === this._primaryIndex ? this._actualGeometry : monitors[i]; this._workspacesViews[i].setActualGeometry(geometry); } }