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:
@ -556,6 +556,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
{
|
||||
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
||||
GList *l, *children = clutter_container_get_children (container);
|
||||
gfloat x_off, y_off;
|
||||
gfloat avail_width, avail_height;
|
||||
gfloat item_x, item_y;
|
||||
gint line_item_count;
|
||||
@ -565,6 +566,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
if (children == NULL)
|
||||
return;
|
||||
|
||||
clutter_actor_box_get_origin (allocation, &x_off, &y_off);
|
||||
clutter_actor_box_get_size (allocation, &avail_width, &avail_height);
|
||||
|
||||
/* blow the cached preferred size and re-compute with the given
|
||||
@ -585,7 +587,8 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
items_per_line = compute_lines (CLUTTER_FLOW_LAYOUT (manager),
|
||||
avail_width, avail_height);
|
||||
|
||||
item_x = item_y = 0;
|
||||
item_x = x_off;
|
||||
item_y = y_off;
|
||||
|
||||
line_item_count = 0;
|
||||
line_index = 0;
|
||||
@ -616,7 +619,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
line_item_count = 0;
|
||||
line_index += 1;
|
||||
|
||||
item_x = 0;
|
||||
item_x = x_off;
|
||||
}
|
||||
|
||||
new_x = ((line_item_count + 1) * (avail_width + priv->col_spacing))
|
||||
@ -655,7 +658,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||
line_item_count = 0;
|
||||
line_index += 1;
|
||||
|
||||
item_y = 0;
|
||||
item_y = y_off;
|
||||
}
|
||||
|
||||
new_y = ((line_item_count + 1) * (avail_height + priv->row_spacing))
|
||||
|
Reference in New Issue
Block a user