diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index 741820187..912a05c01 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -65,12 +65,6 @@ typedef enum { CLUTTER_TEXTURE_IN_CLONE_PAINT = 1 << 6 /* Used for safety in clones */ } ClutterPrivateFlags; -typedef enum { - CLUTTER_PICK_NONE = 0, - CLUTTER_PICK_REACTIVE, - CLUTTER_PICK_ALL -} ClutterPickMode; - struct _ClutterInputDevice { gint id; diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index a9a7bf942..14b9505c3 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -1242,20 +1242,26 @@ clutter_stage_read_pixels (ClutterStage *stage, /** * clutter_stage_get_actor_at_pos: * @stage: a #ClutterStage + * @pick_mode: how the scene graph should be painted * @x: X coordinate to check * @y: Y coordinate to check * * Checks the scene at the coordinates @x and @y and returns a pointer * to the #ClutterActor at those coordinates. * - * Return value: (transfer none): the actor at the specified coordinates, if any + * By using @pick_mode it is possible to control which actors will be + * painted and thus available. + * + * Return value: (transfer none): the actor at the specified coordinates, + * if any */ ClutterActor * -clutter_stage_get_actor_at_pos (ClutterStage *stage, - gint x, - gint y) +clutter_stage_get_actor_at_pos (ClutterStage *stage, + ClutterPickMode pick_mode, + gint x, + gint y) { - return _clutter_do_pick (stage, x, y, CLUTTER_PICK_ALL); + return _clutter_do_pick (stage, x, y, pick_mode); } /** diff --git a/clutter/clutter-stage.h b/clutter/clutter-stage.h index d2001a9db..298443efe 100644 --- a/clutter/clutter-stage.h +++ b/clutter/clutter-stage.h @@ -79,6 +79,22 @@ G_BEGIN_DECLS #define CLUTTER_STAGE_HEIGHT() \ (clutter_actor_get_height (clutter_stage_get_default ())) +/** + * ClutterPickMode: + * @CLUTTER_PICK_NONE: Do not paint any actor + * @CLUTTER_PICK_REACTIVE: Paint only the reactive actors + * @CLUTTER_PICK_ALL: Paint all actors + * + * Controls the paint cycle of the scene graph when in pick mode + * + * Since: 1.0 + */ +typedef enum { + CLUTTER_PICK_NONE = 0, + CLUTTER_PICK_REACTIVE, + CLUTTER_PICK_ALL +} ClutterPickMode; + typedef struct _ClutterPerspective ClutterPerspective; typedef struct _ClutterFog ClutterFog; @@ -192,6 +208,7 @@ void clutter_stage_show_cursor (ClutterStage *stage); void clutter_stage_hide_cursor (ClutterStage *stage); ClutterActor *clutter_stage_get_actor_at_pos (ClutterStage *stage, + ClutterPickMode pick_mode, gint x, gint y); guchar * clutter_stage_read_pixels (ClutterStage *stage, diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt index 7d645072e..cd7df4967 100644 --- a/doc/reference/clutter/clutter-sections.txt +++ b/doc/reference/clutter/clutter-sections.txt @@ -496,6 +496,7 @@ clutter_stage_fullscreen clutter_stage_unfullscreen clutter_stage_show_cursor clutter_stage_hide_cursor +ClutterPickMode clutter_stage_get_actor_at_pos clutter_stage_ensure_current clutter_stage_ensure_viewport diff --git a/tests/conform/test-pick.c b/tests/conform/test-pick.c index 0001abeba..e85883748 100644 --- a/tests/conform/test-pick.c +++ b/tests/conform/test-pick.c @@ -68,6 +68,7 @@ on_timeout (State *state) guint32 gid; ClutterActor *actor = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (state->stage), + CLUTTER_PICK_ALL, x * state->actor_width + state->actor_width / 2, y * state->actor_height diff --git a/tests/interactive/test-actor-clone.c b/tests/interactive/test-actor-clone.c index fc595abc5..5aadbb042 100644 --- a/tests/interactive/test-actor-clone.c +++ b/tests/interactive/test-actor-clone.c @@ -57,7 +57,9 @@ input_cb (ClutterActor *stage, button_event->button, x, y); - e = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (stage), x, y); + e = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (stage), + CLUTTER_PICK_ALL, + x, y); /* only allow hiding the clones */ if (e && CLUTTER_IS_CLONE (e)) diff --git a/tests/interactive/test-actors.c b/tests/interactive/test-actors.c index 403931f1b..fcaa49275 100644 --- a/tests/interactive/test-actors.c +++ b/tests/interactive/test-actors.c @@ -57,7 +57,9 @@ input_cb (ClutterActor *stage, button_event->button, x, y); - e = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (stage), x, y); + e = clutter_stage_get_actor_at_pos (CLUTTER_STAGE (stage), + CLUTTER_PICK_ALL, + x, y); /* only allow hiding the clones */ if (e && (CLUTTER_IS_TEXTURE (e) || CLUTTER_IS_CLONE (e))) diff --git a/tests/interactive/test-paint-wrapper.c b/tests/interactive/test-paint-wrapper.c index 0a7f7550e..ac650d6c8 100644 --- a/tests/interactive/test-paint-wrapper.c +++ b/tests/interactive/test-paint-wrapper.c @@ -59,7 +59,7 @@ input_cb (ClutterStage *stage, g_print ("*** button press event (button:%d) ***\n", button_event->button); - e = clutter_stage_get_actor_at_pos (stage, x, y); + e = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, x, y); if (e && (CLUTTER_IS_TEXTURE (e) || CLUTTER_IS_CLONE (e))) { diff --git a/tests/interactive/test-project.c b/tests/interactive/test-project.c index 7c9403014..f62fd9c1c 100644 --- a/tests/interactive/test-project.c +++ b/tests/interactive/test-project.c @@ -108,7 +108,9 @@ on_event (ClutterStage *stage, clutter_event_get_coords (event, &x, &y); - actor = clutter_stage_get_actor_at_pos (stage, x, y); + actor = clutter_stage_get_actor_at_pos (stage, + CLUTTER_PICK_ALL, + x, y); if (actor != CLUTTER_ACTOR (stage)) { diff --git a/tests/interactive/test-unproject.c b/tests/interactive/test-unproject.c index 95a83cfde..188757b72 100644 --- a/tests/interactive/test-unproject.c +++ b/tests/interactive/test-unproject.c @@ -29,7 +29,9 @@ on_event (ClutterStage *stage, clutter_event_get_coords (event, &x, &y); - actor = clutter_stage_get_actor_at_pos (stage, x, y); + actor = clutter_stage_get_actor_at_pos (stage, + CLUTTER_PICK_ALL, + x, y); if (clutter_actor_transform_stage_point (actor, CLUTTER_UNITS_FROM_DEVICE (x),