efl_ui_focus_object:
authorMarcel Hollerbach <marcel@osg.samsung.com>
Fri, 6 Apr 2018 10:48:41 +0000 (12:48 +0200)
committerWonki Kim <wonki_.kim@samsung.com>
Tue, 10 Apr 2018 13:28:38 +0000 (22:28 +0900)
make the prepare call safe to recursive calls. There is no need to
prepare a item again if it is already in prepare.

src/lib/elementary/efl_ui_focus_composition.c
src/lib/elementary/efl_ui_focus_composition.eo
src/lib/elementary/efl_ui_focus_object.c
src/lib/elementary/efl_ui_focus_object.eo
src/lib/elementary/elm_gengrid.c
src/lib/elementary/elm_gengrid_item.eo
src/lib/elementary/elm_genlist.c
src/lib/elementary/elm_genlist_item.eo
src/lib/elementary/elm_widget_item_static_focus.c
src/lib/elementary/elm_widget_item_static_focus.eo
src/lib/elementary_tizen/elm_genlist.c

index c1a76ef..261dab2 100644 (file)
@@ -155,7 +155,7 @@ _efl_ui_focus_composition_dirty(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Composition_Da
 }
 
 EOLIAN static void
-_efl_ui_focus_composition_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Composition_Data *pd EINA_UNUSED)
+_efl_ui_focus_composition_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Efl_Ui_Focus_Composition_Data *pd EINA_UNUSED)
 {
    if (pd->dirty)
      {
@@ -163,7 +163,7 @@ _efl_ui_focus_composition_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Fo
         pd->dirty = EINA_FALSE;
      }
 
-   efl_ui_focus_object_prepare_logical(efl_super(obj, MY_CLASS));
+   efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, MY_CLASS));
 }
 
 EOLIAN static void
index 11e632b..2538078 100644 (file)
@@ -47,7 +47,7 @@ mixin Efl.Ui.Focus.Composition (Efl.Interface, Efl.Ui.Widget) {
    }
    implements {
       Efl.Ui.Widget.focus_state_apply;
-      Efl.Ui.Focus.Object.prepare_logical;
+      Efl.Ui.Focus.Object.prepare_logical_none_recursive;
       @empty .prepare;
    }
 }
index df565b4..71764c4 100644 (file)
@@ -9,6 +9,7 @@
 
 typedef struct {
   Eina_Bool old_focus;
+  Eina_Bool ongoing_prepare_call;
 } Efl_Ui_Focus_Object_Data;
 
 EOLIAN static void
@@ -26,5 +27,18 @@ _efl_ui_focus_object_focus_get(Eo *obj EINA_UNUSED, Efl_Ui_Focus_Object_Data *pd
    return pd->old_focus;
 }
 
+EOLIAN static void
+_efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Object_Data *pd)
+{
+  if (pd->ongoing_prepare_call) return;
+
+  pd->ongoing_prepare_call = EINA_TRUE;
+
+  efl_ui_focus_object_prepare_logical_none_recursive(obj);
+
+  pd->ongoing_prepare_call = EINA_FALSE;
+}
+
+
 
 #include "efl_ui_focus_object.eo.c"
index a8ce113..901de5d 100644 (file)
@@ -56,10 +56,14 @@ mixin Efl.Ui.Focus.Object
         }
         prepare_logical {
             [[Tells the object that its children will be queried soon by the given manager.
+              The call will be a NOP if there is already a active preprare_logical call on this object
 
               Deleting manager items in this call will result in undefied behaviour and may cause your system to crash.
             ]]
         }
+        prepare_logical_none_recursive @protected {
+            [[]]
+        }
         on_focus_update @protected @pure_virtual {
            [[Virtual function handling focus in/out events on the widget]]
            return: bool; [[$true if this widget can handle focus, $false otherwise]]
@@ -67,7 +71,7 @@ mixin Efl.Ui.Focus.Object
     }
     implements {
         @empty .focus_geometry;
-        @empty .prepare_logical;
+        @empty .prepare_logical_none_recursive;
         @empty .focus_manager;
         @empty .focus_parent;
     }
index 047ffc9..4865898 100644 (file)
@@ -6190,7 +6190,7 @@ _elm_gengrid_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Gengrid_Data *pd EINA_
 }
 
 EOLIAN static void
-_elm_gengrid_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
+_elm_gengrid_item_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Gen_Item *pd)
 {
    Eina_List *n;
    Efl_Ui_Widget *wid;
@@ -6201,7 +6201,7 @@ _elm_gengrid_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
           _elm_widget_full_eval(wid);
      }
 
