diff --git a/clutter/clutter/clutter-pick-context-private.h b/clutter/clutter/clutter-pick-context-private.h index cfbfce6eb..cc8baf881 100644 --- a/clutter/clutter/clutter-pick-context-private.h +++ b/clutter/clutter/clutter-pick-context-private.h @@ -21,8 +21,11 @@ #include "clutter-pick-context.h" #include "clutter-pick-stack-private.h" -ClutterPickContext * clutter_pick_context_new_for_view (ClutterStageView *view, - ClutterPickMode mode); +ClutterPickContext * +clutter_pick_context_new_for_view (ClutterStageView *view, + ClutterPickMode mode, + const graphene_point3d_t *point, + const graphene_ray_t *ray); ClutterPickStack * clutter_pick_context_steal_stack (ClutterPickContext *pick_context); diff --git a/clutter/clutter/clutter-pick-context.c b/clutter/clutter/clutter-pick-context.c index 4e6fb7a88..b9758366d 100644 --- a/clutter/clutter/clutter-pick-context.c +++ b/clutter/clutter/clutter-pick-context.c @@ -26,6 +26,9 @@ struct _ClutterPickContext ClutterPickMode mode; ClutterPickStack *pick_stack; + + graphene_ray_t ray; + graphene_point3d_t point; }; G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context, @@ -33,8 +36,10 @@ G_DEFINE_BOXED_TYPE (ClutterPickContext, clutter_pick_context, clutter_pick_context_unref) ClutterPickContext * -clutter_pick_context_new_for_view (ClutterStageView *view, - ClutterPickMode mode) +clutter_pick_context_new_for_view (ClutterStageView *view, + ClutterPickMode mode, + const graphene_point3d_t *point, + const graphene_ray_t *ray) { ClutterPickContext *pick_context; CoglContext *context; @@ -42,6 +47,8 @@ clutter_pick_context_new_for_view (ClutterStageView *view, pick_context = g_new0 (ClutterPickContext, 1); g_ref_count_init (&pick_context->ref_count); pick_context->mode = mode; + graphene_ray_init_from_ray (&pick_context->ray, ray); + graphene_point3d_init_from_point (&pick_context->point, point); context = clutter_backend_get_cogl_context (clutter_get_default_backend ()); pick_context->pick_stack = clutter_pick_stack_new (context); diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 3d2edf95e..f520e3b23 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -1088,14 +1088,14 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage, COGL_TRACE_BEGIN_SCOPED (ClutterStagePickView, "Pick (view)"); - pick_context = clutter_pick_context_new_for_view (view, mode); + setup_ray_for_coordinates (stage, x, y, &p, &ray); + + pick_context = clutter_pick_context_new_for_view (view, mode, &p, &ray); clutter_actor_pick (CLUTTER_ACTOR (stage), pick_context); pick_stack = clutter_pick_context_steal_stack (pick_context); clutter_pick_context_destroy (pick_context); - setup_ray_for_coordinates (stage, x, y, &p, &ray); - actor = clutter_pick_stack_search_actor (pick_stack, &p, &ray); return actor ? actor : CLUTTER_ACTOR (stage); }