efl_ui_focus_manager_sub: freeze manager when parent manager is frozen

a efl_ui_focus_manager_sub object is a manager object by itself. It
registeres the border elements of itself in the parent focus manager.
However, all elements that are registered in this manager object, are
also automatically children of the parent root object, which means, when
the root object of the parent manager object is moved, then those
children will also be moved. Which means, when the parent manager can
ignore those changes, we can also ignore them.
This improves the overall performance of the "Scroller 2" test case by
26%.

The change to the test is required in order to redirect the events so
the self_dirty bit is setted correctly

Differential Revision: https://phab.enlightenment.org/D7350
This commit is contained in:
Marcel Hollerbach 2018-11-22 15:50:04 +01:00
parent a73904ba66
commit acee09f585
2 changed files with 27 additions and 2 deletions

View File

@ -84,6 +84,7 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
eina_list_free(pd->current_border);
pd->current_border = selection;
pd->self_dirty = EINA_FALSE;
}
static void
@ -105,7 +106,7 @@ _parent_manager_pre_flush(void *data, const Efl_Event *ev EINA_UNUSED)
{
MY_DATA(data, pd);
//if (!pd->self_dirty) return; //we are not interested
if (!pd->self_dirty) return; //we are not interested
_border_flush(data, pd);
}
@ -116,12 +117,27 @@ _redirect_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
//if (efl_ui_focus_manager_redirect_get(ev->object) != data) return;
MY_DATA(data, pd);
_border_flush(data, pd);
}
static void
_freeze_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
if (ev->info)
{
efl_ui_focus_manager_dirty_logic_freeze(data);
}
else
{
efl_ui_focus_manager_dirty_logic_unfreeze(data);
}
}
EFL_CALLBACKS_ARRAY_DEFINE(parent_manager,
{EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, _parent_manager_pre_flush},
{EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, _redirect_changed_cb}
{EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, _redirect_changed_cb},
{EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, _freeze_changed_cb}
);
static void
@ -198,6 +214,9 @@ _efl_ui_focus_manager_sub_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_S
{
obj = efl_constructor(efl_super(obj, MY_CLASS));
efl_event_callback_array_add(obj, self_manager(), obj);
pd->self_dirty = EINA_TRUE;
return obj;
}

View File

@ -93,6 +93,12 @@ _setup(Efl_Ui_Focus_Manager **m, Efl_Ui_Focus_Manager_Sub **sub, Efl_Ui_Focus_Ob
Efl_Ui_Focus_Manager_Calc *subm = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, focus_main,
efl_ui_focus_manager_root_set(efl_added, root)
);
efl_event_callback_forwarder_add(subm, EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, focus_main);
efl_event_callback_forwarder_add(subm, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, focus_main);
efl_event_callback_forwarder_add(subm, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED , focus_main);
efl_event_callback_forwarder_add(subm, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, focus_main);
efl_event_callback_forwarder_add(subm, EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, focus_main);
efl_composite_attach(focus_main, subm);