diff options
author | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-04-05 18:01:56 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-04-05 18:01:56 -0400 |
commit | 24ed2f8aa11c674f1a507200945a9b4f20ce3069 (patch) | |
tree | 08d7be40eb7be79df07227a19b840d243eb0d3f0 /gtk/gtkbox.c | |
parent | eb537a6773e9436e4aae6cd8274f9132aa2c2ff2 (diff) | |
download | gtk+-24ed2f8aa11c674f1a507200945a9b4f20ce3069.tar.gz |
Fixed 2 bugs in gtk_box_size_allocate()
This commit fixes the loop to take into consideration the
child->padding that will be allocated to the child while calculating
full available size. Additionally it fixes the initial positioning
of child widgets when packed at the end (a special case because the
x position used starts from the end of the box).
Diffstat (limited to 'gtk/gtkbox.c')
-rw-r--r-- | gtk/gtkbox.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 61f237bc44..d3fc2ed7d9 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -470,7 +470,6 @@ gtk_box_size_allocate (GtkWidget *widget, else { /* Retrieve desired size for visible children */ - i = 0; children = box->children; while (children) @@ -492,6 +491,7 @@ gtk_box_size_allocate (GtkWidget *widget, &sizes[i].natural_size); size -= sizes[i].minimum_size; + size -= child->padding * 2; spreading[i].index = i; spreading[i].child = child; @@ -627,14 +627,20 @@ gtk_box_size_allocate (GtkWidget *widget, child_allocation.width = sizes[i].minimum_size; child_allocation.x = x + (child_size - child_allocation.width) / 2; } - + if (direction == GTK_TEXT_DIR_RTL) child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - child_allocation.width; if (packing == GTK_PACK_START) - x += child_size + box->spacing; + { + x += child_size + box->spacing; + } else - x -= child_size + box->spacing; + { + x -= child_size + box->spacing; + + child_allocation.x -= child_allocation.width; + } } else { @@ -650,9 +656,15 @@ gtk_box_size_allocate (GtkWidget *widget, } if (packing == GTK_PACK_START) - y += child_size + box->spacing; + { + y += child_size + box->spacing; + } else - y -= child_size + box->spacing; + { + y -= child_size + box->spacing; + + child_allocation.y -= child_allocation.height; + } } gtk_widget_size_allocate (child->widget, &child_allocation); |