[Swfdec-commits] swfdec/swfdec_actor.c swfdec/swfdec_movie.c

Benjamin Otte company at kemper.freedesktop.org
Thu Jul 24 09:29:44 PDT 2008


 swfdec/swfdec_actor.c |   21 +++++++++++++++++++++
 swfdec/swfdec_movie.c |   27 ++++++++++++++++++---------
 2 files changed, 39 insertions(+), 9 deletions(-)

New commits:
commit 45bc6cda3c59834c106b3ea07e96c1e032ad28e4
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jul 24 18:27:57 2008 +0200

    move actor enqueueing to the actor constructor

diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index bf1bd6a..1832f64 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -137,11 +137,32 @@ swfdec_actor_key_release (SwfdecActor *actor, guint keycode, guint character)
   swfdec_actor_queue_script (actor, SWFDEC_EVENT_KEY_UP);
 }
 
+static GObject *
+swfdec_actor_constructor (GType type, guint n_construct_properties,
+    GObjectConstructParam *construct_properties)
+{
+  SwfdecPlayerPrivate *priv;
+  GObject *object;
+
+  object = G_OBJECT_CLASS (swfdec_actor_parent_class)->constructor (type, 
+      n_construct_properties, construct_properties);
+
+  priv = SWFDEC_PLAYER (swfdec_gc_object_get_context (object))->priv;
+  /* NB: adding to the movies list happens before swfdec_movie_initialize().
+   * swfdec_movie_initialize() does a gotoAndPlay(0) for Sprites which can
+   * cause new movies to be created (and added to this list).
+   */
+  priv->actors = g_list_prepend (priv->actors, object);
+
+  return object;
+}
+
 static void
 swfdec_actor_class_init (SwfdecActorClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  object_class->constructor = swfdec_actor_constructor;
   object_class->dispose = swfdec_actor_dispose;
 
   klass->iterate_end = swfdec_actor_iterate_end;
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 8b89c8d..dbab3b8 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1338,6 +1338,23 @@ swfdec_movie_do_invalidate (SwfdecMovie *movie, const cairo_matrix_t *matrix, gb
   }
 }
 
+static GObject *
+swfdec_movie_constructor (GType type, guint n_construct_properties,
+    GObjectConstructParam *construct_properties)
+{
+  GObject *object;
+  SwfdecPlayerPrivate *priv;
+
+  object = G_OBJECT_CLASS (swfdec_movie_parent_class)->constructor (type, 
+      n_construct_properties, construct_properties);
+
+  priv = SWFDEC_PLAYER (swfdec_gc_object_get_context (object))->priv;
+  /* the movie is created invalid */
+  priv->invalid_pending = g_slist_prepend (priv->invalid_pending, object);
+
+  return object;
+}
+
 static void
 swfdec_movie_class_init (SwfdecMovieClass * movie_class)
 {
@@ -1345,6 +1362,7 @@ swfdec_movie_class_init (SwfdecMovieClass * movie_class)
   SwfdecGcObjectClass *gc_class = SWFDEC_GC_OBJECT_CLASS (movie_class);
   SwfdecAsObjectClass *asobject_class = SWFDEC_AS_OBJECT_CLASS (movie_class);
 
+  object_class->constructor = swfdec_movie_constructor;
   object_class->dispose = swfdec_movie_dispose;
   object_class->get_property = swfdec_movie_get_property;
   object_class->set_property = swfdec_movie_set_property;
@@ -1457,15 +1475,6 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
   movie = g_object_new (type, "context", player, "depth", depth, 
       "parent", parent, "name", name, "resource", resource,
       "graphic", graphic, NULL);
-  /* add the movie to the global movies list */
-  /* NB: adding to the movies list happens before swfdec_movie_initialize().
-   * swfdec_movie_initialize() does a gotoAndPlay(0) for Sprites which can
-   * cause new movies to be created (and added to this list).
-   */
-  if (SWFDEC_IS_ACTOR (movie))
-    player->priv->actors = g_list_prepend (player->priv->actors, movie);
-  /* the movie is invalid already */
-  player->priv->invalid_pending = g_slist_prepend (player->priv->invalid_pending, movie);
 
   return movie;
 }


More information about the Swfdec-commits mailing list