discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7bfaf6b63db8290b7d3a4bf3e5a309431b21353d
commit 7bfaf6b63db8290b7d3a4bf3e5a309431b21353d Author: Mike Blumenkrantz <[email protected]> Date: Wed Feb 14 21:14:52 2018 -0500 evas: remove Evas_Canvas.object_top_at_xy_get also implement Efl_Canvas method --- src/lib/evas/Evas_Legacy.h | 26 ++++++++++++++++++++++++++ src/lib/evas/canvas/evas_canvas.eo | 28 +--------------------------- src/lib/evas/canvas/evas_main.c | 17 ++++++++++++----- 3 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 83240d6ae6..4b753bda43 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2317,6 +2317,32 @@ EAPI Evas *evas_object_evas_get(const Eo *obj); */ EAPI Eina_List *evas_objects_at_xy_get(Eo *eo_e, int x, int y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects); + +/** + * @brief Retrieve the object stacked at the top of a given position in a + * canvas. + * + * This function will traverse all the layers of the given canvas, from top to + * bottom, querying for objects with areas covering the given position. The + * user can remove from the query objects which are hidden and/or which are set + * to pass events. + * + * @warning This function will skip objects parented by smart objects, acting + * only on the ones at the "top level", with regard to object parenting. + * + * @param[in] obj The object. + * @param[in] x The pixel position. + * @param[in] y The pixel position. + * @param[in] include_pass_events_objects Boolean flag to include or not + * objects which pass events in this calculation. + * @param[in] include_hidden_objects Boolean flag to include or not hidden + * objects in this calculation. + * + * @return The Evas object that is over all other objects at the given + * position. + */ + EAPI Evas_Object* evas_object_top_at_xy_get(Eo *eo_e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects); + /** * @} */ diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo index 2b5f828691..1418abac42 100644 --- a/src/lib/evas/canvas/evas_canvas.eo +++ b/src/lib/evas/canvas/evas_canvas.eo @@ -536,33 +536,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface, [[Force the given evas and associated engine to flush its font cache.]] } - object_top_at_xy_get @const { - [[Retrieve the Evas object stacked at the top of a given position - in a canvas. - - This function will traverse all the layers of the given canvas, - from top to bottom, querying for objects with areas covering the - given position. The user can remove from the query - objects which are hidden and/or which are set to pass events. - - Warning: This function will skip objects parented by smart - objects, acting only on the ones at the "top level", with - regard to object parenting. - ]] - return: Efl.Canvas.Object @warn_unused; [[The Evas object that is over all other objects at the given position.]] - params { - @in x: int; [[The horizontal coordinate of the position.]] - @in y: int; [[The vertical coordinate of the position.]] - @in include_pass_events_objects: bool; [[ - Boolean flag to include or not objects which pass events - in this calculation. - ]] - @in include_hidden_objects: bool; [[ - Boolean flag to include or not hidden objects in this - calculation. - ]] - } - } key_modifier_on { [[Enables or turns on programmatically the modifier key with name $keyname for the default seat. @@ -1085,5 +1058,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface, Efl.Canvas.seat { get; } Efl.Canvas.image_max_size { get; } Efl.Canvas.objects_at_xy_get; + Efl.Canvas.object_top_at_xy_get; } } diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index b9d6d0a8b8..d2f503cfdd 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -1445,14 +1445,14 @@ efl_canvas_iterator_create(Eo *obj, Eina_Iterator *real_iterator, Eina_List *lis return &it->iterator; } -EOLIAN Evas_Object* -_evas_canvas_object_top_at_xy_get(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) +EOLIAN static Evas_Object* +_evas_canvas_efl_canvas_object_top_at_xy_get(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, Eina_Position2D pos, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) { Evas_Layer *lay; int xx, yy; - xx = x; - yy = y; + xx = pos.x; + yy = pos.y; //// xx = evas_coord_world_x_to_screen(eo_e, x); //// yy = evas_coord_world_y_to_screen(eo_e, y); EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay) @@ -1480,6 +1480,13 @@ _evas_canvas_object_top_at_xy_get(const Eo *eo_e EINA_UNUSED, Evas_Public_Data * return NULL; } +EAPI Evas_Object* +evas_object_top_at_xy_get(Eo *eo_e, Evas_Coord x, Evas_Coord y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) +{ + Eina_Position2D pos = {x, y}; + return efl_canvas_object_top_at_xy_get(eo_e, pos, include_pass_events_objects, include_hidden_objects); +} + EAPI Evas_Object * evas_object_top_at_pointer_get(const Evas *eo_e) { @@ -1489,7 +1496,7 @@ evas_object_top_at_pointer_get(const Evas *eo_e) Evas_Pointer_Data *pdata = _evas_pointer_data_by_device_get(e, NULL); EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL); - return evas_canvas_object_top_at_xy_get((Eo *)eo_e, pdata->seat->x, pdata->seat->y, EINA_TRUE, EINA_TRUE); + return efl_canvas_object_top_at_xy_get((Eo *)eo_e, EINA_POSITION2D(pdata->seat->x, pdata->seat->y), EINA_TRUE, EINA_TRUE); } EOLIAN Evas_Object* --
