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
This commit is contained in:
parent
9b22f6183f
commit
522ecba180
@ -337,17 +337,17 @@ var WindowClone = GObject.registerClass({
|
|||||||
child: new St.Icon({ icon_name: 'window-close-symbolic' }),
|
child: new St.Icon({ icon_name: 'window-close-symbolic' }),
|
||||||
});
|
});
|
||||||
this._closeButton.add_constraint(new Clutter.BindConstraint({
|
this._closeButton.add_constraint(new Clutter.BindConstraint({
|
||||||
source: this._border,
|
source: this._borderCenter,
|
||||||
coordinate: Clutter.BindCoordinate.POSITION,
|
coordinate: Clutter.BindCoordinate.POSITION,
|
||||||
}));
|
}));
|
||||||
this._closeButton.add_constraint(new Clutter.AlignConstraint({
|
this._closeButton.add_constraint(new Clutter.AlignConstraint({
|
||||||
source: this._border,
|
source: this._borderCenter,
|
||||||
align_axis: Clutter.AlignAxis.X_AXIS,
|
align_axis: Clutter.AlignAxis.X_AXIS,
|
||||||
pivot_point: new Graphene.Point({ x: 0.5, y: -1 }),
|
pivot_point: new Graphene.Point({ x: 0.5, y: -1 }),
|
||||||
factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1,
|
factor: this._closeButtonSide === St.Side.LEFT ? 0 : 1,
|
||||||
}));
|
}));
|
||||||
this._closeButton.add_constraint(new Clutter.AlignConstraint({
|
this._closeButton.add_constraint(new Clutter.AlignConstraint({
|
||||||
source: this._border,
|
source: this._borderCenter,
|
||||||
align_axis: Clutter.AlignAxis.Y_AXIS,
|
align_axis: Clutter.AlignAxis.Y_AXIS,
|
||||||
pivot_point: new Graphene.Point({ x: -1, y: 0.5 }),
|
pivot_point: new Graphene.Point({ x: -1, y: 0.5 }),
|
||||||
factor: 0,
|
factor: 0,
|
||||||
@ -417,7 +417,7 @@ var WindowClone = GObject.registerClass({
|
|||||||
const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
|
const [, closeButtonHeight] = this._closeButton.get_preferred_height(-1);
|
||||||
const [, titleHeight] = this._title.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(
|
const bottomOversize = Math.max(
|
||||||
this._borderSize,
|
this._borderSize,
|
||||||
(titleHeight / 2) + (this._borderSize / 2));
|
(titleHeight / 2) + (this._borderSize / 2));
|
||||||
@ -430,11 +430,11 @@ var WindowClone = GObject.registerClass({
|
|||||||
const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
|
const [, closeButtonWidth] = this._closeButton.get_preferred_width(-1);
|
||||||
|
|
||||||
const leftOversize = this._closeButtonSide === St.Side.LEFT
|
const leftOversize = this._closeButtonSide === St.Side.LEFT
|
||||||
? this._borderSize + closeButtonWidth / 2
|
? (this._borderSize / 2) + (closeButtonWidth / 2)
|
||||||
: this._borderSize;
|
: this._borderSize;
|
||||||
const rightOversize = this._closeButtonSide === St.Side.LEFT
|
const rightOversize = this._closeButtonSide === St.Side.LEFT
|
||||||
? this._borderSize
|
? this._borderSize
|
||||||
: this._borderSize + closeButtonWidth / 2;
|
: (this._borderSize / 2) + (closeButtonWidth / 2);
|
||||||
|
|
||||||
return [leftOversize, rightOversize];
|
return [leftOversize, rightOversize];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user