summaryrefslogtreecommitdiff
path: root/clutter/clutter-main.c
diff options
context:
space:
mode:
authorLionel Landwerlin <llandwerlin@gmail.com>2012-07-11 16:21:28 +0100
committerLionel Landwerlin <llandwerlin@gmail.com>2012-07-17 21:49:26 +0100
commit9e02ef459e936cf143cc956337c74e59260a6f16 (patch)
tree05474e309f2064387a735e8537ebf5ed837d137a /clutter/clutter-main.c
parent6eef8ea0422de0dd54780eb584f7ca46d5412dec (diff)
downloadclutter-9e02ef459e936cf143cc956337c74e59260a6f16.tar.gz
input-device: add enter/leave events generation for touch events
This patch brings 'enter-event' and 'leave-event' generation for touch based devices. This leads to adding a new API to retrieve coordinates of a touch point. https://bugzilla.gnome.org/show_bug.cgi?id=679797
Diffstat (limited to 'clutter/clutter-main.c')
-rw-r--r--clutter/clutter-main.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 14c92f825..f7c353692 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2420,9 +2420,7 @@ _clutter_process_event_details (ClutterActor *stage,
ClutterMainContext *context,
ClutterEvent *event)
{
- ClutterInputDevice *device = NULL;
-
- device = clutter_event_get_device (event);
+ ClutterInputDevice *device = clutter_event_get_device (event);
switch (event->type)
{
@@ -2463,7 +2461,7 @@ _clutter_process_event_details (ClutterActor *stage,
emit_pointer_event (event, device);
- actor = _clutter_input_device_update (device, FALSE);
+ actor = _clutter_input_device_update (device, NULL, FALSE);
if (actor != stage)
{
ClutterEvent *crossing;
@@ -2597,7 +2595,7 @@ _clutter_process_event_details (ClutterActor *stage,
* get the actor underneath
*/
if (device != NULL)
- actor = _clutter_input_device_update (device, TRUE);
+ actor = _clutter_input_device_update (device, NULL, TRUE);
else
{
CLUTTER_NOTE (EVENT, "No device found: picking");
@@ -2640,8 +2638,15 @@ _clutter_process_event_details (ClutterActor *stage,
case CLUTTER_TOUCH_END:
{
ClutterActor *actor;
+ ClutterEventSequence *sequence;
gfloat x, y;
+ sequence =
+ clutter_event_get_event_sequence (event);
+
+ if (event->type == CLUTTER_TOUCH_BEGIN)
+ _clutter_input_device_add_sequence (device, sequence);
+
clutter_event_get_coords (event, &x, &y);
/* Only do a pick to find the source if source is not already set
@@ -2649,9 +2654,13 @@ _clutter_process_event_details (ClutterActor *stage,
*/
if (event->any.source == NULL)
{
- actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
- x, y,
- CLUTTER_PICK_REACTIVE);
+ if (device != NULL)
+ actor = _clutter_input_device_update (device, sequence, TRUE);
+ else
+ actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
+ x, y,
+ CLUTTER_PICK_REACTIVE);
+
if (actor == NULL)
break;
@@ -2669,6 +2678,10 @@ _clutter_process_event_details (ClutterActor *stage,
actor);
emit_touch_event (event, device);
+
+ if (event->type == CLUTTER_TOUCH_END)
+ _clutter_input_device_remove_sequence (device, sequence);
+
break;
}