[gnome-shell] workspace: Implement windowCenter using bounding box



commit a2545d186aa1742db058a4f3982b57e59669e7d1
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sun May 31 22:48:28 2020 +0200

    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

 js/ui/workspace.js | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index 03b4edb3dc..d58114dfce 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -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,
         });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]