From 59ba5504d0e4fb831fccf2b130ff6c6c13f7ed9f Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 25 Feb 2013 22:41:40 -0500 Subject: [PATCH] workspace: Calculate the window slots when we reposition Repositioning will eventually be separated from recalculation to accomodate two different geometries, so we'll need to do the padding and area manipulation in two different areas. https://bugzilla.gnome.org/show_bug.cgi?id=694469 --- js/ui/workspace.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index d0d989ee8..af0fdfe36 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1039,8 +1039,12 @@ const Workspace = new Lang.Class({ let initialPositioning = flags & WindowPositionFlags.INITIAL; let animate = flags & WindowPositionFlags.ANIMATE; - // Start the animations - let slots = this._computeAllWindowSlots(clones); + let layout = this._computeLayout(clones); + let strategy = layout.strategy; + + let [, , padding] = this._getSpacingAndPadding(); + let area = padArea(this._fullGeometry, padding); + let slots = strategy.computeWindowSlots(layout, area); let currentWorkspace = global.screen.get_active_workspace(); let isOnCurrentWorkspace = this.metaWorkspace == null || this.metaWorkspace == currentWorkspace; @@ -1484,7 +1488,7 @@ const Workspace = new Lang.Class({ } }, - _computeLayout: function(windows, area, rowSpacing, columnSpacing) { + _getBestLayout: function(windows, area, rowSpacing, columnSpacing) { // We look for the largest scale that allows us to fit the // largest row/tallest column on the workspace. @@ -1546,11 +1550,10 @@ const Workspace = new Lang.Class({ return [rowSpacing, columnSpacing, padding]; }, - _computeAllWindowSlots: function(windows) { + _computeLayout: function(windows) { let [rowSpacing, columnSpacing, padding] = this._getSpacingAndPadding(); let area = padArea(this._fullGeometry, padding); - let layout = this._computeLayout(windows, area, rowSpacing, columnSpacing); - return layout.strategy.computeWindowSlots(layout, area); + return this._getBestLayout(windows, area, rowSpacing, columnSpacing); }, _onCloneSelected : function (clone, time) {