elm_gen****: fix focus restoring on window focus changes

this ensures that if there is no focused item, that at least the
container is focused. This leads to the fact that the elm_genlist
/elm_gengrid is refocused when a window is unfocused and focused again.

Reviewed-by: YeongJong Lee <yj34.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7451
This commit is contained in:
Marcel Hollerbach 2018-12-11 16:40:40 +01:00
parent ef874d5b59
commit 6922761f3f
4 changed files with 28 additions and 3 deletions

View File

@ -4255,12 +4255,23 @@ _elm_gengrid_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Gengrid_Data
}
else
{
//Just set evas focus on the gengrid itself, events will pass on and some element will be taken
evas_object_focus_set(obj, EINA_TRUE);
efl_ui_focus_object_focus_set(obj, EINA_TRUE);
}
}
}
EOLIAN static Efl_Ui_Focus_Object*
_elm_gengrid_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Gengrid_Data *pd)
{
Eo *focused_obj = efl_ui_focus_manager_focus_get(efl_super(obj, MY_CLASS));
Eo *registered_manager = efl_ui_focus_object_focus_manager_get(obj);
if (!focused_obj && efl_ui_focus_manager_redirect_get(registered_manager))
return (Efl_Ui_Focus_Object*) obj;
return focused_obj;
}
static void
_gengrid_element_focused(void *data, const Efl_Event *ev)
{

View File

@ -528,6 +528,7 @@ class Elm.Gengrid (Efl.Ui.Layout, Efl.Ui.Focus.Composition, Elm.Interface_Scroll
Efl.Ui.Focus.Composition.prepare;
Efl.Ui.Widget.focus_state_apply;
Efl.Ui.Focus.Manager.setup_on_first_touch;
Efl.Ui.Focus.Manager.manager_focus { get; }
}
events {
realized: Efl.Object; [[Called when gengrid realized]]

View File

@ -3438,11 +3438,23 @@ _elm_genlist_efl_ui_focus_manager_setup_on_first_touch(Eo *obj, Elm_Genlist_Data
else
{
//Just set evas focus on the genlist itself, events will pass on and a other element will be taken
evas_object_focus_set(obj, EINA_TRUE);
efl_ui_focus_object_focus_set(obj, EINA_TRUE);
}
}
}
EOLIAN static Efl_Ui_Focus_Object*
_elm_genlist_efl_ui_focus_manager_manager_focus_get(const Eo *obj, Elm_Genlist_Data *pd)
{
Eo *focused_obj = efl_ui_focus_manager_focus_get(efl_super(obj, MY_CLASS));
Eo *registered_manager = efl_ui_focus_object_focus_manager_get(obj);
if (!focused_obj && efl_ui_focus_manager_redirect_get(registered_manager))
return (Efl_Ui_Focus_Object*) obj;
return focused_obj;
}
EOLIAN static Eina_Bool
_elm_genlist_efl_ui_focus_object_on_focus_update(Eo *obj, Elm_Genlist_Data *sd)
{

View File

@ -555,6 +555,7 @@ class Elm.Genlist (Efl.Ui.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
Efl.Access.Selection.access_selection_clear;
Efl.Ui.Widget.focus_state_apply;
Efl.Ui.Focus.Manager.setup_on_first_touch;
Efl.Ui.Focus.Manager.manager_focus { get; }
}
events {
item,focused: Efl.Object; [[Called when genlist item got focus]]