[gnome-shell] [panel] Fix allocation positioning for boxes



commit 3715109ebe26ed1c7b037aef611cf157773ef7a7
Author: Colin Walters <walters verbum org>
Date:   Tue Apr 27 09:46:19 2010 -0400

    [panel] Fix allocation positioning for boxes
    
    This change doesn't actually affect anything visibly, but
    using the absolute coordinates of our allocation box in allocate()
    is wrong; we should be positioning our children at 0,0 and using
    width/height as a reference.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616951

 js/ui/panel.js |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 31007fb..5485d30 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -310,34 +310,34 @@ Panel.prototype = {
 
             let x;
             let childBox = new Clutter.ActorBox();
-            childBox.x1 = box.x1;
-            childBox.y1 = box.y1;
+            childBox.x1 = 0;
+            childBox.y1 = 0;
             childBox.x2 = x = childBox.x1 + leftWidth;
-            childBox.y2 = box.y2;
+            childBox.y2 = allocHeight;
             this._leftBox.allocate(childBox, flags);
 
-            let centerNaturalX = Math.floor((box.x2 - box.x1) / 2 - (centerWidth / 2));
+            let centerNaturalX = Math.floor(allocWidth / 2 - (centerWidth / 2));
             /* Check left side */
             if (x < centerNaturalX) {
                 /* We didn't overflow the left, use the natural. */
                 x = centerNaturalX;
             }
             /* Check right side */
-            if (x + centerWidth > (box.x2 - rightWidth)) {
-                x = box.x2 - rightWidth - centerWidth;
+            if (x + centerWidth > (allocWidth - rightWidth)) {
+                x = allocWidth - rightWidth - centerWidth;
             }
             childBox = new Clutter.ActorBox();
             childBox.x1 = x;
-            childBox.y1 = box.y1;
+            childBox.y1 = 0;
             childBox.x2 = x = childBox.x1 + centerWidth;
-            childBox.y2 = box.y2;
+            childBox.y2 = allocHeight;
             this._centerBox.allocate(childBox, flags);
 
             childBox = new Clutter.ActorBox();
-            childBox.x1 = box.x2 - rightWidth;
-            childBox.y1 = box.y1;
-            childBox.x2 = box.x2;
-            childBox.y2 = box.y2;
+            childBox.x1 = allocWidth - rightWidth;
+            childBox.y1 = 0;
+            childBox.x2 = allocWidth;
+            childBox.y2 = allocHeight;
             this._rightBox.allocate(childBox, flags);
         }));
 



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