diff --git a/clutter/clutter/clutter-autocleanups.h b/clutter/clutter/clutter-autocleanups.h index 2441ae53e..b3020cda1 100644 --- a/clutter/clutter/clutter-autocleanups.h +++ b/clutter/clutter/clutter-autocleanups.h @@ -29,7 +29,6 @@ #ifndef __GI_SCANNER__ -G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterScrollActor, g_object_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterText, g_object_unref) diff --git a/clutter/clutter/clutter-clone.c b/clutter/clutter/clutter-clone.c index 2c708a38a..72534e53f 100644 --- a/clutter/clutter/clutter-clone.c +++ b/clutter/clutter/clutter-clone.c @@ -46,13 +46,13 @@ #include "cogl/cogl.h" -struct _ClutterClonePrivate +typedef struct _ClutterClonePrivate { ClutterActor *clone_source; float x_scale, y_scale; gulong source_destroy_id; -}; +} ClutterClonePrivate; G_DEFINE_TYPE_WITH_PRIVATE (ClutterClone, clutter_clone, CLUTTER_TYPE_ACTOR) @@ -75,7 +75,8 @@ clutter_clone_get_preferred_width (ClutterActor *self, gfloat *min_width_p, gfloat *natural_width_p) { - ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (self)); ClutterActor *clone_source = priv->clone_source; if (clone_source == NULL) @@ -99,7 +100,8 @@ clutter_clone_get_preferred_height (ClutterActor *self, gfloat *min_height_p, gfloat *natural_height_p) { - ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (self)); ClutterActor *clone_source = priv->clone_source; if (clone_source == NULL) @@ -121,8 +123,8 @@ static void clutter_clone_apply_transform (ClutterActor *self, graphene_matrix_t *matrix) { - ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; - + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (self)); if (priv->clone_source) graphene_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f); @@ -136,7 +138,7 @@ clutter_clone_paint (ClutterActor *actor, ClutterPaintContext *paint_context) { ClutterClone *self = CLUTTER_CLONE (actor); - ClutterClonePrivate *priv = self->priv; + ClutterClonePrivate *priv = clutter_clone_get_instance_private (self); gboolean was_unmapped = FALSE; if (priv->clone_source == NULL) @@ -155,7 +157,7 @@ clutter_clone_paint (ClutterActor *actor, */ _clutter_actor_set_in_clone_paint (priv->clone_source, TRUE); clutter_actor_set_opacity_override (priv->clone_source, - clutter_actor_get_paint_opacity (actor)); + clutter_actor_get_paint_opacity (actor)); _clutter_actor_set_enable_model_view_transform (priv->clone_source, FALSE); if (!clutter_actor_is_mapped (priv->clone_source)) @@ -186,7 +188,8 @@ static gboolean clutter_clone_get_paint_volume (ClutterActor *actor, ClutterPaintVolume *volume) { - ClutterClonePrivate *priv = CLUTTER_CLONE (actor)->priv; + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (actor)); const ClutterPaintVolume *source_volume; /* if the source is not set the paint volume is defined to be empty */ @@ -208,7 +211,8 @@ clutter_clone_get_paint_volume (ClutterActor *actor, static gboolean clutter_clone_has_overlaps (ClutterActor *actor) { - ClutterClonePrivate *priv = CLUTTER_CLONE (actor)->priv; + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (actor)); /* The clone has overlaps iff the source has overlaps */ @@ -222,7 +226,8 @@ static void clutter_clone_allocate (ClutterActor *self, const ClutterActorBox *box) { - ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (self)); ClutterActorClass *parent_class; ClutterActorBox source_box; float x_scale, y_scale; @@ -308,7 +313,8 @@ clutter_clone_get_property (GObject *gobject, GValue *value, GParamSpec *pspec) { - ClutterClonePrivate *priv = CLUTTER_CLONE (gobject)->priv; + ClutterClonePrivate *priv = + clutter_clone_get_instance_private (CLUTTER_CLONE (gobject)); switch (prop_id) { @@ -366,10 +372,10 @@ clutter_clone_class_init (ClutterCloneClass *klass) static void clutter_clone_init (ClutterClone *self) { - self->priv = clutter_clone_get_instance_private (self); + ClutterClonePrivate *priv = clutter_clone_get_instance_private (self); - self->priv->x_scale = 1.f; - self->priv->y_scale = 1.f; + priv->x_scale = 1.f; + priv->y_scale = 1.f; } /** @@ -397,7 +403,7 @@ static void clutter_clone_set_source_internal (ClutterClone *self, ClutterActor *source) { - ClutterClonePrivate *priv = self->priv; + ClutterClonePrivate *priv = clutter_clone_get_instance_private (self); if (priv->clone_source == source) return; @@ -452,7 +458,10 @@ clutter_clone_set_source (ClutterClone *self, ClutterActor * clutter_clone_get_source (ClutterClone *self) { + ClutterClonePrivate *priv; + g_return_val_if_fail (CLUTTER_IS_CLONE (self), NULL); - return self->priv->clone_source; + priv = clutter_clone_get_instance_private (self); + return priv->clone_source; } diff --git a/clutter/clutter/clutter-clone.h b/clutter/clutter/clutter-clone.h index 04aafcc43..0dfbb6460 100644 --- a/clutter/clutter/clutter-clone.h +++ b/clutter/clutter/clutter-clone.h @@ -31,24 +31,7 @@ G_BEGIN_DECLS -#define CLUTTER_TYPE_CLONE (clutter_clone_get_type()) -#define CLUTTER_CLONE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLONE, ClutterClone)) -#define CLUTTER_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLONE, ClutterCloneClass)) -#define CLUTTER_IS_CLONE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLONE)) -#define CLUTTER_IS_CLONE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLONE)) -#define CLUTTER_CLONE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLONE, ClutterCloneClass)) - -typedef struct _ClutterClone ClutterClone; -typedef struct _ClutterCloneClass ClutterCloneClass; -typedef struct _ClutterClonePrivate ClutterClonePrivate; - -struct _ClutterClone -{ - /*< private >*/ - ClutterActor parent_instance; - - ClutterClonePrivate *priv; -}; +#define CLUTTER_TYPE_CLONE (clutter_clone_get_type ()) /** * ClutterCloneClass: @@ -62,7 +45,10 @@ struct _ClutterCloneClass }; CLUTTER_EXPORT -GType clutter_clone_get_type (void) G_GNUC_CONST; +G_DECLARE_DERIVABLE_TYPE (ClutterClone, + clutter_clone, + CLUTTER, CLONE, + ClutterActor) CLUTTER_EXPORT ClutterActor * clutter_clone_new (ClutterActor *source);