From f88fb9dc12918da8e83c9ba2ea30cc8e8bf750f7 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 20 Nov 2006 12:53:13 +0100 Subject: [PATCH] Fix mouse notifications when objects move - fixes asserts in dragged buttons --- libswfdec/swfdec_player.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index fe8c63aa..cebb4f4b 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -340,13 +340,6 @@ swfdec_player_do_iterate (SwfdecPlayer *player) } swfdec_player_perform_actions (player); SWFDEC_INFO ("=== STOP ITERATION ==="); - /* update the state of the mouse when stuff below it moved */ - if (swfdec_rect_contains (&player->invalid, player->mouse_x, player->mouse_y)) { - SWFDEC_INFO ("=== NEED TO UPDATE mouse post-iteration ==="); - swfdec_player_do_mouse_move (player); - swfdec_player_perform_actions (player); - SWFDEC_INFO ("=== DONE UPDATING mouse post-iteration ==="); - } /* this loop allows removal of walk->data */ walk = player->movies; while (walk) { @@ -367,13 +360,25 @@ void swfdec_player_perform_actions (SwfdecPlayer *player) { GList *walk; + SwfdecRect old_inval; g_return_if_fail (SWFDEC_IS_PLAYER (player)); - while (swfdec_player_do_action (player)); - for (walk = player->roots; walk; walk = walk->next) { - swfdec_movie_update (walk->data); - } + swfdec_rect_init_empty (&old_inval); + do { + while (swfdec_player_do_action (player)); + for (walk = player->roots; walk; walk = walk->next) { + swfdec_movie_update (walk->data); + } + /* update the state of the mouse when stuff below it moved */ + if (swfdec_rect_contains (&player->invalid, player->mouse_x, player->mouse_y)) { + SWFDEC_INFO ("=== NEED TO UPDATE mouse post-iteration ==="); + swfdec_player_do_mouse_move (player); + } + swfdec_rect_union (&old_inval, &old_inval, &player->invalid); + swfdec_rect_init_empty (&player->invalid); + } while (swfdec_ring_buffer_get_n_elements (player->actions) > 0); + player->invalid = old_inval; } void -- 2.11.4.GIT