[DO NOT REVIEW] refactor accessible_at_point implementation sandbox/stanluk
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 10 Nov 2016 18:22:21 +0000 (19:22 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 10 Nov 2016 18:22:21 +0000 (19:22 +0100)
Change-Id: I94f8b28b3b459098e340eacb01f6a14f3faa14b8

src/lib/elm_main.c
src/lib/elm_object.h
src/lib/elm_widget.c

index 472498a..b686bab 100644 (file)
@@ -2047,4 +2047,30 @@ elm_object_color_class_color3_get(Evas_Object *obj, const char *color_class, int
 
    return eo_do_ret(obj, int_ret, elm_obj_widget_class_color3_get(color_class, r, g, b, a));
 }
+
+EAPI Evas_Object*
+elm_object_top_widget_at_xy_get(Evas_Object *obj, int x, int y, Eina_Bool skip_repeat_events_objects)
+{
+   Evas_Object *stack_item;
+   Eina_List *l, *stack = evas_tree_objects_at_xy_get(evas_object_evas_get(obj), NULL, x, y);
+
+   EINA_LIST_FOREACH(stack, l, stack_item)
+     {
+        if (skip_repeat_events_objects && evas_object_repeat_events_get(stack_item))
+          continue;
+
+        // find smart parent which is elementary widget
+        while (stack_item)
+          {
+             if (elm_object_widget_check(stack_item))
+               {
+                  eina_list_free(stack);
+                  return stack_item;
+               }
+             stack_item = evas_object_smart_parent_get(stack_item);
+          }
+     }
+   eina_list_free(stack);
+   return NULL;
+}
 //
index 9b18076..051e38b 100644 (file)
@@ -962,4 +962,24 @@ EAPI Eina_Bool        elm_object_color_class_color3_set(Evas_Object *obj, const
  * @ingroup General
  */
 EAPI Eina_Bool        elm_object_color_class_color3_get(Evas_Object *obj, const char *color_class, int *r, int *g, int *b, int *a);
+
+/**
+ * Get the topmost elementary widget occupying (x,y) coordinates.
+ *
+ * The function traverses all evas objects stacked at given coordinates and
+ * returns elementary widget which is smart parent of highestly-stacked evas object.
+ *
+ * @param obj The Elementary widget.
+ * @param x horizontal coordinate,
+ * @param y vertical coordinate,
+ * @param skip_repeat_events_objects do not traverse canvas objects that repeat
+ * mouse events.
+ *
+ * @return, the top-most elemenatary widget
+ *
+ * @since 1.xx
+ *
+ * @ingroup Elm_General
+ */
+EAPI Evas_Object* elm_object_top_widget_at_xy_get(Evas_Object *obj, int x, int y, Eina_Bool skip_repeat_events_objects);
 //
index 69efc5c..7140d02 100644 (file)
@@ -6676,8 +6676,36 @@ _elm_widget_elm_interface_atspi_component_accessible_at_point_get(Eo *obj, Elm_W
         y -= ee_y;
      }
 
+   Evas_Object *widget = elm_object_top_widget_at_xy_get(obj, x, y, EINA_FALSE);
+
    eo_do(obj, children = elm_interface_atspi_accessible_children_get());
 
+   /* widget can be descendent of "obj", however atspi spec requires that only direct
+    * child should be returned. */
+   while (widget && (widget != obj))
+     {
+        EINA_LIST_FOREACH(children, l2, child)
+           {
+              if (child == widget)
+                {
+                   eina_list_free(children);
+                   return child;
+                }
+           }
+        eo_do(widget, widget = elm_interface_atspi_accessible_parent_get());
+     }
+
+   // check special cases
+   if (widget == obj)
+     {
+        // elm access
+        // atspi proxy
+        // widget_items
+        // proxy
+     }
+
+   return NULL;
+
    /* Get evas_object stacked at given x,y coordinates starting from top */
    Eina_List *stack = evas_tree_objects_at_xy_get(evas_object_evas_get(obj), NULL, x, y);
    /* Foreach stacked object starting from top */