surface-actor: Move work out of _new constructor

If we want to have any chance at creating subclasses of MetaSurfaceActor,
we can't do work in the constructor...
This commit is contained in:
Jasper St. Pierre 2013-12-06 14:19:32 -05:00
parent 309f78ff52
commit 1481836ed6

View File

@ -67,21 +67,8 @@ meta_surface_actor_init (MetaSurfaceActor *self)
META_TYPE_SURFACE_ACTOR, META_TYPE_SURFACE_ACTOR,
MetaSurfaceActorPrivate); MetaSurfaceActorPrivate);
priv->texture = NULL; priv->texture = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
} clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->texture));
MetaSurfaceActor *
meta_surface_actor_new (void)
{
MetaSurfaceActor *self = g_object_new (META_TYPE_SURFACE_ACTOR, NULL);
MetaShapedTexture *stex;
stex = META_SHAPED_TEXTURE (meta_shaped_texture_new ());
self->priv->texture = stex;
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (stex));
return self;
} }
cairo_surface_t * cairo_surface_t *
@ -183,3 +170,9 @@ meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
{ {
meta_shaped_texture_set_opaque_region (self->priv->texture, region); meta_shaped_texture_set_opaque_region (self->priv->texture, region);
} }
MetaSurfaceActor *
meta_surface_actor_new (void)
{
return g_object_new (META_TYPE_SURFACE_ACTOR, NULL);
}