My bad,

Calling the parent "allocate" method fixed the problem.  My allocate
function now looks like this:

static void
txvc_site_view_allocate(ClutterActor *self,
                        const ClutterActorBox *box,
                        ClutterAllocationFlags flags)
{
  TxvcSiteViewPrivate *priv = GET_PRIVATE(self);
  ClutterActorBox *child;
  ClutterLayoutManager *layout;

  g_debug("Allocating actor");

  CLUTTER_ACTOR_CLASS(txvc_site_view_parent_class)->allocate(self,
                                                             box, flags);

  /* allocate the whole area to our bin, and let it take
   * care of managing all children
   */
  child =
    clutter_actor_box_new(0.0f, 0.0f,
                          box->x2 - box->x1,
                          box->y2 - box->y1);

  clutter_actor_allocate(priv->bin,
                         child, flags);

  clutter_actor_box_free(child);
}


Thanks,
Uday

On Fri, Jan 14, 2011 at 4:42 PM, Uday Verma <[email protected]> wrote:

> Hi all,
>
> I have a custom actor which parents a single ClutterBox.  I am using
> ClutterBinLayout to set the layout of the box.  I was wondering what is the
> correct way of handling allocation.  This is what I am doing right now:
>
> static void
> txvc_site_view_allocate(ClutterActor *self,
>                         const ClutterActorBox *box,
>                         ClutterAllocationFlags flags)
> {
>   TxvcSiteViewPrivate *priv = GET_PRIVATE(self);
>   ClutterActorBox *child;
>   ClutterLayoutManager *layout;
>
>   g_debug("Allocating actor");
>
>   /* allocate the whole area to our bin, and let it take
>    * care of managing all children
>    */
>   child =
>     clutter_actor_box_new(0.0f, 0.0f,
>                           box->x2 - box->x1,
>                           box->y2 - box->y1);
>
>   clutter_actor_allocate(priv->bin,
>                          child, flags);
>
>   clutter_actor_box_free(child);
> }
>
> But for some reason the actor always shows at top left corner of my stage.
>  If I just pass the received "box" to priv->bin, it seems to be working
> fine.  But according to the documentation, box's coordinates are
> parent-relative, so I wonder what I am doing wrong.  My paint looks like
> this:
>
> static void
> txvc_site_view_paint(ClutterActor *self)
> {
>   TxvcSiteViewPrivate *priv = GET_PRIVATE(self);
>
>   if (!CLUTTER_ACTOR_IS_REALIZED(priv->bin))
>     clutter_actor_realize(priv->bin);
>
>   g_debug("Painting actor.");
>   clutter_actor_paint(priv->bin);
> }
>
>
> Thanks,
> Uday
>
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to