From 522ecba1805c3480e89e5c4c8a2901a282c2d6af Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Sun, 14 Jun 2020 06:23:33 +0200 Subject: [PATCH] workspace: Center overlay close button on border using guide actor This makes use of the invisible actor introduced in the previous commit to center the close button on the border. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2899 https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1313 --- js/ui/workspace.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 54cbb5e9f..16b2c1b87 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -337,17 +337,17 @@ var WindowClone = GObject.registerClass({ child: new St.Icon({ icon_name: 'window-close-symbolic' }), }); this._closeButton.add_constraint(new Clutter.BindConstraint({ - source: this._border, + source: this._borderCenter, coordinate: Clutter.BindCoordinate.POSITION, })); this._closeButton.add_constraint(new Clutter.AlignConstraint({ - source: this._border, + source: this._borderCenter, align_axis: Clutter.AlignAxis.X_AXIS, pivot_point: new Graphene.Point({ x: 0.5, y: -1 }), factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1, })); this._closeButton.add_constraint(new Clutter.AlignConstraint({ - source: this._border, + source: this._borderCenter, align_axis: Clutter.AlignAxis.Y_AXIS, pivot_point: new Graphene.Point({ x: -1, y: 0.5 }), factor: 0, @@ -417,7 +417,7 @@ var WindowClone = GObject.registerClass({ const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1); const [, titleHeight] = this._title.get_preferred_height(-1); - const topOversize = this._borderSize + closeButtonHeight / 2; + const topOversize = (this._borderSize / 2) + (closeButtonHeight / 2); const bottomOversize = Math.max( this._borderSize, (titleHeight / 2) + (this._borderSize / 2)); @@ -430,11 +430,11 @@ var WindowClone = GObject.registerClass({ const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1); const leftOversize = this._closeButtonSide === St.Side.LEFT - ? this._borderSize + closeButtonWidth / 2 + ? (this._borderSize / 2) + (closeButtonWidth / 2) : this._borderSize; const rightOversize = this._closeButtonSide === St.Side.LEFT ? this._borderSize - : this._borderSize + closeButtonWidth / 2; + : (this._borderSize / 2) + (closeButtonWidth / 2); return [leftOversize, rightOversize]; }