From 86e064597e951a3c4d9864c7e7403256d13f5329 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sat, 28 Jul 2012 15:36:23 +0200 Subject: [PATCH] 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 file changed, 33 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index f7c353692..179db685d 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;