[gnome-shell] boxPointer: use shell_util_get_transformed_allocation()



commit bc48bd5f4a62ba7f2a655264ee6200f0f23e45c4
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Mar 26 16:36:27 2011 -0400

    boxPointer: use shell_util_get_transformed_allocation()
    
    Using ClutterActor.get_transformed_size() can produce bugs if we
    happen to position the box pointer when the source actor has a
    relayout queued. Use our newly added reliable utility function
    instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645744

 js/ui/boxpointer.js |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/boxpointer.js b/js/ui/boxpointer.js
index 619e0c5..5df1f25 100644
--- a/js/ui/boxpointer.js
+++ b/js/ui/boxpointer.js
@@ -330,10 +330,9 @@ BoxPointer.prototype = {
         // Position correctly relative to the sourceActor
         let sourceNode = sourceActor.get_theme_node();
         let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
-        let [sourceX, sourceY] = sourceActor.get_transformed_position();
-        let [sourceWidth, sourceHeight] = sourceActor.get_transformed_size();
-        let sourceCenterX = sourceX + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2;
-        let sourceCenterY = sourceY + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2;
+        let sourceAllocation = Shell.util_get_transformed_allocation(sourceActor);
+        let sourceCenterX = sourceAllocation.x1 + sourceContentBox.x1 + (sourceContentBox.x2 - sourceContentBox.x1) / 2;
+        let sourceCenterY = sourceAllocation.y1 + sourceContentBox.y1 + (sourceContentBox.y2 - sourceContentBox.y1) / 2;
         let [minWidth, minHeight, natWidth, natHeight] = this.actor.get_preferred_size();
 
         // We also want to keep it onscreen, and separated from the
@@ -351,16 +350,16 @@ BoxPointer.prototype = {
 
         switch (this._arrowSide) {
         case St.Side.TOP:
-            resY = sourceY + sourceHeight + gap;
+            resY = sourceAllocation.y2 + gap;
             break;
         case St.Side.BOTTOM:
-            resY = sourceY - natHeight - gap;
+            resY = sourceAllocation.y1 - natHeight - gap;
             break;
         case St.Side.LEFT:
-            resX = sourceX + sourceWidth + gap;
+            resX = sourceAllocation.x2 + gap;
             break;
         case St.Side.RIGHT:
-            resX = sourceX - natWidth - gap;
+            resX = sourceAllocation.x1 - natWidth - gap;
             break;
         }
 



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