[clutter/wip/touch-events: 1/2] event: Deliver touch events to actors
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/touch-events: 1/2] event: Deliver touch events to actors
- Date: Mon, 4 Jun 2012 08:32:53 +0000 (UTC)
commit d689eca5068ee4574950fc592ebf8fdea3e07b55
Author: Tomeu Vizoso <tomeu vizoso collabora com>
Date: Mon Jun 4 10:28:19 2012 +0200
event: Deliver touch events to actors
clutter/clutter-main.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c
index 7e4bef8..7ccf9c8 100644
--- a/clutter/clutter-main.c
+++ b/clutter/clutter-main.c
@@ -2614,6 +2614,86 @@ _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)
+ {
+ /* emulate X11 the implicit soft grab; the implicit soft grab
+ * keeps relaying motion events when the stage is left with a
+ * pointer button pressed. since this is what happens when we
+ * disable per-actor motion events we need to maintain the same
+ * behaviour when the per-actor motion events are enabled as
+ * well
+ */
+ if (is_off_stage (stage, x, y))
+ {
+ if (event->type == CLUTTER_TOUCH_END)
+ {
+ CLUTTER_NOTE (EVENT,
+ "Touch end off stage received at %.2f, %.2f",
+ x, y);
+
+ event->button.source = stage;
+ event->button.click_count = 1;
+
+ emit_pointer_event (event, device);
+ }
+ else if (event->type == CLUTTER_TOUCH_UPDATE)
+ {
+ CLUTTER_NOTE (EVENT,
+ "Touch update off stage received at %.2f, %2.f",
+ x, y);
+
+ event->motion.source = stage;
+
+ emit_pointer_event (event, device);
+ }
+
+ break;
+ }
+
+ /* if the backend provides a device then we should
+ * already have everything we need to update it and
+ * get the actor underneath
+ */
+ if (device != NULL)
+ actor = _clutter_input_device_update (device, TRUE);
+ else
+ {
+ CLUTTER_NOTE (EVENT, "No device found: picking");
+
+ 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]