Wrap id-pool access

The ClutterIdPool is held by the ClutterMainContext; we should hide its
direct usage into sensible private API.
This commit is contained in:
Emmanuele Bassi 2011-02-18 15:46:13 +00:00
parent 2593bbaadc
commit 689aac56c9
3 changed files with 22 additions and 3 deletions

View File

@ -3316,7 +3316,7 @@ clutter_actor_dispose (GObject *object)
ClutterActorPrivate *priv = self->priv;
CLUTTER_NOTE (MISC, "Disposing of object (id=%d) of type '%s' (ref_count:%d)",
self->priv->id,
priv->id,
g_type_name (G_OBJECT_TYPE (self)),
object->ref_count);
@ -3386,8 +3386,9 @@ clutter_actor_finalize (GObject *object)
priv->id,
g_type_name (G_OBJECT_TYPE (object)));
_clutter_context_release_id (priv->id);
g_free (priv->name);
clutter_id_pool_remove (CLUTTER_CONTEXT()->id_pool, priv->id);
G_OBJECT_CLASS (clutter_actor_parent_class)->finalize (object);
}
@ -4887,7 +4888,7 @@ clutter_actor_init (ClutterActor *self)
priv->parent_actor = NULL;
priv->has_clip = FALSE;
priv->opacity = 0xff;
priv->id = clutter_id_pool_add (CLUTTER_CONTEXT()->id_pool, self);
priv->id = _clutter_context_acquire_id (self);
priv->scale_x = 1.0;
priv->scale_y = 1.0;
priv->show_on_set_parent = TRUE;

View File

@ -3245,6 +3245,22 @@ _clutter_clear_events_queue (void)
}
}
guint32
_clutter_context_acquire_id (gpointer key)
{
ClutterMainContext *context = _clutter_context_get_default ();
return clutter_id_pool_add (context->id_pool, key);
}
void
_clutter_context_release_id (guint32 id_)
{
ClutterMainContext *context = _clutter_context_get_default ();
return clutter_id_pool_remove (context->id_pool, id_);
}
void
_clutter_clear_events_queue_for_stage (ClutterStage *stage)
{

View File

@ -179,6 +179,8 @@ ClutterPickMode _clutter_context_get_pick_mode (void);
void _clutter_context_push_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_pop_shader_stack (ClutterActor *actor);
ClutterActor * _clutter_context_peek_shader_stack (void);
guint32 _clutter_context_acquire_id (gpointer key);
void _clutter_context_release_id (guint32 id_);
#define CLUTTER_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
#define CLUTTER_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)