[Swfdec-commits] 5 commits - swfdec/Makefile.am swfdec/swfdec_actor.c swfdec/swfdec_actor.h swfdec/swfdec_as_interpret.c swfdec/swfdec_button.c swfdec/swfdec_button_movie.c swfdec/swfdec_button_movie.h swfdec/swfdec_movie.c swfdec/swfdec_movie.h swfdec/swfdec_player.c swfdec/swfdec_player_internal.h swfdec/swfdec_resource.c swfdec/swfdec_selection.c swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_sprite_movie.h swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_field_movie.h swfdec/swfdec_types.h
Benjamin Otte
company at kemper.freedesktop.org
Mon Mar 31 09:50:44 PDT 2008
swfdec/Makefile.am | 6
swfdec/swfdec_actor.c | 318 ++++++++++++++++++++++++++++++++++
swfdec/swfdec_actor.h | 89 +++++++++
swfdec/swfdec_as_interpret.c | 8
swfdec/swfdec_button.c | 2
swfdec/swfdec_button_movie.c | 73 ++++---
swfdec/swfdec_button_movie.h | 6
swfdec/swfdec_movie.c | 358 +++++----------------------------------
swfdec/swfdec_movie.h | 34 ---
swfdec/swfdec_player.c | 191 ++++++++++----------
swfdec/swfdec_player_internal.h | 23 +-
swfdec/swfdec_resource.c | 2
swfdec/swfdec_selection.c | 20 +-
swfdec/swfdec_sprite_movie.c | 53 +++--
swfdec/swfdec_sprite_movie.h | 6
swfdec/swfdec_sprite_movie_as.c | 15 -
swfdec/swfdec_text_field_movie.c | 59 +++---
swfdec/swfdec_text_field_movie.h | 6
swfdec/swfdec_types.h | 1
19 files changed, 709 insertions(+), 561 deletions(-)
New commits:
commit 93c3f3e619bea1f0bdb37c987028186d981a14b5
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Mar 31 18:50:17 2008 +0200
the core does the mouse_move already before sending the button_release()
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index 4d9baa1..eb47cdc 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1510,9 +1510,6 @@ swfdec_text_field_movie_mouse_release (SwfdecActor *actor, guint button)
swfdec_movie_get_mouse (SWFDEC_MOVIE (text), &x, &y);
- //FIXME
- swfdec_text_field_movie_mouse_move (actor, x, y);
-
text->mouse_pressed = FALSE;
direct = swfdec_text_field_movie_xy_to_index (text, x, y, &index_, &before);
commit 6299c776123d6ad277b76dc56ce54dab027af192
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Mar 31 18:39:56 2008 +0200
move action handling to actors
diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index bc9d35f..c01ec99 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -22,11 +22,29 @@
#endif
#include "swfdec_actor.h"
+#include "swfdec_as_strings.h"
#include "swfdec_debug.h"
+#include "swfdec_button_movie.h"
+#include "swfdec_player_internal.h"
+#include "swfdec_resource.h"
+#include "swfdec_sprite_movie.h"
G_DEFINE_ABSTRACT_TYPE (SwfdecActor, swfdec_actor, SWFDEC_TYPE_MOVIE)
+static void
+swfdec_actor_dispose (GObject *object)
+{
+ SwfdecActor *actor = SWFDEC_ACTOR (object);
+
+ if (actor->events) {
+ swfdec_event_list_free (actor->events);
+ actor->events = NULL;
+ }
+
+ G_OBJECT_CLASS (swfdec_actor_parent_class)->dispose (object);
+}
+
static gboolean
swfdec_actor_iterate_end (SwfdecActor *actor)
{
@@ -36,10 +54,105 @@ swfdec_actor_iterate_end (SwfdecActor *actor)
movie->state < SWFDEC_MOVIE_STATE_REMOVED;
}
+static gboolean
+swfdec_actor_mouse_events (SwfdecActor *actor)
+{
+ SwfdecAsObject *object;
+
+ /* root movies don't get event */
+ if (SWFDEC_MOVIE (actor)->parent == NULL)
+ return FALSE;
+ /* look if we have a script that gets events */
+ if (actor->events && swfdec_event_list_has_mouse_events (actor->events))
+ return TRUE;
+ /* otherwise, require at least one of the custom script handlers */
+ object = SWFDEC_AS_OBJECT (actor);
+ if (swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRollOver) ||
+ swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRollOut) ||
+ swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onDragOver) ||
+ swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onDragOut) ||
+ swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onPress) ||
+ swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRelease) ||
+ swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onReleaseOutside))
+ return TRUE;
+ return FALSE;
+}
+
+static void
+swfdec_actor_mouse_in (SwfdecActor *actor)
+{
+ if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context)))
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_DRAG_OVER);
+ else
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_ROLL_OVER);
+}
+
+static void
+swfdec_actor_mouse_out (SwfdecActor *actor)
+{
+ if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context)))
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_DRAG_OUT);
+ else
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_ROLL_OUT);
+}
+
+static void
+swfdec_actor_mouse_press (SwfdecActor *actor, guint button)
+{
+ if (button != 0)
+ return;
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_PRESS);
+}
+
+static void
+swfdec_actor_mouse_release (SwfdecActor *actor, guint button)
+{
+ SwfdecPlayer *player;
+
+ if (button != 0)
+ return;
+
+ player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context);
+ if (player->priv->mouse_below == actor)
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_RELEASE);
+ else
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_RELEASE_OUTSIDE);
+}
+
+static void
+swfdec_actor_mouse_move (SwfdecActor *actor, double x, double y)
+{
+ /* nothing to do here, it's just there so we don't need to check for NULL */
+}
+
+static void
+swfdec_actor_key_press (SwfdecActor *actor, guint keycode, guint character)
+{
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_KEY_DOWN);
+}
+
+static void
+swfdec_actor_key_release (SwfdecActor *actor, guint keycode, guint character)
+{
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_KEY_UP);
+}
+
static void
swfdec_actor_class_init (SwfdecActorClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->dispose = swfdec_actor_dispose;
+
klass->iterate_end = swfdec_actor_iterate_end;
+ klass->mouse_events = swfdec_actor_mouse_events;
+ klass->mouse_in = swfdec_actor_mouse_in;
+ klass->mouse_out = swfdec_actor_mouse_out;
+ klass->mouse_press = swfdec_actor_mouse_press;
+ klass->mouse_release = swfdec_actor_mouse_release;
+ klass->mouse_move = swfdec_actor_mouse_move;
+ klass->key_press = swfdec_actor_key_press;
+ klass->key_release = swfdec_actor_key_release;
}
static void
@@ -47,3 +160,159 @@ swfdec_actor_init (SwfdecActor *actor)
{
}
+static void
+swfdec_sprite_movie_set_constructor (SwfdecSpriteMovie *movie)
+{
+ SwfdecMovie *mov = SWFDEC_MOVIE (movie);
+ SwfdecAsContext *context = SWFDEC_AS_OBJECT (movie)->context;
+ SwfdecAsObject *constructor = NULL;
+
+ g_assert (mov->resource != NULL);
+
+ if (movie->sprite) {
+ const char *name;
+
+ name = swfdec_resource_get_export_name (mov->resource,
+ SWFDEC_CHARACTER (movie->sprite));
+ if (name != NULL) {
+ name = swfdec_as_context_get_string (context, name);
+ constructor = swfdec_player_get_export_class (SWFDEC_PLAYER (context),
+ name);
+ }
+ }
+ if (constructor == NULL)
+ constructor = mov->resource->sandbox->MovieClip;
+
+ swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (movie), constructor);
+}
+
+void
+swfdec_actor_execute (SwfdecActor *actor, SwfdecEventType condition)
+{
+ SwfdecAsObject *thisp;
+ const char *name;
+ guint version;
+
+ g_return_if_fail (SWFDEC_IS_ACTOR (actor));
+
+ version = swfdec_movie_get_version (SWFDEC_MOVIE (actor));
+
+ if (SWFDEC_IS_BUTTON_MOVIE (actor)) {
+ /* these conditions don't exist for buttons */
+ if (condition == SWFDEC_EVENT_CONSTRUCT || condition < SWFDEC_EVENT_PRESS)
+ return;
+ thisp = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (actor)->parent);
+ if (version <= 5) {
+ while (!SWFDEC_IS_SPRITE_MOVIE (thisp))
+ thisp = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (thisp)->parent);
+ }
+ g_assert (thisp);
+ } else {
+ thisp = SWFDEC_AS_OBJECT (actor);
+ }
+
+ /* special cases */
+ if (condition == SWFDEC_EVENT_CONSTRUCT) {
+ if (version <= 5)
+ return;
+ swfdec_sprite_movie_set_constructor (SWFDEC_SPRITE_MOVIE (actor));
+ } else if (condition == SWFDEC_EVENT_ENTER) {
+ if (SWFDEC_MOVIE (actor)->state >= SWFDEC_MOVIE_STATE_REMOVED)
+ return;
+ }
+
+ swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
+ if (actor->events) {
+ swfdec_event_list_execute (actor->events, thisp, condition, 0);
+ }
+ /* FIXME: how do we compute the version correctly here? */
+ if (version > 5) {
+ name = swfdec_event_type_get_name (condition);
+ if (name != NULL) {
+ swfdec_as_object_call (SWFDEC_AS_OBJECT (actor), name, 0, NULL, NULL);
+ }
+ if (condition == SWFDEC_EVENT_CONSTRUCT)
+ swfdec_as_object_call (thisp, SWFDEC_AS_STR_constructor, 0, NULL, NULL);
+ }
+ swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
+}
+
+/**
+ * swfdec_actor_queue_script:
+ * @movie: a #SwfdecMovie
+ * @condition: the event that should happen
+ *
+ * Queues execution of all scripts associated with the given event.
+ **/
+void
+swfdec_actor_queue_script (SwfdecActor *actor, SwfdecEventType condition)
+{
+ SwfdecPlayer *player;
+ guint importance;
+
+ g_return_if_fail (SWFDEC_IS_ACTOR (actor));
+
+ if (!SWFDEC_IS_SPRITE_MOVIE (actor) && !SWFDEC_IS_BUTTON_MOVIE (actor))
+ return;
+ /* can happen for mouse/keyboard events on the initial movie */
+ if (SWFDEC_MOVIE (actor)->resource->sandbox == NULL) {
+ SWFDEC_INFO ("movie %s not yet initialized, skipping event", SWFDEC_MOVIE (actor)->name);
+ return;
+ }
+
+ switch (condition) {
+ case SWFDEC_EVENT_INITIALIZE:
+ importance = 0;
+ break;
+ case SWFDEC_EVENT_CONSTRUCT:
+ importance = 1;
+ break;
+ case SWFDEC_EVENT_LOAD:
+ case SWFDEC_EVENT_ENTER:
+ case SWFDEC_EVENT_UNLOAD:
+ case SWFDEC_EVENT_MOUSE_MOVE:
+ case SWFDEC_EVENT_MOUSE_DOWN:
+ case SWFDEC_EVENT_MOUSE_UP:
+ case SWFDEC_EVENT_KEY_UP:
+ case SWFDEC_EVENT_KEY_DOWN:
+ case SWFDEC_EVENT_DATA:
+ case SWFDEC_EVENT_PRESS:
+ case SWFDEC_EVENT_RELEASE:
+ case SWFDEC_EVENT_RELEASE_OUTSIDE:
+ case SWFDEC_EVENT_ROLL_OVER:
+ case SWFDEC_EVENT_ROLL_OUT:
+ case SWFDEC_EVENT_DRAG_OVER:
+ case SWFDEC_EVENT_DRAG_OUT:
+ case SWFDEC_EVENT_KEY_PRESS:
+ importance = 2;
+ break;
+ default:
+ g_return_if_reached ();
+ }
+
+ player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context);
+ swfdec_player_add_action (player, actor, condition, importance);
+}
+
+/**
+ * swfdec_actor_get_mouse_events:
+ * @movie: a #SwfdecActor
+ *
+ * Checks if this actor should respond to mouse events.
+ *
+ * Returns: %TRUE if this movie can receive mouse events
+ **/
+gboolean
+swfdec_actor_get_mouse_events (SwfdecActor *actor)
+{
+ SwfdecActorClass *klass;
+
+ g_return_val_if_fail (SWFDEC_IS_ACTOR (actor), FALSE);
+
+ klass = SWFDEC_ACTOR_GET_CLASS (actor);
+ if (klass->mouse_events)
+ return klass->mouse_events (actor);
+ else
+ return FALSE;
+}
+
diff --git a/swfdec/swfdec_actor.h b/swfdec/swfdec_actor.h
index ad081c0..79e19b3 100644
--- a/swfdec/swfdec_actor.h
+++ b/swfdec/swfdec_actor.h
@@ -38,6 +38,9 @@ typedef struct _SwfdecActorClass SwfdecActorClass;
struct _SwfdecActor
{
SwfdecMovie movie;
+
+ /* static properties (set by PlaceObject tags) */
+ SwfdecEventList * events; /* events queued on this movie */
};
struct _SwfdecActorClass
@@ -47,10 +50,40 @@ struct _SwfdecActorClass
/* iterating */
void (* iterate_start) (SwfdecActor * actor);
gboolean (* iterate_end) (SwfdecActor * actor);
+
+ /* mouse handling */
+ gboolean (* mouse_events) (SwfdecActor * movie);
+ SwfdecMouseCursor (* mouse_cursor) (SwfdecActor * movie);
+ void (* mouse_in) (SwfdecActor * movie);
+ void (* mouse_out) (SwfdecActor * movie);
+ void (* mouse_press) (SwfdecActor * movie,
+ guint button);
+ void (* mouse_release) (SwfdecActor * movie,
+ guint button);
+ void (* mouse_move) (SwfdecActor * movie,
+ double x,
+ double y);
+
+ /* keyboard handling */
+ void (* focus_in) (SwfdecActor * movie);
+ void (* focus_out) (SwfdecActor * movie);
+ void (* key_press) (SwfdecActor * movie,
+ guint keycode,
+ guint character);
+ void (* key_release) (SwfdecActor * movie,
+ guint keycode,
+ guint character);
};
GType swfdec_actor_get_type (void);
+void swfdec_actor_execute (SwfdecActor * actor,
+ SwfdecEventType condition);
+void swfdec_actor_queue_script (SwfdecActor * actor,
+ SwfdecEventType condition);
+
+gboolean swfdec_actor_get_mouse_events (SwfdecActor * actor);
+
G_END_DECLS
#endif
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index d8afa84..40cb7ca 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -1156,7 +1156,7 @@ swfdec_as_interpret_load_variables_on_finish (SwfdecAsObject *target,
// only call onData for sprite movies
// FIXME: is it called even when loading fails?
- swfdec_movie_queue_script (SWFDEC_MOVIE (target), SWFDEC_EVENT_DATA);
+ swfdec_actor_queue_script (SWFDEC_ACTOR (target), SWFDEC_EVENT_DATA);
}
static void
@@ -1635,10 +1635,10 @@ swfdec_action_start_drag (SwfdecAsContext *cx, guint action, const guint8 *data,
SWFDEC_ERROR ("called startDrag on a non-SwfdecPlayer");
} else {
movie = swfdec_player_get_movie_from_value (SWFDEC_PLAYER (cx), swfdec_as_stack_peek (cx, 1));
- if (movie != NULL) {
- swfdec_player_set_drag_movie (SWFDEC_PLAYER (cx), movie, center, rectp);
+ if (SWFDEC_IS_ACTOR (movie)) {
+ swfdec_player_set_drag_movie (SWFDEC_PLAYER (cx), SWFDEC_ACTOR (movie), center, rectp);
} else {
- SWFDEC_ERROR ("startDrag on something not a Movie");
+ SWFDEC_ERROR ("startDrag on something not an Actor");
}
}
swfdec_as_stack_pop_n (cx, stack_size);
diff --git a/swfdec/swfdec_button.c b/swfdec/swfdec_button.c
index 471b936..a0e32ed 100644
--- a/swfdec/swfdec_button.c
+++ b/swfdec/swfdec_button.c
@@ -70,7 +70,7 @@ swfdec_button_create_movie (SwfdecGraphic *graphic, gsize *size)
movie->button = g_object_ref (button);
*size = sizeof (SwfdecButtonMovie);
if (button->events)
- SWFDEC_MOVIE (movie)->events = swfdec_event_list_copy (button->events);
+ SWFDEC_ACTOR (movie)->events = swfdec_event_list_copy (button->events);
return SWFDEC_MOVIE (movie);
}
diff --git a/swfdec/swfdec_button_movie.c b/swfdec/swfdec_button_movie.c
index ce11891..5b14015 100644
--- a/swfdec/swfdec_button_movie.c
+++ b/swfdec/swfdec_button_movie.c
@@ -97,9 +97,12 @@ swfdec_button_movie_perform_place (SwfdecButtonMovie *button, SwfdecBits *bits)
blend_mode = 0;
}
swfdec_movie_set_static_properties (new, &trans, v2 ? &ctrans : NULL, 0, 0, blend_mode, NULL);
- swfdec_movie_queue_script (new, SWFDEC_EVENT_INITIALIZE);
- swfdec_movie_queue_script (new, SWFDEC_EVENT_CONSTRUCT);
- swfdec_movie_queue_script (new, SWFDEC_EVENT_LOAD);
+ if (SWFDEC_IS_ACTOR (new)) {
+ SwfdecActor *actor = SWFDEC_ACTOR (new);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_INITIALIZE);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_CONSTRUCT);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_LOAD);
+ }
swfdec_movie_initialize (new);
if (swfdec_bits_left (bits)) {
SWFDEC_WARNING ("button record for id %u has %u bytes left", id,
@@ -156,68 +159,71 @@ swfdec_button_movie_set_state (SwfdecButtonMovie *button, SwfdecButtonState stat
}
static gboolean
-swfdec_button_movie_mouse_events (SwfdecMovie *movie)
+swfdec_button_movie_mouse_events (SwfdecActor *actor)
{
return TRUE;
}
static void
-swfdec_button_movie_mouse_in (SwfdecMovie *movie)
+swfdec_button_movie_mouse_in (SwfdecActor *actor)
{
- if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context)))
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_DOWN);
+ if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context)))
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_DOWN);
else
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_OVER);
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_OVER);
- SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->mouse_in (movie);
+ SWFDEC_ACTOR_CLASS (swfdec_button_movie_parent_class)->mouse_in (actor);
}
static void
-swfdec_button_movie_mouse_out (SwfdecMovie *movie)
+swfdec_button_movie_mouse_out (SwfdecActor *actor)
{
- SwfdecButtonMovie *button = SWFDEC_BUTTON_MOVIE (movie);
+ SwfdecButtonMovie *button = SWFDEC_BUTTON_MOVIE (actor);
- if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context))) {
+ if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (button)->context))) {
if (button->button->menubutton) {
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_UP);
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_UP);
} else {
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_OVER);
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_OVER);
}
} else {
swfdec_button_movie_set_state (button, SWFDEC_BUTTON_UP);
}
- SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->mouse_out (movie);
+ SWFDEC_ACTOR_CLASS (swfdec_button_movie_parent_class)->mouse_out (actor);
}
static void
-swfdec_button_movie_mouse_press (SwfdecMovie *movie, guint button)
+swfdec_button_movie_mouse_press (SwfdecActor *actor, guint button)
{
if (button != 0)
return;
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_DOWN);
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_DOWN);
- SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->mouse_press (movie, button);
+ SWFDEC_ACTOR_CLASS (swfdec_button_movie_parent_class)->mouse_press (actor, button);
}
static void
-swfdec_button_movie_mouse_release (SwfdecMovie *movie, guint button)
+swfdec_button_movie_mouse_release (SwfdecActor *actor, guint button)
{
SwfdecPlayer *player;
if (button != 0)
return;
- player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- if (player->priv->mouse_below == movie) {
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_OVER);
+ player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context);
+ if (player->priv->mouse_below == actor) {
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_OVER);
- SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->mouse_release (movie, button);
+ SWFDEC_ACTOR_CLASS (swfdec_button_movie_parent_class)->mouse_release (actor, button);
} else {
- swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (movie), SWFDEC_BUTTON_UP);
+ swfdec_button_movie_set_state (SWFDEC_BUTTON_MOVIE (actor), SWFDEC_BUTTON_UP);
/* NB: We don't chain to parent here for menubuttons*/
- if (!SWFDEC_BUTTON_MOVIE (movie)->button->menubutton)
- SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->mouse_release (movie, button);
+ if (!SWFDEC_BUTTON_MOVIE (actor)->button->menubutton) {
+ SWFDEC_ACTOR_CLASS (swfdec_button_movie_parent_class)->mouse_release (actor, button);
+ } else {
+ SWFDEC_FIXME ("use mouse_below as recipient for mouse_release events?");
+ }
}
}
@@ -275,7 +281,7 @@ swfdec_button_movie_contains (SwfdecMovie *movie, double x, double y, gboolean e
/* check for movies in a higher layer that react to events */
SwfdecMovie *ret;
ret = SWFDEC_MOVIE_CLASS (swfdec_button_movie_parent_class)->contains (movie, x, y, TRUE);
- if (ret && ret != movie && swfdec_movie_get_mouse_events (ret))
+ if (ret && ret != movie && SWFDEC_IS_ACTOR (ret) && swfdec_actor_get_mouse_events (SWFDEC_ACTOR (ret)))
return ret;
}
@@ -299,17 +305,18 @@ swfdec_button_movie_class_init (SwfdecButtonMovieClass * g_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
SwfdecMovieClass *movie_class = SWFDEC_MOVIE_CLASS (g_class);
+ SwfdecActorClass *actor_class = SWFDEC_ACTOR_CLASS (g_class);
object_class->dispose = swfdec_button_movie_dispose;
movie_class->init_movie = swfdec_button_movie_init_movie;
movie_class->update_extents = swfdec_button_movie_update_extents;
movie_class->contains = swfdec_button_movie_contains;
- movie_class->mouse_events = swfdec_button_movie_mouse_events;
- movie_class->mouse_in = swfdec_button_movie_mouse_in;
- movie_class->mouse_out = swfdec_button_movie_mouse_out;
- movie_class->mouse_press = swfdec_button_movie_mouse_press;
- movie_class->mouse_release = swfdec_button_movie_mouse_release;
+ actor_class->mouse_events = swfdec_button_movie_mouse_events;
+ actor_class->mouse_in = swfdec_button_movie_mouse_in;
+ actor_class->mouse_out = swfdec_button_movie_mouse_out;
+ actor_class->mouse_press = swfdec_button_movie_mouse_press;
+ actor_class->mouse_release = swfdec_button_movie_mouse_release;
}
static void
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 933fd93..cc97939 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -305,10 +305,27 @@ swfdec_movie_find (SwfdecMovie *movie, int depth)
return NULL;
}
+static void
+swfdec_movie_unset_actor (SwfdecPlayer *player, SwfdecActor *actor)
+{
+ SwfdecPlayerPrivate *priv = player->priv;
+
+ if (priv->mouse_below == actor)
+ priv->mouse_below = NULL;
+ if (priv->mouse_grab == actor)
+ priv->mouse_grab = NULL;
+ if (priv->mouse_drag == actor)
+ priv->mouse_drag = NULL;
+
+ if (priv->focus_previous == actor)
+ priv->focus_previous = NULL;
+ if (priv->focus == actor)
+ priv->focus = NULL;
+}
+
static gboolean
swfdec_movie_do_remove (SwfdecMovie *movie, gboolean destroy)
{
- SwfdecPlayerPrivate *priv;
SwfdecPlayer *player;
SWFDEC_LOG ("removing %s %s", G_OBJECT_TYPE_NAME (movie), movie->name);
@@ -323,19 +340,18 @@ swfdec_movie_do_remove (SwfdecMovie *movie, gboolean destroy)
destroy &= swfdec_movie_do_remove (walk->data, destroy);
}
/* FIXME: all of this here or in destroy callback? */
- priv = player->priv;
- if (priv->mouse_grab == movie)
- priv->mouse_grab = NULL;
- if (priv->mouse_drag == movie)
- priv->mouse_drag = NULL;
swfdec_movie_invalidate_last (movie);
movie->state = SWFDEC_MOVIE_STATE_REMOVED;
- if ((movie->events &&
- swfdec_event_list_has_conditions (movie->events, SWFDEC_AS_OBJECT (movie), SWFDEC_EVENT_UNLOAD, 0)) ||
- swfdec_as_object_has_variable (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_onUnload)) {
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_UNLOAD);
- destroy = FALSE;
+ if (SWFDEC_IS_ACTOR (movie)) {
+ SwfdecActor *actor = SWFDEC_ACTOR (movie);
+ swfdec_movie_unset_actor (player, actor);
+ if ((actor->events &&
+ swfdec_event_list_has_conditions (actor->events, SWFDEC_AS_OBJECT (movie), SWFDEC_EVENT_UNLOAD, 0)) ||
+ swfdec_as_object_has_variable (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_onUnload)) {
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_UNLOAD);
+ destroy = FALSE;
+ }
}
if (destroy)
swfdec_movie_destroy (movie);
@@ -396,7 +412,8 @@ swfdec_movie_destroy (SwfdecMovie *movie)
movie->mask_of = NULL;
/* FIXME: figure out how to handle destruction pre-init/construct.
* This is just a stop-gap measure to avoid dead movies in those queues */
- swfdec_player_remove_all_actions (player, movie);
+ if (SWFDEC_IS_ACTOR (movie))
+ swfdec_player_remove_all_actions (player, SWFDEC_ACTOR (movie));
if (klass->finish_movie)
klass->finish_movie (movie);
player->priv->actors = g_list_remove (player->priv->actors, movie);
@@ -408,32 +425,6 @@ swfdec_movie_destroy (SwfdecMovie *movie)
g_object_unref (movie);
}
-static void
-swfdec_movie_set_constructor (SwfdecSpriteMovie *movie)
-{
- SwfdecMovie *mov = SWFDEC_MOVIE (movie);
- SwfdecAsContext *context = SWFDEC_AS_OBJECT (movie)->context;
- SwfdecAsObject *constructor = NULL;
-
- g_assert (mov->resource != NULL);
-
- if (movie->sprite) {
- const char *name;
-
- name = swfdec_resource_get_export_name (mov->resource,
- SWFDEC_CHARACTER (movie->sprite));
- if (name != NULL) {
- name = swfdec_as_context_get_string (context, name);
- constructor = swfdec_player_get_export_class (SWFDEC_PLAYER (context),
- name);
- }
- }
- if (constructor == NULL)
- constructor = mov->resource->sandbox->MovieClip;
-
- swfdec_as_object_set_constructor (SWFDEC_AS_OBJECT (movie), constructor);
-}
-
/**
* swfdec_movie_resolve:
* @movie: movie to resolve
@@ -468,111 +459,6 @@ swfdec_movie_get_version (SwfdecMovie *movie)
}
void
-swfdec_movie_execute (SwfdecMovie *movie, SwfdecEventType condition)
-{
- SwfdecAsObject *thisp;
- const char *name;
-
- g_return_if_fail (SWFDEC_IS_MOVIE (movie));
-
- if (SWFDEC_IS_BUTTON_MOVIE (movie)) {
- /* these conditions don't exist for buttons */
- if (condition == SWFDEC_EVENT_CONSTRUCT || condition < SWFDEC_EVENT_PRESS)
- return;
- thisp = SWFDEC_AS_OBJECT (movie->parent);
- if (swfdec_movie_get_version (movie) <= 5) {
- while (!SWFDEC_IS_SPRITE_MOVIE (thisp))
- thisp = SWFDEC_AS_OBJECT (SWFDEC_MOVIE (thisp)->parent);
- }
- g_assert (thisp);
- } else {
- thisp = SWFDEC_AS_OBJECT (movie);
- }
-
- /* special cases */
- if (condition == SWFDEC_EVENT_CONSTRUCT) {
- if (swfdec_movie_get_version (movie) <= 5)
- return;
- swfdec_movie_set_constructor (SWFDEC_SPRITE_MOVIE (movie));
- } else if (condition == SWFDEC_EVENT_ENTER) {
- if (movie->state >= SWFDEC_MOVIE_STATE_REMOVED)
- return;
- }
-
- swfdec_sandbox_use (movie->resource->sandbox);
- if (movie->events) {
- swfdec_event_list_execute (movie->events, thisp, condition, 0);
- }
- /* FIXME: how do we compute the version correctly here? */
- if (swfdec_movie_get_version (movie) > 5) {
- name = swfdec_event_type_get_name (condition);
- if (name != NULL) {
- swfdec_as_object_call (SWFDEC_AS_OBJECT (movie), name, 0, NULL, NULL);
- }
- if (condition == SWFDEC_EVENT_CONSTRUCT)
- swfdec_as_object_call (thisp, SWFDEC_AS_STR_constructor, 0, NULL, NULL);
- }
- swfdec_sandbox_unuse (movie->resource->sandbox);
-}
-
-/**
- * swfdec_movie_queue_script:
- * @movie: a #SwfdecMovie
- * @condition: the event that should happen
- *
- * Queues execution of all scripts associated with the given event.
- **/
-void
-swfdec_movie_queue_script (SwfdecMovie *movie, SwfdecEventType condition)
-{
- SwfdecPlayer *player;
- guint importance;
-
- g_return_if_fail (SWFDEC_IS_MOVIE (movie));
-
- if (!SWFDEC_IS_SPRITE_MOVIE (movie) && !SWFDEC_IS_BUTTON_MOVIE (movie))
- return;
- /* can happen for mouse/keyboard events on the initial movie */
- if (movie->resource->sandbox == NULL) {
- SWFDEC_INFO ("movie %s not yet initialized, skipping event", movie->name);
- return;
- }
-
- switch (condition) {
- case SWFDEC_EVENT_INITIALIZE:
- importance = 0;
- break;
- case SWFDEC_EVENT_CONSTRUCT:
- importance = 1;
- break;
- case SWFDEC_EVENT_LOAD:
- case SWFDEC_EVENT_ENTER:
- case SWFDEC_EVENT_UNLOAD:
- case SWFDEC_EVENT_MOUSE_MOVE:
- case SWFDEC_EVENT_MOUSE_DOWN:
- case SWFDEC_EVENT_MOUSE_UP:
- case SWFDEC_EVENT_KEY_UP:
- case SWFDEC_EVENT_KEY_DOWN:
- case SWFDEC_EVENT_DATA:
- case SWFDEC_EVENT_PRESS:
- case SWFDEC_EVENT_RELEASE:
- case SWFDEC_EVENT_RELEASE_OUTSIDE:
- case SWFDEC_EVENT_ROLL_OVER:
- case SWFDEC_EVENT_ROLL_OUT:
- case SWFDEC_EVENT_DRAG_OVER:
- case SWFDEC_EVENT_DRAG_OUT:
- case SWFDEC_EVENT_KEY_PRESS:
- importance = 2;
- break;
- default:
- g_return_if_reached ();
- }
-
- player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- swfdec_player_add_action (player, movie, condition, importance);
-}
-
-void
swfdec_movie_local_to_global (SwfdecMovie *movie, double *x, double *y)
{
g_return_if_fail (SWFDEC_IS_MOVIE (movie));
@@ -694,28 +580,6 @@ swfdec_movie_get_mouse (SwfdecMovie *movie, double *x, double *y)
}
/**
- * swfdec_movie_get_mouse_events:
- * @movie: a #SwfdecMovie
- *
- * Checks if this movie should respond to mouse events.
- *
- * Returns: %TRUE if this movie can receive mouse events
- **/
-gboolean
-swfdec_movie_get_mouse_events (SwfdecMovie *movie)
-{
- SwfdecMovieClass *klass;
-
- g_return_val_if_fail (SWFDEC_IS_MOVIE (movie), FALSE);
-
- klass = SWFDEC_MOVIE_GET_CLASS (movie);
- if (klass->mouse_events)
- return klass->mouse_events (movie);
- else
- return FALSE;
-}
-
-/**
* swfdec_movie_get_movie_at:
* @movie: a #SwfdecMovie
* @x: x coordinate in parent's coordinate space
@@ -769,7 +633,7 @@ swfdec_movie_do_contains (SwfdecMovie *movie, double x, double y, gboolean event
if (got != NULL) {
if (events) {
/* set the return value to the topmost movie */
- if (swfdec_movie_get_mouse_events (got)) {
+ if (SWFDEC_IS_ACTOR (got) && swfdec_actor_get_mouse_events (SWFDEC_ACTOR (got))) {
ret = got;
} else if (ret == NULL) {
ret = movie;
@@ -803,31 +667,6 @@ swfdec_movie_do_contains (SwfdecMovie *movie, double x, double y, gboolean event
return NULL;
}
-gboolean
-swfdec_movie_can_focus (SwfdecMovie *movie)
-{
- SwfdecAsValue val;
-
- g_return_val_if_fail (SWFDEC_IS_MOVIE (movie), FALSE);
-
- /* FIXME: subclass plz? */
- if (!SWFDEC_IS_TEXT_FIELD_MOVIE (movie) &&
- !SWFDEC_IS_BUTTON_MOVIE (movie) &&
- !SWFDEC_IS_SPRITE_MOVIE (movie))
- return FALSE;
-
- /* apparently root movies can't receive focus? */
- if (movie->parent == NULL)
- return FALSE;
-
- if (!swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (movie),
- SWFDEC_AS_STR_focusEnabled, &val) ||
- swfdec_as_value_to_boolean (SWFDEC_AS_OBJECT (movie)->context, &val) == FALSE)
- return FALSE;
-
- return TRUE;
-}
-
static gboolean
swfdec_movie_needs_group (SwfdecMovie *movie)
{
@@ -1050,10 +889,6 @@ swfdec_movie_dispose (GObject *object)
g_assert (movie->list == NULL);
SWFDEC_LOG ("disposing movie %s (depth %d)", movie->name, movie->depth);
- if (movie->events) {
- swfdec_event_list_free (movie->events);
- movie->events = NULL;
- }
if (movie->graphic) {
g_object_unref (movie->graphic);
movie->graphic = NULL;
@@ -1381,89 +1216,6 @@ swfdec_movie_do_render (SwfdecMovie *movie, cairo_t *cr,
g_assert (clips == NULL);
}
-static gboolean
-swfdec_movie_mouse_events (SwfdecMovie *movie)
-{
- SwfdecAsObject *object;
-
- /* root movies don't get event */
- if (movie->parent == NULL)
- return FALSE;
- /* look if we have a script that gets events */
- if (movie->events && swfdec_event_list_has_mouse_events (movie->events))
- return TRUE;
- /* otherwise, require at least one of the custom script handlers */
- object = SWFDEC_AS_OBJECT (movie);
- if (swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRollOver) ||
- swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRollOut) ||
- swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onDragOver) ||
- swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onDragOut) ||
- swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onPress) ||
- swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onRelease) ||
- swfdec_as_object_has_variable (object, SWFDEC_AS_STR_onReleaseOutside))
- return TRUE;
- return FALSE;
-}
-
-static void
-swfdec_movie_mouse_in (SwfdecMovie *movie)
-{
- if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context)))
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_DRAG_OVER);
- else
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_ROLL_OVER);
-}
-
-static void
-swfdec_movie_mouse_out (SwfdecMovie *movie)
-{
- if (swfdec_player_is_mouse_pressed (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context)))
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_DRAG_OUT);
- else
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_ROLL_OUT);
-}
-
-static void
-swfdec_movie_mouse_press (SwfdecMovie *movie, guint button)
-{
- if (button != 0)
- return;
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_PRESS);
-}
-
-static void
-swfdec_movie_mouse_release (SwfdecMovie *movie, guint button)
-{
- SwfdecPlayer *player;
-
- if (button != 0)
- return;
-
- player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
- if (player->priv->mouse_below == movie)
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_RELEASE);
- else
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_RELEASE_OUTSIDE);
-}
-
-static void
-swfdec_movie_mouse_move (SwfdecMovie *movie, double x, double y)
-{
- /* nothing to do here, it's just there so we don't need to check for NULL */
-}
-
-static void
-swfdec_movie_key_press (SwfdecMovie *movie, guint keycode, guint character)
-{
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_KEY_DOWN);
-}
-
-static void
-swfdec_movie_key_release (SwfdecMovie *movie, guint keycode, guint character)
-{
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_KEY_UP);
-}
-
static void
swfdec_movie_do_invalidate (SwfdecMovie *movie, const cairo_matrix_t *matrix, gboolean last)
{
@@ -1509,14 +1261,6 @@ swfdec_movie_class_init (SwfdecMovieClass * movie_class)
movie_class->render = swfdec_movie_do_render;
movie_class->invalidate = swfdec_movie_do_invalidate;
movie_class->contains = swfdec_movie_do_contains;
- movie_class->mouse_events = swfdec_movie_mouse_events;
- movie_class->mouse_in = swfdec_movie_mouse_in;
- movie_class->mouse_out = swfdec_movie_mouse_out;
- movie_class->mouse_press = swfdec_movie_mouse_press;
- movie_class->mouse_release = swfdec_movie_mouse_release;
- movie_class->mouse_move = swfdec_movie_mouse_move;
- movie_class->key_press = swfdec_movie_key_press;
- movie_class->key_release = swfdec_movie_key_release;
}
void
@@ -1709,9 +1453,10 @@ swfdec_movie_set_static_properties (SwfdecMovie *movie, const cairo_matrix_t *tr
}
if (events) {
if (SWFDEC_IS_SPRITE_MOVIE (movie)) {
- if (movie->events)
- swfdec_event_list_free (movie->events);
- movie->events = swfdec_event_list_copy (events);
+ SwfdecActor *actor = SWFDEC_ACTOR (movie);
+ if (actor->events)
+ swfdec_event_list_free (actor->events);
+ actor->events = swfdec_event_list_copy (events);
} else {
SWFDEC_WARNING ("trying to set events on a %s, not allowed", G_OBJECT_TYPE_NAME (movie));
}
@@ -1756,13 +1501,14 @@ swfdec_movie_duplicate (SwfdecMovie *movie, const char *name, int depth)
return NULL;
swfdec_movie_set_static_properties (copy, &movie->original_transform,
&movie->original_ctrans, movie->original_ratio, movie->clip_depth,
- movie->blend_mode, movie->events);
+ movie->blend_mode, SWFDEC_IS_ACTOR (movie) ? SWFDEC_ACTOR (movie)->events : NULL);
sandbox = SWFDEC_SANDBOX (SWFDEC_AS_OBJECT (movie)->context->global);
swfdec_sandbox_unuse (sandbox);
if (SWFDEC_IS_SPRITE_MOVIE (copy)) {
- swfdec_movie_queue_script (copy, SWFDEC_EVENT_INITIALIZE);
- swfdec_movie_queue_script (copy, SWFDEC_EVENT_LOAD);
- swfdec_movie_execute (copy, SWFDEC_EVENT_CONSTRUCT);
+ SwfdecActor *actor = SWFDEC_ACTOR (copy);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_INITIALIZE);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_LOAD);
+ swfdec_actor_execute (actor, SWFDEC_EVENT_CONSTRUCT);
}
swfdec_movie_initialize (copy);
swfdec_sandbox_use (sandbox);
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index 5371366..a5d3bbb 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -103,7 +103,6 @@ struct _SwfdecMovie {
cairo_matrix_t original_transform; /* initial transform used */
guint original_ratio; /* ratio used in this movie */
int clip_depth; /* up to which movie this movie clips */
- SwfdecEventList * events; /* events queued on this movie */
/* parenting information */
SwfdecMovie * parent; /* movie that contains us or NULL for root movies */
@@ -169,27 +168,6 @@ struct _SwfdecMovieClass {
double x,
double y,
gboolean events);
- /* mouse handling */
- gboolean (* mouse_events) (SwfdecMovie * movie);
- SwfdecMouseCursor (* mouse_cursor) (SwfdecMovie * movie);
- void (* mouse_in) (SwfdecMovie * movie);
- void (* mouse_out) (SwfdecMovie * movie);
- void (* mouse_press) (SwfdecMovie * movie,
- guint button);
- void (* mouse_release) (SwfdecMovie * movie,
- guint button);
- void (* mouse_move) (SwfdecMovie * movie,
- double x,
- double y);
- /* keyboard handling */
- void (* focus_in) (SwfdecMovie * movie);
- void (* focus_out) (SwfdecMovie * movie);
- void (* key_press) (SwfdecMovie * movie,
- guint keycode,
- guint character);
- void (* key_release) (SwfdecMovie * movie,
- guint keycode,
- guint character);
};
GType swfdec_movie_get_type (void);
@@ -247,11 +225,9 @@ void swfdec_movie_rect_global_to_local (SwfdecMovie * movie,
void swfdec_movie_set_depth (SwfdecMovie * movie,
int depth);
-gboolean swfdec_movie_can_focus (SwfdecMovie * movie);
void swfdec_movie_get_mouse (SwfdecMovie * movie,
double * x,
double * y);
-gboolean swfdec_movie_get_mouse_events (SwfdecMovie * movie);
#define swfdec_movie_contains(movie, x, y) \
(swfdec_movie_get_movie_at ((movie), (x), (y), FALSE) != NULL)
SwfdecMovie * swfdec_movie_get_movie_at (SwfdecMovie * movie,
@@ -269,10 +245,6 @@ cairo_pattern_t *swfdec_movie_mask (cairo_t * cr,
const SwfdecRect * inval);
SwfdecMovie * swfdec_movie_resolve (SwfdecMovie * movie);
guint swfdec_movie_get_version (SwfdecMovie * movie);
-void swfdec_movie_execute (SwfdecMovie * movie,
- SwfdecEventType condition);
-void swfdec_movie_queue_script (SwfdecMovie * movie,
- SwfdecEventType condition);
int swfdec_movie_compare_depths (gconstpointer a,
gconstpointer b);
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 32f47e9..f208987 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -366,7 +366,7 @@ swfdec_player_remove_timeout (SwfdecPlayer *player, SwfdecTimeout *timeout)
/*** Actions ***/
typedef struct {
- SwfdecMovie * movie; /* the movie to trigger the action on */
+ SwfdecActor * actor; /* the actor to trigger the action on */
SwfdecScript * script; /* script to execute or NULL to trigger action */
SwfdecEventType event; /* the action to trigger */
} SwfdecPlayerAction;
@@ -386,7 +386,7 @@ swfdec_player_compress_actions (SwfdecRingBuffer *buffer)
for (i = swfdec_ring_buffer_get_n_elements (buffer); i > 0; i--) {
action = swfdec_ring_buffer_pop (buffer);
g_assert (action);
- if (action->movie == NULL)
+ if (action->actor == NULL)
continue;
tmp = *action;
action = swfdec_ring_buffer_push (buffer);
@@ -396,7 +396,7 @@ swfdec_player_compress_actions (SwfdecRingBuffer *buffer)
swfdec_ring_buffer_get_n_elements (buffer));
for (i = 0; i < swfdec_ring_buffer_get_n_elements (buffer); i++) {
action = swfdec_ring_buffer_peek_nth (buffer, i);
- g_assert (action->movie != NULL);
+ g_assert (action->actor != NULL);
}
}
@@ -435,31 +435,31 @@ swfdec_player_do_add_action (SwfdecPlayer *player, guint importance, SwfdecPlaye
* is calling Actionscript code, you want to do this by using actions.
**/
void
-swfdec_player_add_action (SwfdecPlayer *player, SwfdecMovie *movie, SwfdecEventType type,
+swfdec_player_add_action (SwfdecPlayer *player, SwfdecActor *actor, SwfdecEventType type,
guint importance)
{
- SwfdecPlayerAction action = { movie, NULL, type };
+ SwfdecPlayerAction action = { actor, NULL, type };
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (SWFDEC_IS_MOVIE (movie));
+ g_return_if_fail (SWFDEC_IS_ACTOR (actor));
g_return_if_fail (importance < SWFDEC_PLAYER_N_ACTION_QUEUES);
- SWFDEC_LOG ("adding action %s %u", movie->name, type);
+ SWFDEC_LOG ("adding action %s %u", SWFDEC_MOVIE (actor)->name, type);
swfdec_player_do_add_action (player, importance, &action);
}
void
-swfdec_player_add_action_script (SwfdecPlayer *player, SwfdecMovie *movie,
+swfdec_player_add_action_script (SwfdecPlayer *player, SwfdecActor *actor,
SwfdecScript *script, guint importance)
{
- SwfdecPlayerAction action = { movie, script, 0 };
+ SwfdecPlayerAction action = { actor, script, 0 };
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (SWFDEC_IS_MOVIE (movie));
+ g_return_if_fail (SWFDEC_IS_ACTOR (actor));
g_return_if_fail (script != NULL);
g_return_if_fail (importance < SWFDEC_PLAYER_N_ACTION_QUEUES);
- SWFDEC_LOG ("adding action script %s %s", movie->name, script->name);
+ SWFDEC_LOG ("adding action script %s %s", SWFDEC_MOVIE (actor)->name, script->name);
swfdec_player_do_add_action (player, importance, &action);
}
@@ -472,24 +472,24 @@ swfdec_player_add_action_script (SwfdecPlayer *player, SwfdecMovie *movie,
* See swfdec_player_add_action() for details about actions.
**/
void
-swfdec_player_remove_all_actions (SwfdecPlayer *player, SwfdecMovie *movie)
+swfdec_player_remove_all_actions (SwfdecPlayer *player, SwfdecActor *actor)
{
SwfdecPlayerAction *action;
SwfdecPlayerPrivate *priv;
guint i, j;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (SWFDEC_IS_MOVIE (movie));
+ g_return_if_fail (SWFDEC_IS_ACTOR (actor));
priv = player->priv;
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
for (j = 0; j < swfdec_ring_buffer_get_n_elements (priv->actions[i]); j++) {
action = swfdec_ring_buffer_peek_nth (priv->actions[i], j);
- if (action->movie == movie) {
+ if (action->actor == actor) {
SWFDEC_LOG ("removing action %p %u",
- action->movie, action->event);
- action->movie = NULL;
+ action->actor, action->event);
+ action->actor = NULL;
}
}
}
@@ -508,15 +508,15 @@ swfdec_player_do_action (SwfdecPlayer *player)
action = swfdec_ring_buffer_pop (priv->actions[i]);
if (action == NULL)
break;
- } while (action->movie == NULL); /* skip removed actions */
+ } while (action->actor == NULL); /* skip removed actions */
if (action) {
if (action->script) {
- SwfdecSandbox *sandbox = action->movie->resource->sandbox;
+ SwfdecSandbox *sandbox = SWFDEC_MOVIE (action->actor)->resource->sandbox;
swfdec_sandbox_use (sandbox);
- swfdec_as_object_run (SWFDEC_AS_OBJECT (action->movie), action->script);
+ swfdec_as_object_run (SWFDEC_AS_OBJECT (action->actor), action->script);
swfdec_sandbox_unuse (sandbox);
} else {
- swfdec_movie_execute (action->movie, action->event);
+ swfdec_actor_execute (action->actor, action->event);
}
return TRUE;
}
@@ -992,7 +992,7 @@ swfdec_player_dispose (GObject *object)
SwfdecPlayerAction *action;
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
while ((action = swfdec_ring_buffer_pop (priv->actions[i])) != NULL) {
- g_assert (action->movie == NULL); /* skip removed actions */
+ g_assert (action->actor == NULL); /* skip removed actions */
}
}
}
@@ -1066,7 +1066,7 @@ swfdec_player_broadcast (SwfdecPlayer *player, const char *object_name, const ch
/**
* swfdec_player_grab_focus:
* @player: the player
- * @movie: the movie to give focus or %NULL to unset focus
+ * @actor: the actor to give focus or %NULL to unset focus
*
* This function handles passing the focus around. It is supposed to be called
* by all functions that wish to change keyboard focus. Note that only the
@@ -1074,21 +1074,21 @@ swfdec_player_broadcast (SwfdecPlayer *player, const char *object_name, const ch
* key_released vfuncs.
**/
void
-swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecMovie *movie)
+swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecActor *actor)
{
SwfdecAsValue vals[2];
SwfdecPlayerPrivate *priv;
- SwfdecMovieClass *klass;
- SwfdecMovie *prev;
+ SwfdecActorClass *klass;
+ SwfdecActor *prev;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (movie == NULL || SWFDEC_IS_MOVIE (movie));
+ g_return_if_fail (actor == NULL || SWFDEC_IS_ACTOR (actor));
- g_print ("movie %s grabs focus (%d)\n", movie ? movie->name : "---", player->priv->has_focus);
/* set variables */
priv = player->priv;
- if (movie == priv->focus) {
- SWFDEC_DEBUG ("nothing to do, focus change request from movie %s to itself", movie ? movie->name : "---");
+ if (actor == priv->focus) {
+ SWFDEC_DEBUG ("nothing to do, focus change request from movie %s to itself",
+ actor ? SWFDEC_MOVIE (actor)->name : "---");
return;
}
prev = priv->focus;
@@ -1097,30 +1097,30 @@ swfdec_player_grab_focus (SwfdecPlayer *player, SwfdecMovie *movie)
} else {
SWFDEC_AS_VALUE_SET_NULL (&vals[0]);
}
- if (movie) {
- SWFDEC_AS_VALUE_SET_OBJECT (&vals[1], SWFDEC_AS_OBJECT (movie));
+ if (actor) {
+ SWFDEC_AS_VALUE_SET_OBJECT (&vals[1], SWFDEC_AS_OBJECT (actor));
} else {
SWFDEC_AS_VALUE_SET_NULL (&vals[1]);
}
if (prev) {
- swfdec_sandbox_use (prev->resource->sandbox);
+ swfdec_sandbox_use (SWFDEC_MOVIE (prev)->resource->sandbox);
swfdec_as_object_call (SWFDEC_AS_OBJECT (prev), SWFDEC_AS_STR_onKillFocus,
1, &vals[1], NULL);
- swfdec_sandbox_unuse (prev->resource->sandbox);
- klass = SWFDEC_MOVIE_GET_CLASS (prev);
+ swfdec_sandbox_unuse (SWFDEC_MOVIE (prev)->resource->sandbox);
+ klass = SWFDEC_ACTOR_GET_CLASS (prev);
if (klass->focus_out)
klass->focus_out (prev);
}
priv->focus_previous = prev;
- priv->focus = movie;
- if (movie) {
- swfdec_sandbox_use (movie->resource->sandbox);
- swfdec_as_object_call (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_STR_onSetFocus,
+ priv->focus = actor;
+ if (actor) {
+ swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
+ swfdec_as_object_call (SWFDEC_AS_OBJECT (actor), SWFDEC_AS_STR_onSetFocus,
1, &vals[0], NULL);
- swfdec_sandbox_unuse (movie->resource->sandbox);
- klass = SWFDEC_MOVIE_GET_CLASS (movie);
+ swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
+ klass = SWFDEC_ACTOR_GET_CLASS (actor);
if (klass->focus_in)
- klass->focus_in (movie);
+ klass->focus_in (actor);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Selection, SWFDEC_AS_STR_onSetFocus, 2, vals);
}
@@ -1134,7 +1134,7 @@ swfdec_player_update_mouse_cursor (SwfdecPlayer *player)
if (!priv->mouse_visible) {
new = SWFDEC_MOUSE_CURSOR_NONE;
} else if (priv->mouse_grab != NULL) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_cursor)
new = klass->mouse_cursor (priv->mouse_grab);
@@ -1160,13 +1160,13 @@ swfdec_player_update_mouse_cursor (SwfdecPlayer *player)
* Sets or unsets the movie that is dragged by the mouse.
**/
void
-swfdec_player_set_drag_movie (SwfdecPlayer *player, SwfdecMovie *drag, gboolean center,
+swfdec_player_set_drag_movie (SwfdecPlayer *player, SwfdecActor *drag, gboolean center,
SwfdecRect *rect)
{
SwfdecPlayerPrivate *priv;
g_return_if_fail (SWFDEC_IS_PLAYER (player));
- g_return_if_fail (drag == NULL || SWFDEC_IS_MOVIE (drag));
+ g_return_if_fail (drag == NULL || SWFDEC_IS_ACTOR (drag));
/* FIXME: need to do anything with old drag? */
priv = player->priv;
@@ -1176,10 +1176,10 @@ swfdec_player_set_drag_movie (SwfdecPlayer *player, SwfdecMovie *drag, gboolean
priv->mouse_drag_x = priv->mouse_x;
priv->mouse_drag_y = priv->mouse_y;
swfdec_player_stage_to_global (player, &priv->mouse_drag_x, &priv->mouse_drag_y);
- if (drag->parent)
- swfdec_movie_global_to_local (drag->parent, &priv->mouse_drag_x, &priv->mouse_drag_y);
- priv->mouse_drag_x -= drag->matrix.x0;
- priv->mouse_drag_y -= drag->matrix.y0;
+ if (SWFDEC_MOVIE (drag)->parent)
+ swfdec_movie_global_to_local (SWFDEC_MOVIE (drag)->parent, &priv->mouse_drag_x, &priv->mouse_drag_y);
+ priv->mouse_drag_x -= SWFDEC_MOVIE (drag)->matrix.x0;
+ priv->mouse_drag_y -= SWFDEC_MOVIE (drag)->matrix.y0;
}
if (rect) {
priv->mouse_drag_rect = *rect;
@@ -1192,8 +1192,8 @@ swfdec_player_set_drag_movie (SwfdecPlayer *player, SwfdecMovie *drag, gboolean
SWFDEC_DEBUG ("starting drag in %g %g %g %g",
priv->mouse_drag_rect.x0, priv->mouse_drag_rect.y0,
priv->mouse_drag_rect.x1, priv->mouse_drag_rect.y1);
- if (drag)
- drag->modified = TRUE;
+ if (SWFDEC_MOVIE (drag))
+ SWFDEC_MOVIE (drag)->modified = TRUE;
}
static void
@@ -1202,17 +1202,17 @@ swfdec_player_grab_mouse_movie (SwfdecPlayer *player)
SwfdecPlayerPrivate *priv = player->priv;
GList *walk;
double x, y;
- SwfdecMovie *below_mouse = NULL;
+ SwfdecActor *below_mouse = NULL;
x = priv->mouse_x;
y = priv->mouse_y;
swfdec_player_stage_to_global (player, &x, &y);
for (walk = g_list_last (priv->roots); walk; walk = walk->prev) {
- below_mouse = swfdec_movie_get_movie_at (walk->data, x, y, TRUE);
- if (below_mouse) {
- if (swfdec_movie_get_mouse_events (below_mouse))
- break;
- below_mouse = NULL;
+ SwfdecMovie *movie = swfdec_movie_get_movie_at (walk->data, x, y, TRUE);
+ if (SWFDEC_IS_ACTOR (movie) &&
+ swfdec_actor_get_mouse_events (SWFDEC_ACTOR (movie))) {
+ below_mouse = SWFDEC_ACTOR (movie);
+ break;
}
}
if (swfdec_player_is_mouse_pressed (player)) {
@@ -1220,12 +1220,12 @@ swfdec_player_grab_mouse_movie (SwfdecPlayer *player)
if (priv->mouse_grab) {
if (below_mouse == priv->mouse_grab &&
priv->mouse_below != priv->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_in)
klass->mouse_in (priv->mouse_grab);
} else if (below_mouse != priv->mouse_grab &&
priv->mouse_below == priv->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_out)
klass->mouse_out (priv->mouse_grab);
}
@@ -1234,12 +1234,12 @@ swfdec_player_grab_mouse_movie (SwfdecPlayer *player)
/* no mouse grab is active */
if (below_mouse != priv->mouse_grab) {
if (priv->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_out)
klass->mouse_out (priv->mouse_grab);
}
if (below_mouse) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (below_mouse);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (below_mouse);
if (klass->mouse_in)
klass->mouse_in (below_mouse);
}
@@ -1262,15 +1262,15 @@ swfdec_player_do_mouse_move (SwfdecPlayer *player, double x, double y)
priv->mouse_x = x;
priv->mouse_y = y;
for (walk = priv->actors; walk; walk = walk->next) {
- swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_MOVE);
+ swfdec_actor_queue_script (walk->data, SWFDEC_EVENT_MOUSE_MOVE);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseMove, 0, NULL);
}
swfdec_player_grab_mouse_movie (player);
if (priv->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
swfdec_player_stage_to_global (player, &x, &y);
- swfdec_movie_global_to_local (priv->mouse_grab, &x, &y);
+ swfdec_movie_global_to_local (SWFDEC_MOVIE (priv->mouse_grab), &x, &y);
if (klass->mouse_move)
klass->mouse_move (priv->mouse_grab, x, y);
}
@@ -1288,12 +1288,12 @@ swfdec_player_do_mouse_press (SwfdecPlayer *player, guint button)
priv->mouse_button |= 1 << button;
if (button == 0) {
for (walk = priv->actors; walk; walk = walk->next) {
- swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_DOWN);
+ swfdec_actor_queue_script (walk->data, SWFDEC_EVENT_MOUSE_DOWN);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseDown, 0, NULL);
}
if (priv->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_press)
klass->mouse_press (priv->mouse_grab, button);
}
@@ -1311,18 +1311,18 @@ swfdec_player_do_mouse_release (SwfdecPlayer *player, guint button)
priv->mouse_button &= ~(1 << button);
if (button == 0) {
for (walk = priv->actors; walk; walk = walk->next) {
- swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_UP);
+ swfdec_actor_queue_script (walk->data, SWFDEC_EVENT_MOUSE_UP);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseUp, 0, NULL);
}
if (priv->mouse_grab) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_release)
klass->mouse_release (priv->mouse_grab, button);
if (button == 0 && priv->mouse_grab != priv->mouse_below) {
priv->mouse_grab = priv->mouse_below;
if (priv->mouse_grab) {
- klass = SWFDEC_MOVIE_GET_CLASS (priv->mouse_grab);
+ klass = SWFDEC_ACTOR_GET_CLASS (priv->mouse_grab);
if (klass->mouse_in)
klass->mouse_in (priv->mouse_grab);
}
@@ -1409,8 +1409,7 @@ swfdec_player_do_handle_key (SwfdecPlayer *player, guint keycode, guint characte
swfdec_player_broadcast (player, SWFDEC_AS_STR_Key,
down ? SWFDEC_AS_STR_onKeyDown : SWFDEC_AS_STR_onKeyUp, 0, NULL);
if (priv->focus) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (priv->focus);
- g_print ("got a focus movie!\n");
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (priv->focus);
if (down) {
if (klass->key_press)
klass->key_press (priv->focus, keycode, character);
@@ -1629,7 +1628,7 @@ swfdec_player_update_drag_movie (SwfdecPlayer *player)
if (priv->mouse_drag == NULL)
return;
- movie = priv->mouse_drag;
+ movie = SWFDEC_MOVIE (priv->mouse_drag);
swfdec_movie_update (movie);
x = priv->mouse_x;
y = priv->mouse_y;
diff --git a/swfdec/swfdec_player_internal.h b/swfdec/swfdec_player_internal.h
index 716667a..d1b78fd 100644
--- a/swfdec/swfdec_player_internal.h
+++ b/swfdec/swfdec_player_internal.h
@@ -111,9 +111,9 @@ struct _SwfdecPlayerPrivate
double mouse_x; /* in stage coordinates */
double mouse_y; /* in stage coordinates */
guint mouse_button; /* 0 for not pressed, 1 for pressed */
- SwfdecMovie * mouse_below; /* movie that currently is below the mouse */
- SwfdecMovie * mouse_grab; /* movie that currently has the mouse */
- SwfdecMovie * mouse_drag; /* current movie activated by startDrag */
+ SwfdecActor * mouse_below; /* actor that currently is below the mouse */
+ SwfdecActor * mouse_grab; /* actor that currently has the mouse */
+ SwfdecActor * mouse_drag; /* current actor activated by startDrag */
gboolean mouse_drag_center; /* TRUE to use center of movie at mouse, FALSE for movie's (0,0) */
SwfdecRect mouse_drag_rect; /* clipping rectangle for movements */
double mouse_drag_x; /* offset of mouse in x direction */
@@ -123,8 +123,8 @@ struct _SwfdecPlayerPrivate
guint last_keycode; /* last keycode that was pressed/released */
guint last_character; /* UCS4 of last character pressed/released */
guint8 key_pressed[256/8]; /* boolean array for isDown */
- SwfdecMovie * focus; /* movie that currently has keyboard focus (or NULL if none) */
- SwfdecMovie * focus_previous; /* the last movie that had focus */
+ SwfdecActor * focus; /* actor that currently has keyboard focus (or NULL if none) */
+ SwfdecActor * focus_previous; /* the previues actor that had focus */
GList * focus_list; /* list of movies with a tabIndex set or NULL for no tabIndex usage */
/* audio */
@@ -187,7 +187,7 @@ SwfdecSocket * swfdec_player_create_socket (SwfdecPlayer * player,
guint port);
void swfdec_player_grab_focus (SwfdecPlayer * player,
- SwfdecMovie * movie);
+ SwfdecActor * actor);
#define swfdec_player_is_key_pressed(player,key) ((player)->priv->key_pressed[(key) / 8] & (1 << ((key) % 8)))
#define swfdec_player_is_mouse_pressed(player) ((player)->priv->mouse_button & 1)
void swfdec_player_invalidate (SwfdecPlayer * player,
@@ -205,18 +205,18 @@ void swfdec_player_remove_all_external_actions
(SwfdecPlayer * player,
gpointer object);
void swfdec_player_add_action (SwfdecPlayer * player,
- SwfdecMovie * movie,
+ SwfdecActor * actor,
SwfdecEventType type,
guint importance);
void swfdec_player_add_action_script (SwfdecPlayer * player,
- SwfdecMovie * movie,
+ SwfdecActor * actor,
SwfdecScript * script,
guint importance);
void swfdec_player_remove_all_actions (SwfdecPlayer * player,
- SwfdecMovie * movie);
+ SwfdecActor * actor);
void swfdec_player_set_drag_movie (SwfdecPlayer * player,
- SwfdecMovie * drag,
+ SwfdecActor * drag,
gboolean center,
SwfdecRect * rect);
void swfdec_player_set_align_flags (SwfdecPlayer * player,
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 57cd544..90710cb 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -355,7 +355,7 @@ swfdec_resource_stream_target_close (SwfdecStreamTarget *target, SwfdecStream *s
if (resource->movie != NULL) {
swfdec_player_add_action (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (resource)->context),
- SWFDEC_MOVIE (resource->movie), SWFDEC_EVENT_LOAD, 0);
+ SWFDEC_ACTOR (resource->movie), SWFDEC_EVENT_LOAD, 0);
}
}
diff --git a/swfdec/swfdec_selection.c b/swfdec/swfdec_selection.c
index d3343be..8eabe2e 100644
--- a/swfdec/swfdec_selection.c
+++ b/swfdec/swfdec_selection.c
@@ -61,7 +61,7 @@ swfdec_selection_getFocus (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecPlayerPrivate *priv = SWFDEC_PLAYER (cx)->priv;
if (priv->focus) {
- char *s = swfdec_movie_get_path (priv->focus, TRUE);
+ char *s = swfdec_movie_get_path (SWFDEC_MOVIE (priv->focus), TRUE);
SWFDEC_AS_VALUE_SET_STRING (ret, swfdec_as_context_give_string (cx, s));
} else {
SWFDEC_AS_VALUE_SET_NULL (ret);
@@ -73,23 +73,27 @@ void
swfdec_selection_setFocus (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
- SwfdecMovie *movie;
+ SwfdecAsValue val;
+ SwfdecActor *actor;
SwfdecSandbox *sandbox;
SWFDEC_AS_VALUE_SET_BOOLEAN (ret, FALSE);
- SWFDEC_AS_CHECK (0, NULL, "O", &movie);
+ SWFDEC_AS_CHECK (0, NULL, "O", &actor);
- if (movie != NULL &&
- (!SWFDEC_IS_MOVIE (movie) ||
- !swfdec_movie_can_focus (movie)))
+ if (actor != NULL &&
+ (!SWFDEC_IS_MOVIE (actor) ||
+ SWFDEC_MOVIE (actor)->parent == NULL ||
+ !swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (actor),
+ SWFDEC_AS_STR_focusEnabled, &val) ||
+ swfdec_as_value_to_boolean (SWFDEC_AS_OBJECT (actor)->context, &val) == FALSE))
return;
/* FIXME: how is security handled here? */
sandbox = SWFDEC_SANDBOX (cx->global);
swfdec_sandbox_unuse (sandbox);
- swfdec_player_grab_focus (SWFDEC_PLAYER (cx), movie);
+ swfdec_player_grab_focus (SWFDEC_PLAYER (cx), actor);
swfdec_sandbox_use (sandbox);
- if (movie == NULL) {
+ if (actor == NULL) {
SWFDEC_AS_VALUE_SET_BOOLEAN (ret, TRUE);
}
return;
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index 1b37094..d433884 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -121,9 +121,12 @@ swfdec_sprite_movie_perform_old_place (SwfdecSpriteMovie *movie,
cur = swfdec_movie_new (player, depth, mov, mov->resource, graphic, NULL);
swfdec_movie_set_static_properties (cur, &transform,
has_ctrans ? &ctrans : NULL, -1, 0, 0, NULL);
- swfdec_movie_queue_script (cur, SWFDEC_EVENT_INITIALIZE);
- swfdec_movie_queue_script (cur, SWFDEC_EVENT_CONSTRUCT);
- swfdec_movie_queue_script (cur, SWFDEC_EVENT_LOAD);
+ if (SWFDEC_IS_ACTOR (cur)) {
+ SwfdecActor *actor = SWFDEC_ACTOR (cur);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_INITIALIZE);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_CONSTRUCT);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_LOAD);
+ }
swfdec_movie_initialize (cur);
return TRUE;
@@ -326,9 +329,12 @@ swfdec_sprite_movie_perform_place (SwfdecSpriteMovie *movie, SwfdecBits *bits, g
cur = swfdec_movie_new (player, depth, mov, mov->resource, graphic, name);
swfdec_movie_set_static_properties (cur, has_transform ? &transform : NULL,
has_ctrans ? &ctrans : NULL, ratio, clip_depth, blend_mode, events);
- swfdec_movie_queue_script (cur, SWFDEC_EVENT_INITIALIZE);
- swfdec_movie_queue_script (cur, SWFDEC_EVENT_CONSTRUCT);
- swfdec_movie_queue_script (cur, SWFDEC_EVENT_LOAD);
+ if (SWFDEC_IS_ACTOR (cur)) {
+ SwfdecActor *actor = SWFDEC_ACTOR (cur);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_INITIALIZE);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_CONSTRUCT);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_LOAD);
+ }
swfdec_movie_initialize (cur);
}
@@ -359,6 +365,7 @@ swfdec_sprite_movie_perform_one_action (SwfdecSpriteMovie *movie, guint tag, Swf
gboolean skip_scripts, gboolean first_time)
{
SwfdecMovie *mov = SWFDEC_MOVIE (movie);
+ SwfdecActor *actor = SWFDEC_ACTOR (movie);
SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (mov)->context);
SwfdecBits bits;
@@ -374,7 +381,7 @@ swfdec_sprite_movie_perform_one_action (SwfdecSpriteMovie *movie, guint tag, Swf
SwfdecScript *script = swfdec_swf_decoder_get_script (
SWFDEC_SWF_DECODER (mov->resource->decoder), buffer->data);
if (script) {
- swfdec_player_add_action_script (player, mov, script, 2);
+ swfdec_player_add_action_script (player, actor, script, 2);
} else {
SWFDEC_ERROR ("Failed to locate script for DoAction tag");
}
@@ -466,7 +473,7 @@ swfdec_sprite_movie_perform_one_action (SwfdecSpriteMovie *movie, guint tag, Swf
sprite->init_action = swfdec_script_ref (swfdec_swf_decoder_get_script (
SWFDEC_SWF_DECODER (mov->resource->decoder), buffer->data + 2));
if (sprite->init_action) {
- swfdec_player_add_action_script (player, mov, sprite->init_action, 0);
+ swfdec_player_add_action_script (player, actor, sprite->init_action, 0);
} else {
SWFDEC_ERROR ("Failed to locate script for InitAction of Sprite %u", id);
}
@@ -602,7 +609,7 @@ swfdec_sprite_movie_goto (SwfdecSpriteMovie *movie, guint goto_frame)
klass->replace (prev, cur->graphic);
swfdec_movie_set_static_properties (prev, &cur->original_transform,
&cur->original_ctrans, cur->original_ratio, cur->clip_depth,
- cur->blend_mode, cur->events);
+ cur->blend_mode, SWFDEC_IS_ACTOR (cur) ? SWFDEC_ACTOR (cur)->events : NULL);
swfdec_movie_destroy (cur);
cur = prev;
continue;
@@ -665,7 +672,7 @@ swfdec_sprite_movie_iterate (SwfdecActor *actor)
if (movie->sprite && movie->frame == (guint) -1)
movie->frame = 0;
- swfdec_player_add_action (player, SWFDEC_MOVIE (actor), SWFDEC_EVENT_ENTER, 2);
+ swfdec_player_add_action (player, actor, SWFDEC_EVENT_ENTER, 2);
if (movie->playing && movie->sprite != NULL) {
if (movie->frame == movie->n_frames)
goto_frame = 1;
@@ -743,7 +750,7 @@ swfdec_sprite_movie_finish_movie (SwfdecMovie *mov)
SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (mov)->context);
- swfdec_player_remove_all_actions (player, mov);
+ swfdec_player_remove_all_actions (player, SWFDEC_ACTOR (mov));
if (movie->sound_stream) {
swfdec_audio_remove (movie->sound_stream);
g_object_unref (movie->sound_stream);
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 03f2a21..c5e1fb1 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -552,11 +552,11 @@ void
swfdec_sprite_movie_startDrag (SwfdecAsContext *cx, SwfdecAsObject *object,
guint argc, SwfdecAsValue *argv, SwfdecAsValue *rval)
{
- SwfdecMovie *movie;
+ SwfdecActor *actor;
SwfdecPlayer *player = SWFDEC_PLAYER (cx);
gboolean center = FALSE;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_ACTOR, &actor, "");
if (argc > 0) {
center = swfdec_as_value_to_boolean (cx, &argv[0]);
@@ -568,9 +568,9 @@ swfdec_sprite_movie_startDrag (SwfdecAsContext *cx, SwfdecAsObject *object,
rect.x1 = swfdec_as_value_to_number (cx, &argv[3]);
rect.y1 = swfdec_as_value_to_number (cx, &argv[4]);
swfdec_rect_scale (&rect, &rect, SWFDEC_TWIPS_SCALE_FACTOR);
- swfdec_player_set_drag_movie (player, movie, center, &rect);
+ swfdec_player_set_drag_movie (player, actor, center, &rect);
} else {
- swfdec_player_set_drag_movie (player, movie, center, NULL);
+ swfdec_player_set_drag_movie (player, actor, center, NULL);
}
}
@@ -672,11 +672,12 @@ swfdec_sprite_movie_init_from_object (SwfdecMovie *movie,
if (SWFDEC_IS_SPRITE_MOVIE (movie)) {
SwfdecSandbox *sandbox = movie->resource->sandbox;
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_INITIALIZE);
- swfdec_movie_queue_script (movie, SWFDEC_EVENT_LOAD);
+ SwfdecActor *actor = SWFDEC_ACTOR (movie);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_INITIALIZE);
+ swfdec_actor_queue_script (actor, SWFDEC_EVENT_LOAD);
swfdec_sandbox_unuse (sandbox);
swfdec_movie_initialize (movie);
- swfdec_movie_execute (movie, SWFDEC_EVENT_CONSTRUCT);
+ swfdec_actor_execute (actor, SWFDEC_EVENT_CONSTRUCT);
swfdec_sandbox_use (sandbox);
} else {
swfdec_movie_initialize (movie);
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index b646b6a..4d9baa1 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1307,7 +1307,7 @@ swfdec_text_field_movie_contains (SwfdecMovie *movie, double x, double y,
SwfdecMovie *ret;
ret = SWFDEC_MOVIE_CLASS (swfdec_text_field_movie_parent_class)->contains (
movie, x, y, TRUE);
- if (ret && ret != movie && swfdec_movie_get_mouse_events (ret))
+ if (ret && SWFDEC_IS_ACTOR (ret) && swfdec_actor_get_mouse_events (SWFDEC_ACTOR (ret)))
return ret;
}
@@ -1403,14 +1403,14 @@ swfdec_text_field_movie_xy_to_index (SwfdecTextFieldMovie *text, double x,
}
static SwfdecMouseCursor
-swfdec_text_field_movie_mouse_cursor (SwfdecMovie *movie)
+swfdec_text_field_movie_mouse_cursor (SwfdecActor *actor)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
double x, y;
guint index_;
SwfdecTextFormat *format;
- swfdec_movie_get_mouse (movie, &x, &y);
+ swfdec_movie_get_mouse (SWFDEC_MOVIE (actor), &x, &y);
if (swfdec_text_field_movie_xy_to_index (text, x, y, &index_, NULL)) {
format = swfdec_text_field_movie_format_for_index (text, index_);
@@ -1429,18 +1429,18 @@ swfdec_text_field_movie_mouse_cursor (SwfdecMovie *movie)
}
static gboolean
-swfdec_text_field_movie_mouse_events (SwfdecMovie *movie)
+swfdec_text_field_movie_mouse_events (SwfdecActor *actor)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
// FIXME: is this correct?
return (text->text->editable || text->text->selectable);
}
static void
-swfdec_text_field_movie_mouse_press (SwfdecMovie *movie, guint button)
+swfdec_text_field_movie_mouse_press (SwfdecActor *actor, guint button)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
double x, y;
guint index_;
gboolean direct, before;
@@ -1450,7 +1450,7 @@ swfdec_text_field_movie_mouse_press (SwfdecMovie *movie, guint button)
if (button != 0)
return;
- swfdec_movie_get_mouse (movie, &x, &y);
+ swfdec_movie_get_mouse (SWFDEC_MOVIE (actor), &x, &y);
direct = swfdec_text_field_movie_xy_to_index (text, x, y, &index_, &before);
@@ -1471,9 +1471,9 @@ swfdec_text_field_movie_mouse_press (SwfdecMovie *movie, guint button)
}
static void
-swfdec_text_field_movie_mouse_move (SwfdecMovie *movie, double x, double y)
+swfdec_text_field_movie_mouse_move (SwfdecActor *actor, double x, double y)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
guint index_;
gboolean direct, before;
@@ -1496,9 +1496,9 @@ swfdec_text_field_movie_mouse_move (SwfdecMovie *movie, double x, double y)
}
static void
-swfdec_text_field_movie_mouse_release (SwfdecMovie *movie, guint button)
+swfdec_text_field_movie_mouse_release (SwfdecActor *actor, guint button)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
double x, y;
guint index_;
gboolean direct, before;
@@ -1508,10 +1508,10 @@ swfdec_text_field_movie_mouse_release (SwfdecMovie *movie, guint button)
if (button != 0)
return;
- swfdec_movie_get_mouse (movie, &x, &y);
+ swfdec_movie_get_mouse (SWFDEC_MOVIE (text), &x, &y);
//FIXME
- swfdec_text_field_movie_mouse_move (movie, x, y);
+ swfdec_text_field_movie_mouse_move (actor, x, y);
text->mouse_pressed = FALSE;
@@ -1546,11 +1546,11 @@ swfdec_text_field_movie_class_init (SwfdecTextFieldMovieClass * g_class)
movie_class->invalidate = swfdec_text_field_movie_invalidate;
movie_class->contains = swfdec_text_field_movie_contains;
- movie_class->mouse_cursor = swfdec_text_field_movie_mouse_cursor;
- movie_class->mouse_events = swfdec_text_field_movie_mouse_events;
- movie_class->mouse_press = swfdec_text_field_movie_mouse_press;
- movie_class->mouse_release = swfdec_text_field_movie_mouse_release;
- movie_class->mouse_move = swfdec_text_field_movie_mouse_move;
+ actor_class->mouse_cursor = swfdec_text_field_movie_mouse_cursor;
+ actor_class->mouse_events = swfdec_text_field_movie_mouse_events;
+ actor_class->mouse_press = swfdec_text_field_movie_mouse_press;
+ actor_class->mouse_release = swfdec_text_field_movie_mouse_release;
+ actor_class->mouse_move = swfdec_text_field_movie_mouse_move;
actor_class->iterate_start = swfdec_text_field_movie_iterate;
}
commit 1a2ef08477d8fd43ac2e4371aeab6d3cd9bc3716
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Mar 31 16:20:02 2008 +0200
make invalidation handling work again
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 00d2af4..933fd93 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -86,7 +86,7 @@ swfdec_movie_init (SwfdecMovie * movie)
* if the old contents are invalidated.
*
* Performs an instant invalidation on @movie. You most likely don't want to
- * call this function directly, but use swfdec_movie_invalidate_last_last() or
+ * call this function directly, but use swfdec_movie_invalidate_last() or
* swfdec_movie_invalidate_next() instead.
**/
void
@@ -99,9 +99,12 @@ swfdec_movie_invalidate (SwfdecMovie *movie, const cairo_matrix_t *parent_to_glo
if (new_contents) {
movie->invalidate_next = FALSE;
} else {
+ SwfdecPlayer *player;
if (movie->invalidate_last)
return;
movie->invalidate_last = TRUE;
+ player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
+ player->priv->invalid_pending = g_slist_prepend (player->priv->invalid_pending, movie);
}
g_assert (movie->cache_state <= SWFDEC_MOVIE_INVALID_CHILDREN);
SWFDEC_LOG ("invalidating %s %s at %s", G_OBJECT_TYPE_NAME (movie),
@@ -137,7 +140,7 @@ swfdec_movie_invalidate_last (SwfdecMovie *movie)
}
/**
- * swfdec_movie_invalidate_last_next:
+ * swfdec_movie_invalidate_next:
* @movie: a #SwfdecMovie
*
* Ensures the movie will be invalidated after script execution is done. So
@@ -397,6 +400,8 @@ swfdec_movie_destroy (SwfdecMovie *movie)
if (klass->finish_movie)
klass->finish_movie (movie);
player->priv->actors = g_list_remove (player->priv->actors, movie);
+ if (movie->invalidate_last)
+ player->priv->invalid_pending = g_slist_remove (player->priv->invalid_pending, movie);
movie->state = SWFDEC_MOVIE_STATE_DESTROYED;
/* unset prototype here, so we don't work in AS anymore */
SWFDEC_AS_OBJECT (movie)->prototype = NULL;
@@ -1650,6 +1655,8 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
g_assert (SWFDEC_IS_SPRITE_MOVIE (movie));
resource->movie = SWFDEC_SPRITE_MOVIE (movie);
}
+ /* the movie is invalid already */
+ player->priv->invalid_pending = g_slist_prepend (player->priv->invalid_pending, movie);
return movie;
}
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index b9c1c22..32f47e9 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -969,6 +969,8 @@ swfdec_player_dispose (GObject *object)
g_slist_foreach (priv->policy_files, (GFunc) g_object_unref, NULL);
g_slist_free (priv->policy_files);
priv->policy_files = NULL;
+ g_slist_free (priv->invalid_pending);
+ priv->invalid_pending = NULL;
while (priv->roots)
swfdec_movie_destroy (priv->roots->data);
@@ -1655,26 +1657,28 @@ swfdec_player_update_drag_movie (SwfdecPlayer *player)
static void
swfdec_player_update_movies (SwfdecPlayer *player)
{
+ SwfdecPlayerPrivate *priv = player->priv;
SwfdecMovie *movie;
- GList *walk;
+ cairo_matrix_t matrix;
+ GSList *walk;
swfdec_player_update_drag_movie (player);
- /* FIXME: This g_list_last could be slow */
- for (walk = g_list_last (player->priv->actors); walk; walk = walk->prev) {
+ for (walk = priv->invalid_pending; walk; walk = walk->next) {
movie = walk->data;
swfdec_movie_update (movie);
- if (movie->invalidate_last) {
- cairo_matrix_t matrix;
-
- if (movie->parent)
- swfdec_movie_local_to_global_matrix (movie->parent, &matrix);
- else
- cairo_matrix_init_identity (&matrix);
- swfdec_movie_invalidate (movie, &matrix, TRUE);
- movie->invalidate_last = FALSE;
- }
+ g_assert (movie->invalidate_last);
+
+ if (movie->parent)
+ swfdec_movie_local_to_global_matrix (movie->parent, &matrix);
+ else
+ cairo_matrix_init_identity (&matrix);
+ swfdec_movie_invalidate (movie, &matrix, TRUE);
+ /* also clear invalidation flag from first invalidation */
+ movie->invalidate_last = FALSE;
}
+ g_slist_free (priv->invalid_pending);
+ priv->invalid_pending = NULL;
}
/* used for breakpoints */
diff --git a/swfdec/swfdec_player_internal.h b/swfdec/swfdec_player_internal.h
index 0d90409..716667a 100644
--- a/swfdec/swfdec_player_internal.h
+++ b/swfdec/swfdec_player_internal.h
@@ -103,6 +103,7 @@ struct _SwfdecPlayerPrivate
/* rendering */
SwfdecRectangle invalid_extents; /* extents of area that needs a redraw in global coordinates */
GArray * invalidations; /* fine-grained areas in need of redraw */
+ GSList * invalid_pending; /* pending invalidations due to invalidate_last */
/* mouse */
gboolean mouse_visible; /* show the mouse (actionscriptable) */
commit bc2beddf58e74c36f1d4ccbe4c19c51b57a6b312
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Mar 31 15:08:57 2008 +0200
make iteration actor-only
diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index 1a4cf3a..bc9d35f 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -27,9 +27,19 @@
G_DEFINE_ABSTRACT_TYPE (SwfdecActor, swfdec_actor, SWFDEC_TYPE_MOVIE)
+static gboolean
+swfdec_actor_iterate_end (SwfdecActor *actor)
+{
+ SwfdecMovie *movie = SWFDEC_MOVIE (actor);
+
+ return movie->parent == NULL ||
+ movie->state < SWFDEC_MOVIE_STATE_REMOVED;
+}
+
static void
swfdec_actor_class_init (SwfdecActorClass *klass)
{
+ klass->iterate_end = swfdec_actor_iterate_end;
}
static void
diff --git a/swfdec/swfdec_actor.h b/swfdec/swfdec_actor.h
index 8aacfcb..ad081c0 100644
--- a/swfdec/swfdec_actor.h
+++ b/swfdec/swfdec_actor.h
@@ -43,6 +43,10 @@ struct _SwfdecActor
struct _SwfdecActorClass
{
SwfdecMovieClass movie_class;
+
+ /* iterating */
+ void (* iterate_start) (SwfdecActor * actor);
+ gboolean (* iterate_end) (SwfdecActor * actor);
};
GType swfdec_actor_get_type (void);
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 7ddc6a6..00d2af4 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -396,7 +396,7 @@ swfdec_movie_destroy (SwfdecMovie *movie)
swfdec_player_remove_all_actions (player, movie);
if (klass->finish_movie)
klass->finish_movie (movie);
- player->priv->movies = g_list_remove (player->priv->movies, movie);
+ player->priv->actors = g_list_remove (player->priv->actors, movie);
movie->state = SWFDEC_MOVIE_STATE_DESTROYED;
/* unset prototype here, so we don't work in AS anymore */
SWFDEC_AS_OBJECT (movie)->prototype = NULL;
@@ -1290,13 +1290,6 @@ swfdec_movie_get_debug (SwfdecAsObject *object)
return swfdec_movie_get_path (movie, TRUE);
}
-static gboolean
-swfdec_movie_iterate_end (SwfdecMovie *movie)
-{
- return movie->parent == NULL ||
- movie->state < SWFDEC_MOVIE_STATE_REMOVED;
-}
-
typedef struct {
SwfdecMovie * movie;
int depth;
@@ -1511,7 +1504,6 @@ swfdec_movie_class_init (SwfdecMovieClass * movie_class)
movie_class->render = swfdec_movie_do_render;
movie_class->invalidate = swfdec_movie_do_invalidate;
movie_class->contains = swfdec_movie_do_contains;
- movie_class->iterate_end = swfdec_movie_iterate_end;
movie_class->mouse_events = swfdec_movie_mouse_events;
movie_class->mouse_in = swfdec_movie_mouse_in;
movie_class->mouse_out = swfdec_movie_mouse_out;
@@ -1648,7 +1640,8 @@ swfdec_movie_new (SwfdecPlayer *player, int depth, SwfdecMovie *parent, SwfdecRe
* Setting the parent does a gotoAndPlay(0) for Sprites which can cause
* new movies to be created (and added to this list)
*/
- player->priv->movies = g_list_prepend (player->priv->movies, movie);
+ if (SWFDEC_IS_ACTOR (movie))
+ player->priv->actors = g_list_prepend (player->priv->actors, movie);
/* only add the movie here, because it needs to be setup for the debugger */
swfdec_as_object_add (SWFDEC_AS_OBJECT (movie), SWFDEC_AS_CONTEXT (player), size);
swfdec_movie_set_version (movie);
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index 56d8d45..5371366 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -190,10 +190,6 @@ struct _SwfdecMovieClass {
void (* key_release) (SwfdecMovie * movie,
guint keycode,
guint character);
-
- /* iterating */
- void (* iterate_start) (SwfdecMovie * movie);
- gboolean (* iterate_end) (SwfdecMovie * movie);
};
GType swfdec_movie_get_type (void);
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index cbddd01..b9c1c22 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -999,7 +999,7 @@ swfdec_player_dispose (GObject *object)
for (i = 0; i < SWFDEC_PLAYER_N_ACTION_QUEUES; i++) {
swfdec_ring_buffer_free (priv->actions[i]);
}
- g_assert (priv->movies == NULL);
+ g_assert (priv->actors == NULL);
g_assert (priv->audio == NULL);
g_slist_free (priv->sandboxes);
if (priv->external_timeout.callback)
@@ -1259,7 +1259,7 @@ swfdec_player_do_mouse_move (SwfdecPlayer *player, double x, double y)
if (priv->mouse_x != x || priv->mouse_y != y) {
priv->mouse_x = x;
priv->mouse_y = y;
- for (walk = priv->movies; walk; walk = walk->next) {
+ for (walk = priv->actors; walk; walk = walk->next) {
swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_MOVE);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseMove, 0, NULL);
@@ -1285,7 +1285,7 @@ swfdec_player_do_mouse_press (SwfdecPlayer *player, guint button)
priv->mouse_button |= 1 << button;
if (button == 0) {
- for (walk = priv->movies; walk; walk = walk->next) {
+ for (walk = priv->actors; walk; walk = walk->next) {
swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_DOWN);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseDown, 0, NULL);
@@ -1308,7 +1308,7 @@ swfdec_player_do_mouse_release (SwfdecPlayer *player, guint button)
priv->mouse_button &= ~(1 << button);
if (button == 0) {
- for (walk = priv->movies; walk; walk = walk->next) {
+ for (walk = priv->actors; walk; walk = walk->next) {
swfdec_movie_queue_script (walk->data, SWFDEC_EVENT_MOUSE_UP);
}
swfdec_player_broadcast (player, SWFDEC_AS_STR_Mouse, SWFDEC_AS_STR_onMouseUp, 0, NULL);
@@ -1480,7 +1480,7 @@ swfdec_player_execute_on_load_init (SwfdecPlayer *player)
/* FIXME: This can be made a LOT faster with correct caching, but I'm lazy */
do {
- for (walk = player->priv->movies; walk; walk = walk->next) {
+ for (walk = player->priv->actors; walk; walk = walk->next) {
SwfdecMovie *movie = walk->data;
SwfdecResource *resource = swfdec_movie_get_own_resource (movie);
if (resource == NULL)
@@ -1507,21 +1507,21 @@ swfdec_player_iterate (SwfdecTimeout *timeout)
/* start the iteration. This performs a goto next frame on all
* movies that are not stopped. It also queues onEnterFrame.
*/
- for (walk = priv->movies; walk; walk = walk->next) {
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (walk->data);
+ for (walk = priv->actors; walk; walk = walk->next) {
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (walk->data);
if (klass->iterate_start)
klass->iterate_start (walk->data);
}
swfdec_player_perform_actions (player);
SWFDEC_INFO ("=== STOP ITERATION ===");
/* this loop allows removal of walk->data */
- walk = priv->movies;
+ walk = priv->actors;
while (walk) {
SwfdecMovie *cur = walk->data;
- SwfdecMovieClass *klass = SWFDEC_MOVIE_GET_CLASS (cur);
+ SwfdecActorClass *klass = SWFDEC_ACTOR_GET_CLASS (cur);
walk = walk->next;
g_assert (klass->iterate_end);
- if (!klass->iterate_end (cur))
+ if (!klass->iterate_end (SWFDEC_ACTOR (cur)))
swfdec_movie_destroy (cur);
}
swfdec_player_execute_on_load_init (player);
@@ -1660,7 +1660,7 @@ swfdec_player_update_movies (SwfdecPlayer *player)
swfdec_player_update_drag_movie (player);
/* FIXME: This g_list_last could be slow */
- for (walk = g_list_last (player->priv->movies); walk; walk = walk->prev) {
+ for (walk = g_list_last (player->priv->actors); walk; walk = walk->prev) {
movie = walk->data;
swfdec_movie_update (movie);
diff --git a/swfdec/swfdec_player_internal.h b/swfdec/swfdec_player_internal.h
index 9987708..0d90409 100644
--- a/swfdec/swfdec_player_internal.h
+++ b/swfdec/swfdec_player_internal.h
@@ -140,7 +140,7 @@ struct _SwfdecPlayerPrivate
SwfdecRingBuffer * external_actions; /* external actions we've queued up, like resize or loader stuff */
SwfdecTimeout external_timeout; /* callback for iterating */
/* iterating */
- GList * movies; /* list of all movies that want to be iterated */
+ GList * actors; /* list of all SwfdecActor isntances active in this player */
SwfdecRingBuffer * actions[SWFDEC_PLAYER_N_ACTION_QUEUES]; /* all actions we've queued up so far */
/* security */
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index e924778..1b37094 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -653,19 +653,19 @@ swfdec_sprite_movie_add (SwfdecAsObject *object)
}
static void
-swfdec_sprite_movie_iterate (SwfdecMovie *mov)
+swfdec_sprite_movie_iterate (SwfdecActor *actor)
{
- SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
- SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (mov)->context);
+ SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (actor);
+ SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context);
guint goto_frame;
- if (mov->state >= SWFDEC_MOVIE_STATE_REMOVED)
+ if (SWFDEC_MOVIE (actor)->state >= SWFDEC_MOVIE_STATE_REMOVED)
return;
if (movie->sprite && movie->frame == (guint) -1)
movie->frame = 0;
- swfdec_player_add_action (player, mov, SWFDEC_EVENT_ENTER, 2);
+ swfdec_player_add_action (player, SWFDEC_MOVIE (actor), SWFDEC_EVENT_ENTER, 2);
if (movie->playing && movie->sprite != NULL) {
if (movie->frame == movie->n_frames)
goto_frame = 1;
@@ -679,14 +679,14 @@ swfdec_sprite_movie_iterate (SwfdecMovie *mov)
/* FIXME: This function is a mess */
static gboolean
-swfdec_sprite_movie_iterate_end (SwfdecMovie *mov)
+swfdec_sprite_movie_iterate_end (SwfdecActor *actor)
{
- SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
+ SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (actor);
SwfdecSpriteFrame *last;
SwfdecSpriteFrame *current;
- SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (mov)->context);
+ SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context);
- if (!SWFDEC_MOVIE_CLASS (swfdec_sprite_movie_parent_class)->iterate_end (mov))
+ if (!SWFDEC_ACTOR_CLASS (swfdec_sprite_movie_parent_class)->iterate_end (actor))
return FALSE;
if (movie->sprite == NULL)
@@ -771,6 +771,7 @@ swfdec_sprite_movie_class_init (SwfdecSpriteMovieClass * g_class)
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
SwfdecAsObjectClass *asobject_class = SWFDEC_AS_OBJECT_CLASS (g_class);
SwfdecMovieClass *movie_class = SWFDEC_MOVIE_CLASS (g_class);
+ SwfdecActorClass *actor_class = SWFDEC_ACTOR_CLASS (g_class);
object_class->dispose = swfdec_sprite_movie_dispose;
@@ -779,8 +780,9 @@ swfdec_sprite_movie_class_init (SwfdecSpriteMovieClass * g_class)
movie_class->init_movie = swfdec_sprite_movie_init_movie;
movie_class->finish_movie = swfdec_sprite_movie_finish_movie;
- movie_class->iterate_start = swfdec_sprite_movie_iterate;
- movie_class->iterate_end = swfdec_sprite_movie_iterate_end;
+
+ actor_class->iterate_start = swfdec_sprite_movie_iterate;
+ actor_class->iterate_end = swfdec_sprite_movie_iterate_end;
}
static void
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index b278d76..b646b6a 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -1278,20 +1278,20 @@ swfdec_text_field_movie_finish_movie (SwfdecMovie *movie)
}
static void
-swfdec_text_field_movie_iterate (SwfdecMovie *movie)
+swfdec_text_field_movie_iterate (SwfdecActor *actor)
{
- SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (movie);
+ SwfdecTextFieldMovie *text = SWFDEC_TEXT_FIELD_MOVIE (actor);
if (text->scroll_changed) {
SwfdecAsValue argv[2];
SWFDEC_FIXME ("I'm pretty sure this is swfdec_player_add_action()'d");
SWFDEC_AS_VALUE_SET_STRING (&argv[0], SWFDEC_AS_STR_onScroller);
- SWFDEC_AS_VALUE_SET_OBJECT (&argv[1], SWFDEC_AS_OBJECT (movie));
- swfdec_sandbox_use (movie->resource->sandbox);
- swfdec_as_object_call (SWFDEC_AS_OBJECT (movie),
+ SWFDEC_AS_VALUE_SET_OBJECT (&argv[1], SWFDEC_AS_OBJECT (text));
+ swfdec_sandbox_use (SWFDEC_MOVIE (actor)->resource->sandbox);
+ swfdec_as_object_call (SWFDEC_AS_OBJECT (text),
SWFDEC_AS_STR_broadcastMessage, 2, argv, NULL);
- swfdec_sandbox_unuse (movie->resource->sandbox);
+ swfdec_sandbox_unuse (SWFDEC_MOVIE (actor)->resource->sandbox);
/* FIXME: unset this before or after emitting the event? */
text->scroll_changed = FALSE;
@@ -1533,6 +1533,7 @@ swfdec_text_field_movie_class_init (SwfdecTextFieldMovieClass * g_class)
GObjectClass *object_class = G_OBJECT_CLASS (g_class);
SwfdecAsObjectClass *asobject_class = SWFDEC_AS_OBJECT_CLASS (g_class);
SwfdecMovieClass *movie_class = SWFDEC_MOVIE_CLASS (g_class);
+ SwfdecActorClass *actor_class = SWFDEC_ACTOR_CLASS (g_class);
object_class->dispose = swfdec_text_field_movie_dispose;
@@ -1540,7 +1541,6 @@ swfdec_text_field_movie_class_init (SwfdecTextFieldMovieClass * g_class)
movie_class->init_movie = swfdec_text_field_movie_init_movie;
movie_class->finish_movie = swfdec_text_field_movie_finish_movie;
- movie_class->iterate_start = swfdec_text_field_movie_iterate;
movie_class->update_extents = swfdec_text_field_movie_update_extents;
movie_class->render = swfdec_text_field_movie_render;
movie_class->invalidate = swfdec_text_field_movie_invalidate;
@@ -1551,6 +1551,8 @@ swfdec_text_field_movie_class_init (SwfdecTextFieldMovieClass * g_class)
movie_class->mouse_press = swfdec_text_field_movie_mouse_press;
movie_class->mouse_release = swfdec_text_field_movie_mouse_release;
movie_class->mouse_move = swfdec_text_field_movie_mouse_move;
+
+ actor_class->iterate_start = swfdec_text_field_movie_iterate;
}
static void
commit 7b3a22a70a6a597766e184cdd6057c81bb97e79b
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Mar 31 14:09:50 2008 +0200
make button, textfield and sprite instances share a common subclass: SwfdecActor
This gives us way better possibilities to differentiate between "just" graphics
and acting objects
diff --git a/swfdec/Makefile.am b/swfdec/Makefile.am
index aacb161..016c2a9 100644
--- a/swfdec/Makefile.am
+++ b/swfdec/Makefile.am
@@ -17,6 +17,8 @@ lib_LTLIBRARIES = libswfdec- at SWFDEC_MAJORMINOR@.la
# these are files that must be in SRCDIR
libswfdec_source_files = \
swfdec_accessibility.c \
+ swfdec_actor.c \
+ swfdec_amf.c \
swfdec_as_array.c \
swfdec_as_boolean.c \
swfdec_as_context.c \
@@ -35,7 +37,6 @@ libswfdec_source_files = \
swfdec_as_strings.c \
swfdec_as_super.c \
swfdec_as_types.c \
- swfdec_amf.c \
swfdec_asbroadcaster.c \
swfdec_audio.c \
swfdec_audio_event.c \
@@ -205,6 +206,8 @@ libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINO
libswfdec_ at SWFDEC_MAJORMINOR@include_HEADERS = $(public_headers) swfdec_enums.h
noinst_HEADERS = \
+ swfdec_actor.h \
+ swfdec_amf.h \
swfdec_as_boolean.h \
swfdec_as_frame_internal.h \
swfdec_as_initialize.h \
@@ -218,7 +221,6 @@ noinst_HEADERS = \
swfdec_as_strings.h \
swfdec_as_super.h \
swfdec_asnative.h \
- swfdec_amf.h \
swfdec_audio_internal.h \
swfdec_audio_event.h \
swfdec_audio_flv.h \
diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
new file mode 100644
index 0000000..1a4cf3a
--- /dev/null
+++ b/swfdec/swfdec_actor.c
@@ -0,0 +1,39 @@
+/* Swfdec
+ * Copyright (C) 2006-2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "swfdec_actor.h"
+#include "swfdec_debug.h"
+
+
+G_DEFINE_ABSTRACT_TYPE (SwfdecActor, swfdec_actor, SWFDEC_TYPE_MOVIE)
+
+static void
+swfdec_actor_class_init (SwfdecActorClass *klass)
+{
+}
+
+static void
+swfdec_actor_init (SwfdecActor *actor)
+{
+}
+
diff --git a/swfdec/swfdec_actor.h b/swfdec/swfdec_actor.h
new file mode 100644
index 0000000..8aacfcb
--- /dev/null
+++ b/swfdec/swfdec_actor.h
@@ -0,0 +1,52 @@
+/* Swfdec
+ * Copyright (C) 2006-2008 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef _SWFDEC_ACTOR_H_
+#define _SWFDEC_ACTOR_H_
+
+#include <swfdec/swfdec_movie.h>
+
+G_BEGIN_DECLS
+
+
+//typedef struct _SwfdecActor SwfdecActor;
+typedef struct _SwfdecActorClass SwfdecActorClass;
+
+#define SWFDEC_TYPE_ACTOR (swfdec_actor_get_type())
+#define SWFDEC_IS_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_ACTOR))
+#define SWFDEC_IS_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_ACTOR))
+#define SWFDEC_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_ACTOR, SwfdecActor))
+#define SWFDEC_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_ACTOR, SwfdecActorClass))
+#define SWFDEC_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_ACTOR, SwfdecActorClass))
+
+struct _SwfdecActor
+{
+ SwfdecMovie movie;
+};
+
+struct _SwfdecActorClass
+{
+ SwfdecMovieClass movie_class;
+};
+
+GType swfdec_actor_get_type (void);
+
+
+G_END_DECLS
+#endif
diff --git a/swfdec/swfdec_button_movie.c b/swfdec/swfdec_button_movie.c
index e7ccdba..ce11891 100644
--- a/swfdec/swfdec_button_movie.c
+++ b/swfdec/swfdec_button_movie.c
@@ -30,7 +30,7 @@
#include "swfdec_player_internal.h"
#include "swfdec_resource.h"
-G_DEFINE_TYPE (SwfdecButtonMovie, swfdec_button_movie, SWFDEC_TYPE_MOVIE)
+G_DEFINE_TYPE (SwfdecButtonMovie, swfdec_button_movie, SWFDEC_TYPE_ACTOR)
static void
swfdec_button_movie_update_extents (SwfdecMovie *movie,
diff --git a/swfdec/swfdec_button_movie.h b/swfdec/swfdec_button_movie.h
index 3c3ded4..59a3db6 100644
--- a/swfdec/swfdec_button_movie.h
+++ b/swfdec/swfdec_button_movie.h
@@ -21,7 +21,7 @@
#define _SWFDEC_BUTTON_MOVIE_H_
#include <glib-object.h>
-#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_actor.h>
#include <swfdec/swfdec_button.h>
G_BEGIN_DECLS
@@ -37,14 +37,14 @@ typedef struct _SwfdecButtonMovieClass SwfdecButtonMovieClass;
#define SWFDEC_BUTTON_MOVIE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_BUTTON_MOVIE, SwfdecButtonMovieClass))
struct _SwfdecButtonMovie {
- SwfdecMovie movie;
+ SwfdecActor actor;
SwfdecButton * button; /* button we render */
SwfdecButtonState state; /* current state we're in */
};
struct _SwfdecButtonMovieClass {
- SwfdecMovieClass movie_class;
+ SwfdecActorClass actor_class;
};
GType swfdec_button_movie_get_type (void);
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 16f90a2..7ddc6a6 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1,5 +1,5 @@
/* Swfdec
- * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
+ * Copyright (C) 2006-2008 Benjamin Otte <otte at gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/swfdec/swfdec_movie.h b/swfdec/swfdec_movie.h
index 125f4be..56d8d45 100644
--- a/swfdec/swfdec_movie.h
+++ b/swfdec/swfdec_movie.h
@@ -1,5 +1,5 @@
/* Swfdec
- * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
+ * Copyright (C) 2006-2008 Benjamin Otte <otte at gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index f6bc003..e924778 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -619,7 +619,7 @@ out:
/*** MOVIE ***/
-G_DEFINE_TYPE (SwfdecSpriteMovie, swfdec_sprite_movie, SWFDEC_TYPE_MOVIE)
+G_DEFINE_TYPE (SwfdecSpriteMovie, swfdec_sprite_movie, SWFDEC_TYPE_ACTOR)
static void
swfdec_sprite_movie_dispose (GObject *object)
diff --git a/swfdec/swfdec_sprite_movie.h b/swfdec/swfdec_sprite_movie.h
index 93fe320..aa409e8 100644
--- a/swfdec/swfdec_sprite_movie.h
+++ b/swfdec/swfdec_sprite_movie.h
@@ -20,7 +20,7 @@
#ifndef _SWFDEC_SPRITE_MOVIE_H_
#define _SWFDEC_SPRITE_MOVIE_H_
-#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_actor.h>
#include <swfdec/swfdec_audio.h>
#include <swfdec/swfdec_types.h>
@@ -38,7 +38,7 @@ typedef struct _SwfdecSpriteMovieClass SwfdecSpriteMovieClass;
struct _SwfdecSpriteMovie
{
- SwfdecMovie movie;
+ SwfdecActor actor;
SwfdecSprite * sprite; /* displayed sprite */
@@ -59,7 +59,7 @@ struct _SwfdecSpriteMovie
struct _SwfdecSpriteMovieClass
{
- SwfdecMovieClass movie_class;
+ SwfdecActorClass actor_class;
};
GType swfdec_sprite_movie_get_type (void);
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index bad9ac4..b278d76 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -37,7 +37,7 @@
#include "swfdec_text_format.h"
#include "swfdec_xml.h"
-G_DEFINE_TYPE (SwfdecTextFieldMovie, swfdec_text_field_movie, SWFDEC_TYPE_MOVIE)
+G_DEFINE_TYPE (SwfdecTextFieldMovie, swfdec_text_field_movie, SWFDEC_TYPE_ACTOR)
#define EXTRA_MARGIN 2
#define BULLET_MARGIN 36
diff --git a/swfdec/swfdec_text_field_movie.h b/swfdec/swfdec_text_field_movie.h
index f5d95bd..e070207 100644
--- a/swfdec/swfdec_text_field_movie.h
+++ b/swfdec/swfdec_text_field_movie.h
@@ -21,7 +21,7 @@
#ifndef _SWFDEC_TEXT_FIELD_MOVIE_H_
#define _SWFDEC_TEXT_FIELD_MOVIE_H_
-#include <swfdec/swfdec_movie.h>
+#include <swfdec/swfdec_actor.h>
#include <swfdec/swfdec_text_field.h>
#include <swfdec/swfdec_style_sheet.h>
#include <swfdec/swfdec_text_format.h>
@@ -85,7 +85,7 @@ typedef struct {
} SwfdecFormatIndex;
struct _SwfdecTextFieldMovie {
- SwfdecMovie movie;
+ SwfdecActor actor;
SwfdecTextField * text; /* the text_field object we render */
@@ -130,7 +130,7 @@ struct _SwfdecTextFieldMovie {
};
struct _SwfdecTextFieldMovieClass {
- SwfdecMovieClass movie_class;
+ SwfdecActorClass actor_class;
};
GType swfdec_text_field_movie_get_type (void);
diff --git a/swfdec/swfdec_types.h b/swfdec/swfdec_types.h
index d484396..eafb4f3 100644
--- a/swfdec/swfdec_types.h
+++ b/swfdec/swfdec_types.h
@@ -31,6 +31,7 @@ typedef int SwfdecFixed;
#define SWFDEC_FIXED_TO_INT(f) ((f) / SWFDEC_FIXED_SCALE_FACTOR)
#define SWFDEC_INT_TO_FIXED(i) ((i) * SWFDEC_FIXED_SCALE_FACTOR)
+typedef struct _SwfdecActor SwfdecActor;
typedef struct _SwfdecButton SwfdecButton;
typedef struct _SwfdecCache SwfdecCache;
typedef struct _SwfdecCacheHandle SwfdecCacheHandle;
More information about the Swfdec-commits
mailing list