[gtk+/native-layout] Fixed 2 bugs in gtk_box_size_allocate()
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/native-layout] Fixed 2 bugs in gtk_box_size_allocate()
- Date: Mon, 5 Apr 2010 22:16:42 +0000 (UTC)
commit 24ed2f8aa11c674f1a507200945a9b4f20ce3069
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Mon Apr 5 18:01:56 2010 -0400
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).
gtk/gtkbox.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 61f237b..d3fc2ed 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]