mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
Allow passing the pick mode to get_actor_at_pos()
Bug 1513 - Allow passing in ClutterPickMode to clutter_stage_get_actor_at_pos() At the moment, clutter_stage_get_actor_at_pos() uses CLUTTER_PICK_ALL internally to find an actor. It would be useful to allow passing in ClutterPickMode to clutter_stage_get_actor_at_pos(), so that the caller can specify CLUTTER_PICK_REACTIVE as a criteria.
This commit is contained in:
parent
6064572703
commit
08ba42a5ab
@ -65,12 +65,6 @@ typedef enum {
|
|||||||
CLUTTER_TEXTURE_IN_CLONE_PAINT = 1 << 6 /* Used for safety in clones */
|
CLUTTER_TEXTURE_IN_CLONE_PAINT = 1 << 6 /* Used for safety in clones */
|
||||||
} ClutterPrivateFlags;
|
} ClutterPrivateFlags;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CLUTTER_PICK_NONE = 0,
|
|
||||||
CLUTTER_PICK_REACTIVE,
|
|
||||||
CLUTTER_PICK_ALL
|
|
||||||
} ClutterPickMode;
|
|
||||||
|
|
||||||
struct _ClutterInputDevice
|
struct _ClutterInputDevice
|
||||||
{
|
{
|
||||||
gint id;
|
gint id;
|
||||||
|
@ -1242,20 +1242,26 @@ clutter_stage_read_pixels (ClutterStage *stage,
|
|||||||
/**
|
/**
|
||||||
* clutter_stage_get_actor_at_pos:
|
* clutter_stage_get_actor_at_pos:
|
||||||
* @stage: a #ClutterStage
|
* @stage: a #ClutterStage
|
||||||
|
* @pick_mode: how the scene graph should be painted
|
||||||
* @x: X coordinate to check
|
* @x: X coordinate to check
|
||||||
* @y: Y coordinate to check
|
* @y: Y coordinate to check
|
||||||
*
|
*
|
||||||
* Checks the scene at the coordinates @x and @y and returns a pointer
|
* Checks the scene at the coordinates @x and @y and returns a pointer
|
||||||
* to the #ClutterActor at those coordinates.
|
* 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 *
|
ClutterActor *
|
||||||
clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
||||||
gint x,
|
ClutterPickMode pick_mode,
|
||||||
gint y)
|
gint x,
|
||||||
|
gint y)
|
||||||
{
|
{
|
||||||
return _clutter_do_pick (stage, x, y, CLUTTER_PICK_ALL);
|
return _clutter_do_pick (stage, x, y, pick_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,6 +79,22 @@ G_BEGIN_DECLS
|
|||||||
#define CLUTTER_STAGE_HEIGHT() \
|
#define CLUTTER_STAGE_HEIGHT() \
|
||||||
(clutter_actor_get_height (clutter_stage_get_default ()))
|
(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 _ClutterPerspective ClutterPerspective;
|
||||||
typedef struct _ClutterFog ClutterFog;
|
typedef struct _ClutterFog ClutterFog;
|
||||||
|
|
||||||
@ -192,6 +208,7 @@ void clutter_stage_show_cursor (ClutterStage *stage);
|
|||||||
void clutter_stage_hide_cursor (ClutterStage *stage);
|
void clutter_stage_hide_cursor (ClutterStage *stage);
|
||||||
|
|
||||||
ClutterActor *clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
ClutterActor *clutter_stage_get_actor_at_pos (ClutterStage *stage,
|
||||||
|
ClutterPickMode pick_mode,
|
||||||
gint x,
|
gint x,
|
||||||
gint y);
|
gint y);
|
||||||
guchar * clutter_stage_read_pixels (ClutterStage *stage,
|
guchar * clutter_stage_read_pixels (ClutterStage *stage,
|
||||||
|
@ -496,6 +496,7 @@ clutter_stage_fullscreen
|
|||||||
clutter_stage_unfullscreen
|
clutter_stage_unfullscreen
|
||||||
clutter_stage_show_cursor
|
clutter_stage_show_cursor
|
||||||
clutter_stage_hide_cursor
|
clutter_stage_hide_cursor
|
||||||
|
ClutterPickMode
|
||||||
clutter_stage_get_actor_at_pos
|
clutter_stage_get_actor_at_pos
|
||||||
clutter_stage_ensure_current
|
clutter_stage_ensure_current
|
||||||
clutter_stage_ensure_viewport
|
clutter_stage_ensure_viewport
|
||||||
|
@ -68,6 +68,7 @@ on_timeout (State *state)
|
|||||||
guint32 gid;
|
guint32 gid;
|
||||||
ClutterActor *actor
|
ClutterActor *actor
|
||||||
= clutter_stage_get_actor_at_pos (CLUTTER_STAGE (state->stage),
|
= clutter_stage_get_actor_at_pos (CLUTTER_STAGE (state->stage),
|
||||||
|
CLUTTER_PICK_ALL,
|
||||||
x * state->actor_width
|
x * state->actor_width
|
||||||
+ state->actor_width / 2,
|
+ state->actor_width / 2,
|
||||||
y * state->actor_height
|
y * state->actor_height
|
||||||
|
@ -57,7 +57,9 @@ input_cb (ClutterActor *stage,
|
|||||||
button_event->button,
|
button_event->button,
|
||||||
x, y);
|
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 */
|
/* only allow hiding the clones */
|
||||||
if (e && CLUTTER_IS_CLONE (e))
|
if (e && CLUTTER_IS_CLONE (e))
|
||||||
|
@ -57,7 +57,9 @@ input_cb (ClutterActor *stage,
|
|||||||
button_event->button,
|
button_event->button,
|
||||||
x, y);
|
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 */
|
/* only allow hiding the clones */
|
||||||
if (e && (CLUTTER_IS_TEXTURE (e) || CLUTTER_IS_CLONE (e)))
|
if (e && (CLUTTER_IS_TEXTURE (e) || CLUTTER_IS_CLONE (e)))
|
||||||
|
@ -59,7 +59,7 @@ input_cb (ClutterStage *stage,
|
|||||||
g_print ("*** button press event (button:%d) ***\n",
|
g_print ("*** button press event (button:%d) ***\n",
|
||||||
button_event->button);
|
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)))
|
if (e && (CLUTTER_IS_TEXTURE (e) || CLUTTER_IS_CLONE (e)))
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,9 @@ on_event (ClutterStage *stage,
|
|||||||
|
|
||||||
clutter_event_get_coords (event, &x, &y);
|
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))
|
if (actor != CLUTTER_ACTOR (stage))
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,9 @@ on_event (ClutterStage *stage,
|
|||||||
|
|
||||||
clutter_event_get_coords (event, &x, &y);
|
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,
|
if (clutter_actor_transform_stage_point (actor,
|
||||||
CLUTTER_UNITS_FROM_DEVICE (x),
|
CLUTTER_UNITS_FROM_DEVICE (x),
|
||||||
|
Loading…
Reference in New Issue
Block a user