From 4b3c9e826dfdb27ec5ab51f77afb3ea148def45e Mon Sep 17 00:00:00 2001 From: Adel Gadllah Date: Tue, 19 Feb 2013 23:13:36 +0100 Subject: [PATCH] workspace: Don't use grid layout Right now we arrange the window thumbnails in a grid if there are more than two rows of them. This was originally intended to reduce the amount of noise in the thumbnail arrangement. It also made sense when the thumbnails were of a similar size. Nowadays we reflect the size of windows in the size of the thumbnail. This leads to huge amounts of space between some windows when they are grid aligned. Removing the grid alignment would also lead to larger thumbnails. https://bugzilla.gnome.org/show_bug.cgi?id=694210 --- js/ui/workspace.js | 54 +--------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 6f61d1e76..0fca7c1fc 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -974,57 +974,6 @@ const UnalignedLayoutStrategy = new Lang.Class({ } }); -const GridLayoutStrategy = new Lang.Class({ - Name: 'GridLayoutStrategy', - Extends: LayoutStrategy, - - _computeRowSizes: function(layout) { - let { rows: rows, scale: scale } = layout; - - let gridWidth = layout.numColumns * layout.maxWindowWidth; - let hspacing = (layout.numColumns - 1) * this._columnSpacing; - for (let i = 0; i < rows.length; i++) { - let row = rows[i]; - row.fullWidth = layout.gridWidth; - row.fullHeight = layout.maxWindowHeight; - - row.width = row.fullWidth * scale + hspacing; - row.height = row.fullHeight * scale; - row.cellWidth = layout.maxWindowWidth * scale; - } - }, - - computeLayout: function(windows, layout) { - let { numRows: numRows, numColumns: numColumns } = layout; - let rows = []; - let windowIdx = 0; - - let maxWindowWidth = 0; - let maxWindowHeight = 0; - for (let i = 0; i < numRows; i++) { - let row = this._newRow(); - rows.push(row); - for (; windowIdx < windows.length; windowIdx++) { - if (row.windows.length >= numColumns) - break; - - let window = windows[windowIdx]; - row.windows.push(window); - - let s = this._computeWindowScale(window, 1); - maxWindowWidth = Math.max(maxWindowWidth, window.actor.width * s); - maxWindowHeight = Math.max(maxWindowHeight, window.actor.height * s); - } - } - - layout.rows = rows; - layout.maxColumns = numColumns; - layout.gridWidth = numColumns * maxWindowWidth; - layout.gridHeight = numRows * maxWindowHeight; - layout.maxWindowWidth = maxWindowWidth; - layout.maxWindowHeight = maxWindowHeight; - } -}); /** * @metaWorkspace: a #Meta.Workspace, or null @@ -1650,8 +1599,7 @@ const Workspace = new Lang.Class({ if (numColumns == lastLayout.numColumns) break; - let strategyClass = numRows > 2 ? GridLayoutStrategy : UnalignedLayoutStrategy; - let strategy = new strategyClass(this._monitor, rowSpacing, columnSpacing); + let strategy = new UnalignedLayoutStrategy(this._monitor, rowSpacing, columnSpacing); let layout = { area: area, strategy: strategy, numRows: numRows, numColumns: numColumns }; strategy.computeLayout(windows, layout);