efl_ui_focus_object:

make the prepare call safe to recursive calls. There is no need to
prepare a item again if it is already in prepare.
This commit is contained in:
Marcel Hollerbach 2018-04-06 12:48:41 +02:00
parent e70bf4e231
commit 78f4babbb5
10 changed files with 34 additions and 16 deletions

View 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

View 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;
}
}

View 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"

View 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;
}

View File

@ -5742,7 +5742,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;
@ -5753,7 +5753,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));
}
/* Standard widget overrides */

View File

@ -255,6 +255,6 @@ 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;
}
}

View File

@ -8988,7 +8988,7 @@ _elm_genlist_efl_object_provider_find(const Eo *obj, Elm_Genlist_Data *pd, const
return efl_provider_find(efl_super(obj, ELM_GENLIST_CLASS), klass);
}
EOLIAN static void
EOLIAN static void
_elm_genlist_efl_ui_focus_composition_prepare(Eo *obj, Elm_Genlist_Data *pd)
{
Elm_Gen_Item *item;
@ -9015,7 +9015,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;
@ -9026,10 +9026,10 @@ _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
EOLIAN static Eina_Bool
_elm_genlist_efl_ui_widget_focus_state_apply(Eo *obj, Elm_Genlist_Data *pd EINA_UNUSED, Efl_Ui_Widget_Focus_State current_state, Efl_Ui_Widget_Focus_State *configured_state, Efl_Ui_Widget *redirect EINA_UNUSED)
{
return efl_ui_widget_focus_state_apply(efl_super(obj, MY_CLASS), current_state, configured_state, obj);

View File

@ -462,6 +462,6 @@ 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;
}
}

View 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);

View 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;
}
}