discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=420ba4691d72faf30548f25e4addfa817d4532ed
commit 420ba4691d72faf30548f25e4addfa817d4532ed Author: Mike Blumenkrantz <[email protected]> Date: Wed Feb 14 21:14:52 2018 -0500 evas: remove Evas_Canvas.objects_at_xy_get also implement Efl_Canvas.objects_at_xy_get note that any function which returns an iterator cannot be @const since it's necessary to wref the object to ensure the iterator's lifetime --- src/lib/efl/interfaces/efl_canvas.eo | 2 +- src/lib/elementary/efl_ui_win.c | 2 +- src/lib/evas/Evas_Legacy.h | 25 +++++++++++++++++++++++++ src/lib/evas/canvas/evas_canvas.eo | 30 +----------------------------- src/lib/evas/canvas/evas_main.c | 17 +++++++++++++++-- 5 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/lib/efl/interfaces/efl_canvas.eo b/src/lib/efl/interfaces/efl_canvas.eo index 7403ca4fea..820425f648 100644 --- a/src/lib/efl/interfaces/efl_canvas.eo +++ b/src/lib/efl/interfaces/efl_canvas.eo @@ -28,7 +28,7 @@ interface Efl.Canvas () all smart objects in the canvas. ]] } - objects_at_xy_get @const { + objects_at_xy_get { [[Retrieve a list of objects lying over a given position in a canvas. diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 0d899c2985..f79d31e5cf 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -2517,7 +2517,7 @@ _efl_ui_win_efl_canvas_smart_objects_calculate(Eo *obj EINA_UNUSED, Efl_Ui_Win_D } EOLIAN static Eina_Iterator * -_efl_ui_win_efl_canvas_objects_at_xy_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Position2D pos, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) +_efl_ui_win_efl_canvas_objects_at_xy_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Position2D pos, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) { Eina_List *objs = NULL; objs = evas_objects_at_xy_get(sd->evas, pos.x, pos.y, include_pass_events_objects, include_hidden_objects); diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 9c1156d4f8..83240d6ae6 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2293,6 +2293,31 @@ EAPI Eina_Bool evas_object_pointer_coords_inside_get(const Evas_Object *eo_obj, EAPI Evas *evas_object_evas_get(const Eo *obj); /** + * @brief Retrieve a list of objects lying over 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 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 list of objects that are over the given position in @c e. + * + * @ingroup Efl_Canvas + */ + 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); + +/** * @} */ diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo index 6f40d5fc3f..2b5f828691 100644 --- a/src/lib/evas/canvas/evas_canvas.eo +++ b/src/lib/evas/canvas/evas_canvas.eo @@ -440,35 +440,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface, @in keyname: string @nonull; [[The name of the modifier to disable.]] } } - objects_at_xy_get @const { - [[Retrieve a list of Evas objects lying over 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 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: list<Efl.Canvas.Object> @warn_unused; [[ - The list of Evas objects that are over the given position in $e. - ]] - 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. - ]] - } - } render_async { [[Render the given Evas canvas asynchronously. @@ -1113,5 +1084,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface, Efl.Canvas.device { get; } Efl.Canvas.seat { get; } Efl.Canvas.image_max_size { get; } + Efl.Canvas.objects_at_xy_get; } } diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index ec583d31cc..b9d6d0a8b8 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -1532,8 +1532,8 @@ _evas_canvas_object_top_in_rectangle_get(const Eo *eo_e EINA_UNUSED, Evas_Public return NULL; } -EOLIAN Eina_List* -_evas_canvas_objects_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) +static Eina_List * +_efl_canvas_evas_canvas_objects_at_xy_get_helper(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, int x, int y, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) { Eina_List *in = NULL; Evas_Layer *lay; @@ -1576,6 +1576,14 @@ _evas_canvas_objects_at_xy_get(const Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, return in; } +EOLIAN static Eina_Iterator * +_evas_canvas_efl_canvas_objects_at_xy_get(Eo *eo_e, Evas_Public_Data *e, Eina_Position2D pos, Eina_Bool include_pass_events_objects, Eina_Bool include_hidden_objects) +{ + Eina_List *l = _efl_canvas_evas_canvas_objects_at_xy_get_helper(eo_e, e, pos.x, pos.y, include_pass_events_objects, include_hidden_objects); + if (l) return efl_canvas_iterator_create(eo_e, eina_list_iterator_new(l), l); + return NULL; +} + /** * Retrieves the objects in the given rectangle region * @param eo_e The given evas object. @@ -1783,6 +1791,11 @@ evas_pointer_inside_by_device_get(const Evas *obj, Eo *dev) return efl_canvas_pointer_inside_get(obj, dev); } +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) +{ + return _efl_canvas_evas_canvas_objects_at_xy_get_helper(eo_e, efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS), x, y, include_pass_events_objects, include_hidden_objects); +} /* Internal EO APIs */ EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE = --
