workspace: Adjust for close button side in chromeWidth

When the close button is shown on the left side of the WindowClone, we
also need to return its width in chromeWidth() on the left side instead
of the right side, so do that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1298
This commit is contained in:
Jonas Dreßler 2020-06-08 17:52:57 +02:00
parent 33ab53068e
commit 96bfd1f8be

View File

@ -308,8 +308,9 @@ var WindowClone = GObject.registerClass({
});
const layout = Meta.prefs_get_button_layout();
const side = layout.left_buttons.includes(Meta.ButtonFunction.CLOSE)
? St.Side.LEFT : St.Side.RIGHT;
this._closeButtonSide =
layout.left_buttons.includes(Meta.ButtonFunction.CLOSE)
? St.Side.LEFT : St.Side.RIGHT;
this._closeButton = new St.Button({
visible: false,
@ -324,7 +325,7 @@ var WindowClone = GObject.registerClass({
source: this._border,
align_axis: Clutter.AlignAxis.X_AXIS,
pivot_point: new Graphene.Point({ x: 0.5, y: -1 }),
factor: side === St.Side.LEFT ? 0 : 1,
factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1,
}));
this._closeButton.add_constraint(new Clutter.AlignConstraint({
source: this._border,
@ -395,16 +396,26 @@ var WindowClone = GObject.registerClass({
const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
const [, titleHeight] = this._title.get_preferred_height(-1);
return [this._borderSize + closeButtonHeight / 2,
Math.max(this._borderSize, (titleHeight / 2) + (this._borderSize / 2))];
const topOversize = this._borderSize + closeButtonHeight / 2;
const bottomOversize = Math.max(
this._borderSize,
(titleHeight / 2) + (this._borderSize / 2));
return [topOversize, bottomOversize];
}
chromeWidths() {
this._border.ensure_style();
const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
return [this._borderSize,
this._borderSize + closeButtonWidth / 2];
const leftOversize = this._closeButtonSide === St.Side.LEFT
? this._borderSize + closeButtonWidth / 2
: this._borderSize;
const rightOversize = this._closeButtonSide === St.Side.LEFT
? this._borderSize
: this._borderSize + closeButtonWidth / 2;
return [leftOversize, rightOversize];
}
showOverlay(animate) {