Fix allocation implementations for ShellStack and ShellDrawingArea
In both, using our allocation directly for the child is wrong; we should create a new allocation that's our width and height. In ShellDrawingArea, also need to chain up to parent.
This commit is contained in:
parent
ed7881d6c9
commit
3cb54f6707
@ -40,8 +40,18 @@ shell_drawing_area_allocate (ClutterActor *self,
|
||||
ShellDrawingArea *area = SHELL_DRAWING_AREA (self);
|
||||
int width = box->x2 - box->x1;
|
||||
int height = box->y2 - box->y1;
|
||||
ClutterActorBox child_box;
|
||||
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (area->priv->texture), box, flags);
|
||||
/* Chain up directly to ClutterActor to set actor->allocation. We explicitly skip our parent class
|
||||
* ClutterGroup here because we want to override the allocate function. */
|
||||
(CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->allocate (self, box, flags);
|
||||
|
||||
child_box.x1 = 0;
|
||||
child_box.x2 = width;
|
||||
child_box.y1 = 0;
|
||||
child_box.y2 = height;
|
||||
|
||||
clutter_actor_allocate (CLUTTER_ACTOR (area->priv->texture), &child_box, flags);
|
||||
if (width > 0 && height > 0)
|
||||
{
|
||||
clutter_cairo_texture_set_surface_size (area->priv->texture,
|
||||
|
@ -24,15 +24,25 @@ shell_stack_allocate (ClutterActor *self,
|
||||
ClutterAllocationFlags flags)
|
||||
{
|
||||
GList *children, *iter;
|
||||
float width, height;
|
||||
|
||||
/* chain up to set actor->allocation */
|
||||
width = box->x2 - box->x1;
|
||||
height = box->y2 - box->y1;
|
||||
|
||||
/* Chain up directly to ClutterActor to set actor->allocation. We explicitly skip our parent class
|
||||
* ClutterGroup here because we want to override the allocate function. */
|
||||
(CLUTTER_ACTOR_CLASS (g_type_class_peek (clutter_actor_get_type ())))->allocate (self, box, flags);
|
||||
|
||||
children = clutter_container_get_children (CLUTTER_CONTAINER (self));
|
||||
for (iter = children; iter; iter = iter->next)
|
||||
{
|
||||
ClutterActor *actor = CLUTTER_ACTOR (iter->data);
|
||||
clutter_actor_allocate (actor, box, flags);
|
||||
ClutterActorBox child_box;
|
||||
child_box.x1 = 0;
|
||||
child_box.x2 = width;
|
||||
child_box.y1 = 0;
|
||||
child_box.y2 = height;
|
||||
clutter_actor_allocate (actor, &child_box, flags);
|
||||
}
|
||||
g_list_free (children);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user