[gnome-software] Avoid rounding errors in GsBox allocation



commit 6d6341e29a4b0908ce28892e58424f369e1fffa5
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 18 16:40:15 2013 -0400

    Avoid rounding errors in GsBox allocation
    
    Give all remaining space to the last child. This avoid
    fittsiness issues in the category view.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=708307

 src/gs-box.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-box.c b/src/gs-box.c
index 58c118b..878aaef 100644
--- a/src/gs-box.c
+++ b/src/gs-box.c
@@ -110,7 +110,10 @@ gs_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
                child = l->data;
                child_allocation.x = x;
                child_allocation.y = allocation->y;
-               child_allocation.width = allocation->width * (child->relative_size / box->total);
+               if (l->next == NULL)
+                       child_allocation.width = allocation->x + allocation->width - child_allocation.x;
+               else
+                       child_allocation.width = allocation->width * (child->relative_size / box->total);
                child_allocation.height = allocation->height;
                if (rtl) {
                        child_allocation.x = allocation->x + allocation->width - child_allocation.x - 
child_allocation.width;



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