-   efl_ui_focus_object_prepare_logical(efl_super(obj, ELM_GENGRID_ITEM_CLASS));
+   efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, ELM_GENGRID_ITEM_CLASS));
 }
 
 //TIZEN_ONLY(20171122) Fixed _accessible_set_parent for gengrid items
index 39b4bda..f10a2e7 100644 (file)
@@ -255,7 +255,8 @@ class Elm.Gengrid.Item(Elm.Widget.Item.Static_Focus, Efl.Ui.Focus.Object, Efl.Ui
            Elm.Widget.Item.cursor_unset;
            Efl.Access.i18n_name { get; }
            Efl.Access.state_set { get; }
-           Efl.Ui.Focus.Object.prepare_logical;
+           Efl.Ui.Focus.Object.prepare_logical_none_recursive;
+
            //TIZEN_ONLY(20171114):  Region show on item elements fixed
            Efl.Access.Component.highlight_grab;
            Efl.Access.Component.highlight_clear;
index 2a17992..97bf2d8 100644 (file)
@@ -9287,7 +9287,7 @@ _elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd)
 }
 
 EOLIAN static void
-_elm_genlist_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
+_elm_genlist_item_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Gen_Item *pd)
 {
    Eina_List *n;
    Efl_Ui_Widget *wid;
@@ -9298,7 +9298,7 @@ _elm_genlist_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
           _elm_widget_full_eval(wid);
      }
 
-   efl_ui_focus_object_prepare_logical(efl_super(obj, ELM_GENLIST_ITEM_CLASS));
+   efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, ELM_GENLIST_ITEM_CLASS));
 }
 
 EOLIAN static Eina_Bool
index 039cb2d..e6cb7fa 100644 (file)
@@ -554,7 +554,8 @@ class Elm.Genlist.Item(Elm.Widget.Item.Static_Focus, Efl.Ui.Legacy)
            Elm.Widget.Item.cursor_unset;
            Efl.Access.i18n_name { get; }
            Efl.Access.state_set { get; }
-           Efl.Ui.Focus.Object.prepare_logical;
+           Efl.Ui.Focus.Object.prepare_logical_none_recursive;
+
            Efl.Access.access_children { get; }
            //TIZEN_ONLY(20171114) genlist: enhance accessibility scroll & highlight
            Efl.Access.Component.highlight_grab;
index 09a8923..a1301ff 100644 (file)
@@ -46,12 +46,12 @@ _unrealized_cb(void *data, const Efl_Event *ev EINA_UNUSED)
 }
 
 EOLIAN static void
-_elm_widget_item_static_focus_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
+_elm_widget_item_static_focus_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
 {
    Eo *logical_child;
    Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
 
-   efl_ui_focus_object_prepare_logical(efl_super(obj, MY_CLASS));
+   efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, MY_CLASS));
 
    if (!pd->realized)
      {
@@ -102,7 +102,7 @@ _elm_widget_item_static_focus_efl_object_constructor(Eo *obj, Elm_Widget_Item_St
    return ret;
 }
 
-EOLIAN static void 
+EOLIAN static void
 _elm_widget_item_static_focus_efl_object_destructor(Eo *obj, Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
 {
    Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
index 1ea4b93..51d0fd0 100644 (file)
@@ -4,6 +4,6 @@ class Elm.Widget.Item.Static_Focus (Elm.Widget.Item, Efl.Ui.Focus.Object)
    implements {
            Efl.Object.constructor;
            Efl.Object.destructor;
-           Efl.Ui.Focus.Object.prepare_logical;
+           Efl.Ui.Focus.Object.prepare_logical_none_recursive;
    }
 }
index 656079e..d8437bf 100644 (file)
@@ -9510,7 +9510,7 @@ _elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd)
 }
 
 EOLIAN static void
-_elm_genlist_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
+_elm_genlist_item_efl_ui_focus_object_prepare_logical_none_recursive(Eo *obj, Elm_Gen_Item *pd)
 {
    Eina_List *n;
    Efl_Ui_Widget*wid;
@@ -9523,7 +9523,7 @@ _elm_genlist_item_efl_ui_focus_object_prepare_logical(Eo *obj, Elm_Gen_Item *pd)
           _elm_widget_full_eval(wid);
      }
 
-   efl_ui_focus_object_prepare_logical(efl_super(obj, ELM_GENLIST_ITEM_CLASS));
+   efl_ui_focus_object_prepare_logical_none_recursive(efl_super(obj, ELM_GENLIST_ITEM_CLASS));
 }
 
 EOLIAN static Eina_Bool