elementary: Check for valid focus manager before starting do loop

Apparently there are cases where efl_ui_focus_object_focus_manager_get
can return NULL. In order to trap for this, we can simply modify the
do loop slightly and check for a valid manager before we actually
start looping

Test Case: elementary_test -to "Panel Scrollable" and click Toggle
button

ref T7030

Differential Revision: https://phab.enlightenment.org/D6704
This commit is contained in:
Chris Michael 2018-09-06 13:21:55 +00:00 committed by Marcel Hollerbach
parent bae53f7d72
commit 84423a465c
1 changed files with 25 additions and 19 deletions

View File

@ -31,26 +31,32 @@ _efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus
registered_manager = m = efl_ui_focus_object_focus_manager_get(user);
entry = user;
do {
//check if the root of a manager is the window root, set focus to this object in the manager than
entry = efl_ui_focus_manager_root_get(m);
if (efl_isa(m, EFL_UI_WIN_CLASS))
{
//we are at the root of the window, we can set the focus to the object
efl_ui_focus_manager_focus_set(registered_manager, user);
return;
}
do
{
if (m)
{
//check if the root of a manager is the window root, set focus to this object in the manager than
entry = efl_ui_focus_manager_root_get(m);
if (efl_isa(m, EFL_UI_WIN_CLASS))
{
//we are at the root of the window, we can set the focus to the object
efl_ui_focus_manager_focus_set(registered_manager, user);
return;
}
}
//if there is no manager yet, delay the focus setting until this entity gets registered for one chain
m = efl_ui_focus_object_focus_manager_get(entry);
if (!m)
{
//delayed focusung
efl_key_data_set(top, "__delayed_focus_set", entry);
efl_event_callback_add(entry, EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED, _manager_changed, user);
return;
}
} while (m);
//if there is no manager yet, delay the focus setting until this entity gets registered for one chain
m = efl_ui_focus_object_focus_manager_get(entry);
if (!m)
{
//delayed focusung
efl_key_data_set(top, "__delayed_focus_set", entry);
efl_event_callback_add(entry,
EFL_UI_FOCUS_OBJECT_EVENT_MANAGER_CHANGED,
_manager_changed, user);
return;
}
} while (m);
}
EOLIAN static Efl_Ui_Focus_Manager*