workspace: Separate out spacing/padding code
This will be used when we introduce the second geometry. https://bugzilla.gnome.org/show_bug.cgi?id=694469
This commit is contained in:
parent
b925322e9e
commit
65eb5a3d05
@ -890,6 +890,14 @@ const UnalignedLayoutStrategy = new Lang.Class({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function padArea(area, padding) {
|
||||||
|
return {
|
||||||
|
x: area.x + padding.left,
|
||||||
|
y: area.y + padding.top,
|
||||||
|
width: area.width - padding.left - padding.right,
|
||||||
|
height: area.height - padding.top - padding.bottom,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @metaWorkspace: a #Meta.Workspace, or null
|
* @metaWorkspace: a #Meta.Workspace, or null
|
||||||
@ -1506,7 +1514,7 @@ const Workspace = new Lang.Class({
|
|||||||
return lastLayout;
|
return lastLayout;
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeAllWindowSlots: function(windows) {
|
_getSpacingAndPadding: function() {
|
||||||
let node = this.actor.get_theme_node();
|
let node = this.actor.get_theme_node();
|
||||||
|
|
||||||
// Window grid spacing
|
// Window grid spacing
|
||||||
@ -1535,13 +1543,12 @@ const Workspace = new Lang.Class({
|
|||||||
padding.left += leftBorder;
|
padding.left += leftBorder;
|
||||||
padding.right += rightBorder;
|
padding.right += rightBorder;
|
||||||
|
|
||||||
let area = {
|
return [rowSpacing, columnSpacing, padding];
|
||||||
x: this._fullGeometry.x + padding.left,
|
},
|
||||||
y: this._fullGeometry.y + padding.top,
|
|
||||||
width: this._fullGeometry.width - padding.left - padding.right,
|
|
||||||
height: this._fullGeometry.height - padding.top - padding.bottom,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
_computeAllWindowSlots: function(windows) {
|
||||||
|
let [rowSpacing, columnSpacing, padding] = this._getSpacingAndPadding();
|
||||||
|
let area = padArea(this._fullGeometry, padding);
|
||||||
let layout = this._computeLayout(windows, area, rowSpacing, columnSpacing);
|
let layout = this._computeLayout(windows, area, rowSpacing, columnSpacing);
|
||||||
return layout.strategy.computeWindowSlots(layout, area);
|
return layout.strategy.computeWindowSlots(layout, area);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user