workspace: Use boundingBox instead of getOriginalPosition()

The getOriginalPosition() API of WindowClone can easily be replaced by
using the existing boundingBox property, which reflects the windows
bounding box in absolute coordinates. This property is also used
everywhere else in the Workspace object, so we can use it here, too.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1294
This commit is contained in:
Jonas Dreßler 2020-05-31 23:19:59 +02:00 committed by Georges Basile Stavracas Neto
parent 85d2837466
commit 2d650e51a5

View File

@ -274,10 +274,6 @@ var WindowClone = GObject.registerClass({
return this._boundingBox.height; return this._boundingBox.height;
} }
getOriginalPosition() {
return [this._boundingBox.x, this._boundingBox.y];
}
_computeBoundingBox() { _computeBoundingBox() {
let rect = this.metaWindow.get_frame_rect(); let rect = this.metaWindow.get_frame_rect();
@ -1726,11 +1722,10 @@ class Workspace extends St.Widget {
overlay.hide(); overlay.hide();
if (clone.metaWindow.showing_on_its_workspace()) { if (clone.metaWindow.showing_on_its_workspace()) {
let [origX, origY] = clone.getOriginalPosition();
clone.scale_x = 1; clone.scale_x = 1;
clone.scale_y = 1; clone.scale_y = 1;
clone.x = origX; clone.x = clone.boundingBox.x;
clone.y = origY; clone.y = clone.boundingBox.y;
clone.ease({ clone.ease({
opacity, opacity,
duration, duration,
@ -1778,10 +1773,9 @@ class Workspace extends St.Widget {
overlay.hide(); overlay.hide();
if (clone.metaWindow.showing_on_its_workspace()) { if (clone.metaWindow.showing_on_its_workspace()) {
let [origX, origY] = clone.getOriginalPosition();
clone.ease({ clone.ease({
x: origX, x: clone.boundingBox.x,
y: origY, y: clone.boundingBox.y,
scale_x: 1, scale_x: 1,
scale_y: 1, scale_y: 1,
opacity: 255, opacity: 255,