[clutter/android-enter-leave: 17/29] events: Deliver touch events to actors



commit e1629d58c806d267fed1fc58137808652f1dac8a
Author: Tomeu Vizoso <tomeu vizoso collabora com>
Date:   Mon Jun 4 11:15:13 2012 +0000

    events: Deliver touch events to actors
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677390

 clutter/clutter-main.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 42a60a2..b3fe63c 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2622,6 +2622,40 @@ _clutter_process_event_details (ClutterActor        *stage,
       case CLUTTER_TOUCH_BEGIN:
       case CLUTTER_TOUCH_UPDATE:
       case CLUTTER_TOUCH_END:
+        {
+          ClutterActor *actor;
+          gfloat x, y;
+
+          clutter_event_get_coords (event, &x, &y);
+
+          /* Only do a pick to find the source if source is not already set
+           * (as it could be in a synthetic event)
+           */
+          if (event->any.source == NULL)
+            {
+              actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
+                                              x, y,
+                                              CLUTTER_PICK_REACTIVE);
+              if (actor == NULL)
+                break;
+
+              event->any.source = actor;
+            }
+          else
+            {
+              /* use the source already set in the synthetic event */
+              actor = event->any.source;
+            }
+
+          CLUTTER_NOTE (EVENT,
+                        "Reactive event received at %.2f, %.2f - actor: %p",
+                        x, y,
+                        actor);
+
+          emit_pointer_event (event, device);
+          break;
+        }
+
       case CLUTTER_TOUCH_CANCEL:
         break;
 



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