workspace: Implement windowCenter using bounding box

This isn't quite the same as the allocation, but it's what the workspace
actually wants to use given that we use the bounding box of the
WindowClone for all the layout calculation.

So instead of calculating the windowCenter in the WindowClone, make use
of the bounding-box property of the layout manager and return the center
point of that.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1297
This commit is contained in:
Jonas Dreßler 2020-05-31 22:48:28 +02:00 committed by Georges Basile Stavracas Neto
parent 1ea22a5281
commit a2545d186a

View File

@ -222,8 +222,6 @@ var WindowClone = GObject.registerClass({
this.x = this.boundingBox.x;
this.y = this.boundingBox.y;
this._computeWindowCenter();
let clickAction = new Clutter.ClickAction();
clickAction.connect('clicked', this._onClicked.bind(this));
clickAction.connect('long-press', this._onLongPress.bind(this));
@ -328,12 +326,9 @@ var WindowClone = GObject.registerClass({
}
get windowCenter() {
return this._windowCenter;
}
const box = this.layout_manager.bounding_box;
_computeWindowCenter() {
let box = this.realWindow.get_allocation_box();
this._windowCenter = new Graphene.Point({
return new Graphene.Point({
x: box.get_x() + box.get_width() / 2,
y: box.get_y() + box.get_height() / 2,
});