From: Mike Blumenkrantz Date: Thu, 15 Feb 2018 02:14:52 +0000 (-0500) Subject: evas: remove Evas_Canvas.objects_at_xy_get X-Git-Tag: upstream/1.21.0~1970 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c9da9dc539a7e19d317ee68e0ca8021a4e3edf6;p=platform%2Fupstream%2Fefl.git 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 --- diff --git a/src/lib/efl/interfaces/efl_canvas.eo b/src/lib/efl/interfaces/efl_canvas.eo index 7403ca4..820425f 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 eca746e..d10c3ab 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -2860,7 +2860,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 20401e5..3e784e4 100755 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2329,6 +2329,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 6f40d5f..2b5f828 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 @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 a6da371..0797b9e 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -1527,8 +1527,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; @@ -1571,6 +1571,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. @@ -1778,6 +1786,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 =