evas: remove Evas_Canvas.objects_at_xy_get
authorMike Blumenkrantz <zmike@osg.samsung.com>
Thu, 15 Feb 2018 02:14:52 +0000 (21:14 -0500)
committerWonki Kim <wonki_.kim@samsung.com>
Thu, 5 Apr 2018 18:05:30 +0000 (03:05 +0900)
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
src/lib/elementary/efl_ui_win.c
src/lib/evas/Evas_Legacy.h
src/lib/evas/canvas/evas_canvas.eo
src/lib/evas/canvas/evas_main.c

index 7403ca4..820425f 100644 (file)
@@ -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.
 
index eca746e..d10c3ab 100644 (file)
@@ -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);
index 20401e5..3e784e4 100755 (executable)
@@ -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);
+
+/**
  * @}
  */
 
index 6f40d5f..2b5f828 100644 (file)
@@ -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;
    }
 }
index a6da371..0797b9e 100644 (file)
@@ -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 =