[clutter/wip/action-handle-event: 4/6] actor: Allow actions to handle events before capture/bubble



commit df592e83053836c20df5185d18aa23e4aef6215a
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Jun 24 11:49:03 2012 +0100

    actor: Allow actions to handle events before capture/bubble
    
    ClutterAction should have a separate event handling cycle, to avoid
    connecting to signals and thus relying on undefined implicit ordering,
    as opposed to the actual addition order.

 clutter/clutter-actor.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 12d5fda..cd08e48 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -594,7 +594,7 @@
 
 #include "clutter-actor-private.h"
 
-#include "clutter-action.h"
+#include "clutter-action-private.h"
 #include "clutter-actor-meta-private.h"
 #include "clutter-animatable.h"
 #include "clutter-color-static.h"
@@ -18925,6 +18925,26 @@ _clutter_actor_handle_event (ClutterActor       *self,
       iter = parent;
     }
 
+  /* we run the actions attached to an actor before capture/bubble; this
+   * allows the actions to have control over the event emission chain
+   * without interfering with it, and without relying on implicit or
+   * undefined ordering.
+   */
+  if (self->priv->actions != NULL)
+    {
+      const GList *l;
+
+      for (l = _clutter_meta_group_peek_metas (self->priv->actions);
+           l != NULL;
+           l = l->next)
+        {
+          ClutterAction *action = l->data;
+
+          if (clutter_actor_meta_get_enabled (l->data))
+            _clutter_action_handle_event (action, event);
+        }
+    }
+
   /* Capture: from top-level downwards */
   for (i = event_tree->len - 1; i >= 0; i--)
     if (clutter_actor_event (g_ptr_array_index (event_tree, i), event, TRUE))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]