elm_focus: add internal api to get focused object whitout checking window focus 66/248366/2 accepted/tizen/unified/20201130.122951 submit/tizen/20201129.214353
authorYeongjong Lee <yj34.lee@samsung.com>
Thu, 26 Nov 2020 01:15:48 +0000 (10:15 +0900)
committerYeongJong Lee <yj34.lee@samsung.com>
Thu, 26 Nov 2020 08:20:19 +0000 (08:20 +0000)
'elm_object_focused_object_get_any_win_focus' will returns current focused
object regardless of window focus state.

Note that this is only for internal use.

Change-Id: If0592dfec3ef2478abeac65507d4ff8648d7aa82

src/lib/elementary/elm_focus.h
src/lib/elementary/elm_focus_legacy.c

index a7243a9..6b9833b 100644 (file)
@@ -236,6 +236,21 @@ EAPI void                 elm_object_focus_next_object_set(Evas_Object *obj, Eva
 EAPI Evas_Object         *elm_object_focused_object_get(const Evas_Object *obj);
 
 /**
+ * @internal
+ *
+ * Get focused object regardless of window focus state in object tree.
+ *
+ * This function returns current focused object in one object sub-tree.
+ * This won't check window focus state.
+ *
+ * @param obj The object root of sub-tree
+ * @return Current focused or @c NULL, if there is no focused object.
+ *
+ * @ingroup Elm_Focus
+ */
+EAPI Evas_Object         *elm_object_focused_object_get_any_win_focus(const Evas_Object *obj);
+
+/**
  * Make the elementary object and its children to be focusable
  * (or unfocusable).
  *
index c4c4139..959d090 100644 (file)
@@ -403,6 +403,24 @@ elm_object_focused_object_get(const Evas_Object *obj)
    //
 }
 
+EAPI Evas_Object *
+elm_object_focused_object_get_any_win_focus(const Evas_Object *obj)
+{
+   API_ENTRY_VAL(NULL)
+   const Evas_Object *subobj;
+
+   if (!pd->focused) return NULL;
+   for (unsigned int i = 0; i < eina_array_count(pd->children); ++i)
+     {
+        subobj = eina_array_data_get(pd->children, i);
+        Evas_Object *fobj;
+        if (!efl_isa(subobj, EFL_UI_WIDGET_CLASS)) continue;
+        fobj = elm_object_focused_object_get_any_win_focus(subobj);
+        if (fobj) return fobj;
+     }
+   return (Evas_Object *)obj;
+}
+
 EAPI Eina_Bool
 elm_object_focus_get(const Evas_Object *obj)
 {