layout-managers: Take into account the allocations's origin

If an actor using a LayoutManager has attributes like margin or padding
then it'll have to shave them from the available allocation before
passing it to the LayoutManager::allocate() implementation. Layout
managers should, thus, not assume that the origin of the allocation is
in (0, 0), but take into account that the passed ActorBox might have a
different origin.

https://bugzilla.gnome.org/show_bug.cgi?id=649631
This commit is contained in:
Emmanuele Bassi
2011-08-24 18:38:17 +01:00
parent 3314385119
commit 368c916c7f
3 changed files with 16 additions and 10 deletions

View File

@ -1403,7 +1403,9 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
col_spacing = (priv->col_spacing);
row_spacing = (priv->row_spacing);
calculate_table_dimensions (self, container, box->x2 - box->x1, box->y2 - box->y1);
calculate_table_dimensions (self, container,
box->x2 - box->x1,
box->y2 - box->y1);
rows = (DimensionData *) priv->rows->data;
columns = (DimensionData *) priv->columns->data;
@ -1472,7 +1474,7 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
}
/* calculate child x */
child_x = 0.0f;
child_x = clutter_actor_box_get_x (box);
for (i = 0; i < col; i++)
{
if (columns[i].visible)
@ -1483,7 +1485,7 @@ clutter_table_layout_allocate (ClutterLayoutManager *layout,
}
/* calculate child y */
child_y = 0.0f;
child_y = clutter_actor_box_get_y (box);
for (i = 0; i < row; i++)
{
if (rows[i].visible)