elm_widget: give feedback if registration was successfull or not

with this we can whipe out the focus.manager field in elm.widget so for
the case that something goes wrong we only get the error message where
actually something went wrong, and not the whole bunch of follow ups
where the code assumes its registered but it isnt.
This commit is contained in:
Marcel Hollerbach 2017-07-20 17:37:03 +02:00
parent 27f88b534a
commit 47ce995637
7 changed files with 25 additions and 23 deletions

View File

@ -3118,9 +3118,9 @@ _elm_fileselector_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm
}
EOLIAN static Eina_Bool
_elm_fileselector_elm_widget_focus_register(Eo *obj, Elm_Fileselector_Data *pd, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full)
_elm_fileselector_elm_widget_focus_register(Eo *obj, Elm_Fileselector_Data *pd, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool *logical_flag)
{
Eina_Bool ret = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, full);
Eina_Bool ret = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, logical_flag);
_focus_chain_update(obj, pd);

View File

@ -718,9 +718,9 @@ _elm_box_class_constructor(Efl_Class *klass)
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
}
EOLIAN Eina_Bool
_elm_box_elm_widget_focus_register(Eo *obj, Elm_Box_Data *pd, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full)
_elm_box_elm_widget_focus_register(Eo *obj, Elm_Box_Data *pd, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool *logical_flag)
{
Eina_Bool result = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, full);
Eina_Bool result = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, logical_flag);
//later registering children are automatically set into the order of the internal table
_focus_order_flush(obj, pd);

View File

@ -1431,12 +1431,11 @@ _elm_scroller_class_constructor(Efl_Class *klass)
}
EOLIAN static Eina_Bool
_elm_scroller_elm_widget_focus_register(Eo *obj, Elm_Scroller_Data *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full EINA_UNUSED)
_elm_scroller_elm_widget_focus_register(Eo *obj, Elm_Scroller_Data *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool *logical_flag)
{
//undepended from logical or not we always reigster as full with ourself as redirect
efl_ui_focus_manager_register_logical(manager, obj, logical, obj);
return EINA_FALSE;
*logical_flag = EINA_TRUE;
return efl_ui_focus_manager_register_logical(manager, obj, logical, obj);
}

View File

@ -417,9 +417,9 @@ _elm_table_efl_canvas_group_group_calculate(Eo *obj, void *pd EINA_UNUSED)
}
EOLIAN Eina_Bool
_elm_table_elm_widget_focus_register(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full)
_elm_table_elm_widget_focus_register(Eo *obj, void *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool *logical_flag)
{
Eina_Bool result = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, full);
Eina_Bool result = elm_obj_widget_focus_register(efl_super(obj, MY_CLASS), manager, logical, logical_flag);
//later registering children are automatically set into the order of the internal table
_focus_order_flush(obj);

View File

@ -3087,10 +3087,10 @@ elm_toolbar_add(Evas_Object *parent)
}
EOLIAN static Eina_Bool
_elm_toolbar_elm_widget_focus_register(Eo *obj, Elm_Toolbar_Data *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full EINA_UNUSED)
_elm_toolbar_elm_widget_focus_register(Eo *obj, Elm_Toolbar_Data *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool *logical_flag)
{
efl_ui_focus_manager_register_logical(manager, obj, logical, NULL);
return EINA_FALSE;
*logical_flag = EINA_TRUE;
return efl_ui_focus_manager_register_logical(manager, obj, logical, NULL);
}
EOLIAN static Eo *

View File

@ -276,15 +276,13 @@ _focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
EOLIAN static Eina_Bool
_elm_widget_focus_register(Eo *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED,
Efl_Ui_Focus_Manager *manager,
Efl_Ui_Focus_Object *logical, Eina_Bool full)
Efl_Ui_Focus_Object *logical, Eina_Bool *logical_flag)
{
if (full)
efl_ui_focus_manager_register(manager, obj, logical, NULL);
if (!*logical_flag)
return efl_ui_focus_manager_register(manager, obj, logical, NULL);
else
efl_ui_focus_manager_register_logical(manager, obj, logical, NULL);
return full;
return efl_ui_focus_manager_register_logical(manager, obj, logical, NULL);
}
@ -344,8 +342,13 @@ _focus_state_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
if (!pd->logical.parent) return;
pd->focus.logical =
!elm_obj_widget_focus_register(obj, pd->focus.manager, pd->logical.parent, want_full);
pd->focus.logical = !want_full;
if (!elm_obj_widget_focus_register(obj, pd->focus.manager,
pd->logical.parent, &pd->focus.logical))
{
pd->focus.manager = NULL;
}
}
}
else if (!should && pd->focus.manager)

View File

@ -766,9 +766,9 @@ abstract Elm.Widget (Efl.Canvas.Group, Elm.Interface.Atspi_Accessible,
params {
manager : Efl.Ui.Focus.Manager; [[The manager to register against]]
logical : Efl.Ui.Focus.Object; [[The logical parent to use]]
full : bool; [[flag if this should register full or just logical]]
logical_flag : ptr(bool); [[reference to the flag indicating if the should be logical or not change this flag to the value you have it registered]]
}
return : bool; [[return if it registered fully or not]]
return : bool; [[return $true or $false if the registration was successfull or not]]
}
focus_manager_factory {
[[If the widget needs a manager, this function is called