[clutter] events: honour clutter_stage_set_motion_events_enabled() for touch events



commit 86e064597e951a3c4d9864c7e7403256d13f5329
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Sat Jul 28 15:36:23 2012 +0200

    events: honour clutter_stage_set_motion_events_enabled() for touch events
    
    When dragging/scrolling using touch events, we want the same behaviour
    than for motion events. We need to honor the user's calls to
    clutter_stage_set_motion_events_enabled() to deactive event
    bubbling/captured sequences on the actor located under the pointer and
    just transmit events to the stage/grab actor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680751

 clutter/clutter-main.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index f7c3536..179db68 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2633,8 +2633,40 @@ _clutter_process_event_details (ClutterActor        *stage,
           break;
         }
 
-      case CLUTTER_TOUCH_BEGIN:
       case CLUTTER_TOUCH_UPDATE:
+        /* only the stage gets motion events if they are enabled */
+        if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
+            event->any.source == NULL)
+          {
+            ClutterActor *grab_actor = NULL;
+
+            /* Only stage gets motion events */
+            event->any.source = stage;
+
+            /* global grabs */
+            if (device->sequence_grab_actors != NULL)
+              {
+                grab_actor = g_hash_table_lookup (device->sequence_grab_actors,
+                                                  event->touch.sequence);
+              }
+
+            if (grab_actor != NULL)
+              {
+                clutter_actor_event (grab_actor, event, FALSE);
+                break;
+              }
+
+            /* Trigger handlers on stage in both capture .. */
+            if (!clutter_actor_event (stage, event, TRUE))
+              {
+                /* and bubbling phase */
+                clutter_actor_event (stage, event, FALSE);
+              }
+            break;
+          }
+
+      /* fallthrough from motion */
+      case CLUTTER_TOUCH_BEGIN:
       case CLUTTER_TOUCH_END:
         {
           ClutterActor *actor;



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