Overview: apply extra padding to windows in external monitor
Add an style class targetting workspaces located outside the overview, and use it for extra padding around the window clones. Padding is passed down and applied inside LayoutStrategy, consolidating code that previously handled the bottom side only. https://bugzilla.gnome.org/show_bug.cgi?id=690171
This commit is contained in:
parent
c97b4dd48e
commit
27ad8305e5
@ -727,6 +727,10 @@ StScrollBar StButton#vhandle:active {
|
|||||||
-vertical-spacing: 32px;
|
-vertical-spacing: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.window-picker.external-monitor {
|
||||||
|
padding: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Dash */
|
/* Dash */
|
||||||
|
|
||||||
#dash {
|
#dash {
|
||||||
@ -751,10 +755,6 @@ StScrollBar StButton#vhandle:active {
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#viewSelector {
|
|
||||||
spacing: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Search Box */
|
/* Search Box */
|
||||||
|
|
||||||
#searchEntry {
|
#searchEntry {
|
||||||
|
@ -746,11 +746,10 @@ const LayoutStrategy = new Lang.Class({
|
|||||||
Name: 'LayoutStrategy',
|
Name: 'LayoutStrategy',
|
||||||
Abstract: true,
|
Abstract: true,
|
||||||
|
|
||||||
_init: function(monitor, rowSpacing, columnSpacing, bottomPadding) {
|
_init: function(monitor, rowSpacing, columnSpacing) {
|
||||||
this._monitor = monitor;
|
this._monitor = monitor;
|
||||||
this._rowSpacing = rowSpacing;
|
this._rowSpacing = rowSpacing;
|
||||||
this._columnSpacing = columnSpacing;
|
this._columnSpacing = columnSpacing;
|
||||||
this._bottomPadding = bottomPadding;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_newRow: function() {
|
_newRow: function() {
|
||||||
@ -830,7 +829,7 @@ const LayoutStrategy = new Lang.Class({
|
|||||||
let area = layout.area;
|
let area = layout.area;
|
||||||
|
|
||||||
let hspacing = (layout.maxColumns - 1) * this._columnSpacing;
|
let hspacing = (layout.maxColumns - 1) * this._columnSpacing;
|
||||||
let vspacing = (layout.numRows - 1) * this._rowSpacing + this._bottomPadding;
|
let vspacing = (layout.numRows - 1) * this._rowSpacing;
|
||||||
|
|
||||||
let spacedWidth = area.width - hspacing;
|
let spacedWidth = area.width - hspacing;
|
||||||
let spacedHeight = area.height - vspacing;
|
let spacedHeight = area.height - vspacing;
|
||||||
@ -864,7 +863,7 @@ const LayoutStrategy = new Lang.Class({
|
|||||||
y += row.height + this._rowSpacing;
|
y += row.height + this._rowSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
let height = y - this._rowSpacing + this._bottomPadding;
|
let height = y - this._rowSpacing;
|
||||||
let baseY = (area.height - height) / 2;
|
let baseY = (area.height - height) / 2;
|
||||||
|
|
||||||
for (let i = 0; i < rows.length; i++) {
|
for (let i = 0; i < rows.length; i++) {
|
||||||
@ -1038,6 +1037,8 @@ const Workspace = new Lang.Class({
|
|||||||
this._windowOverlaysGroup.set_size(0, 0);
|
this._windowOverlaysGroup.set_size(0, 0);
|
||||||
|
|
||||||
this.actor = new St.Widget({ style_class: 'window-picker' });
|
this.actor = new St.Widget({ style_class: 'window-picker' });
|
||||||
|
if (monitorIndex != Main.layoutManager.primaryIndex)
|
||||||
|
this.actor.add_style_class_name('external-monitor');
|
||||||
this.actor.set_size(0, 0);
|
this.actor.set_size(0, 0);
|
||||||
|
|
||||||
this._dropRect = new Clutter.Rectangle({ opacity: 0 });
|
this._dropRect = new Clutter.Rectangle({ opacity: 0 });
|
||||||
@ -1624,7 +1625,7 @@ const Workspace = new Lang.Class({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_computeLayout: function(windows, area, rowSpacing, columnSpacing, bottomPadding) {
|
_computeLayout: function(windows, area, rowSpacing, columnSpacing) {
|
||||||
// We look for the largest scale that allows us to fit the
|
// We look for the largest scale that allows us to fit the
|
||||||
// largest row/tallest column on the workspace.
|
// largest row/tallest column on the workspace.
|
||||||
|
|
||||||
@ -1640,7 +1641,7 @@ const Workspace = new Lang.Class({
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
let strategyClass = numRows > 2 ? GridLayoutStrategy : UnalignedLayoutStrategy;
|
let strategyClass = numRows > 2 ? GridLayoutStrategy : UnalignedLayoutStrategy;
|
||||||
let strategy = new strategyClass(this._monitor, rowSpacing, columnSpacing, bottomPadding);
|
let strategy = new strategyClass(this._monitor, rowSpacing, columnSpacing);
|
||||||
|
|
||||||
let layout = { area: area, strategy: strategy, numRows: numRows, numColumns: numColumns };
|
let layout = { area: area, strategy: strategy, numRows: numRows, numColumns: numColumns };
|
||||||
strategy.computeLayout(windows, layout);
|
strategy.computeLayout(windows, layout);
|
||||||
@ -1672,6 +1673,12 @@ const Workspace = new Lang.Class({
|
|||||||
// Window grid spacing
|
// Window grid spacing
|
||||||
let columnSpacing = node.get_length('-horizontal-spacing');
|
let columnSpacing = node.get_length('-horizontal-spacing');
|
||||||
let rowSpacing = node.get_length('-vertical-spacing');
|
let rowSpacing = node.get_length('-vertical-spacing');
|
||||||
|
let padding = {
|
||||||
|
left: node.get_padding(St.Side.LEFT),
|
||||||
|
top: node.get_padding(St.Side.TOP),
|
||||||
|
bottom: node.get_padding(St.Side.BOTTOM),
|
||||||
|
right: node.get_padding(St.Side.RIGHT),
|
||||||
|
};
|
||||||
|
|
||||||
if (!totalWindows)
|
if (!totalWindows)
|
||||||
return [];
|
return [];
|
||||||
@ -1686,19 +1693,25 @@ const Workspace = new Lang.Class({
|
|||||||
[leftBorder, rightBorder] = overlay.chromeWidths();
|
[leftBorder, rightBorder] = overlay.chromeWidths();
|
||||||
} else {
|
} else {
|
||||||
[closeButtonHeight, captionHeight] = [0, 0];
|
[closeButtonHeight, captionHeight] = [0, 0];
|
||||||
|
[leftBorder, rightBorder] = [0, 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
rowSpacing += captionHeight;
|
rowSpacing += captionHeight;
|
||||||
columnSpacing += rightBorder;
|
columnSpacing += (rightBorder + leftBorder) / 2;
|
||||||
|
padding.top += closeButtonHeight;
|
||||||
|
padding.bottom += captionHeight;
|
||||||
|
padding.left += leftBorder;
|
||||||
|
padding.right += rightBorder;
|
||||||
|
|
||||||
let area = { x: this._x, y: this._y, width: this._width, height: this._height };
|
let area = {
|
||||||
area.y += closeButtonHeight;
|
x: this._x + padding.left,
|
||||||
area.height -= closeButtonHeight;
|
y: this._y + padding.top,
|
||||||
area.x += leftBorder;
|
width: this._width - padding.left - padding.right,
|
||||||
area.width -= leftBorder;
|
height: this._height - padding.top - padding.bottom,
|
||||||
|
};
|
||||||
|
|
||||||
if (!this._currentLayout)
|
if (!this._currentLayout)
|
||||||
this._currentLayout = this._computeLayout(windows, area, rowSpacing, columnSpacing, captionHeight);
|
this._currentLayout = this._computeLayout(windows, area, rowSpacing, columnSpacing);
|
||||||
|
|
||||||
let layout = this._currentLayout;
|
let layout = this._currentLayout;
|
||||||
let strategy = layout.strategy;
|
let strategy = layout.strategy;
|
||||||
|
Loading…
Reference in New Issue
Block a user