efl_ui_focus_manager: introduce a new API

the new api can be used to freeze the cache. This means, when the
widgets of the focus manager are all equally moved, the cache can stay,
cause the relative positions did not change, this enables a whole new
set of available optimizations.

Differential Revision: https://phab.enlightenment.org/D7348
This commit is contained in:
Marcel Hollerbach 2018-11-22 15:41:31 +01:00
parent 97ece33134
commit e36dce177e
4 changed files with 40 additions and 0 deletions

View File

@ -158,6 +158,18 @@ interface Efl.Ui.Focus.Manager {
entry : Efl.Ui.Focus.Object; [[The object that caused this manager to be redirect]]
}
}
dirty_logic_freeze {
[[This disables the cache invalidation when a object is moved.
Even the object is moved, the focus manager will not recalculate its relations, this can be used when you know that the set of widgets in the focus manager is equally moved. so the relations between the widets in the set do not change.
]]
}
dirty_logic_unfreeze {
[[This enables the cache invalidation when a object is moved.
This is the counter part to @.dirty_logic_freeze
]]
}
}
events {
redirect,changed : Efl.Ui.Focus.Manager; [[Emitted when the redirect
@ -167,5 +179,6 @@ interface Efl.Ui.Focus.Manager {
potential changes in border_elements you want to know about]]
focus,changed : Efl.Ui.Focus.Object; [[Emitted if the manager has focused an
object, the passed focus object is the last focused object]]
dirty_logic_freeze,changed : bool; [[Called when this focus manager is frozen or unfrozen, even_info beeing $true indicates that it is now frozen, $false indicates that it is unfrozen.]]
}
}

View File

@ -79,6 +79,7 @@ typedef struct {
Efl_Ui_Focus_Object *redirect_entry;
Eina_List *dirty;
Efl_Ui_Focus_Graph_Context graph_ctx;
int freeze;
Node *root;
} Efl_Ui_Focus_Manager_Calc_Data;
@ -447,6 +448,10 @@ _node_new_geometry_cb(void *data, const Efl_Event *event)
Node *node;
FOCUS_DATA(data)
if (pd->freeze > 0) {
return;
}
node = node_get(data, pd, event->object);
if (!node)
return;
@ -1838,6 +1843,24 @@ _efl_ui_focus_manager_calc_efl_object_dbg_info_get(Eo *obj, Efl_Ui_Focus_Manager
eina_iterator_free(iter);
}
EOLIAN static void
_efl_ui_focus_manager_calc_efl_ui_focus_manager_dirty_logic_freeze(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
{
pd->freeze ++;
if (pd->freeze == 1)
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, (void*)EINA_TRUE);
}
EOLIAN static void
_efl_ui_focus_manager_calc_efl_ui_focus_manager_dirty_logic_unfreeze(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
{
pd->freeze --;
if (!pd->freeze)
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, (void*)EINA_FALSE);
}
#define EFL_UI_FOCUS_MANAGER_CALC_EXTRA_OPS \
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_focus_manager_calc_efl_object_dbg_info_get)

View File

@ -102,6 +102,8 @@ class Efl.Ui.Focus.Manager_Calc (Efl.Object, Efl.Ui.Focus.Manager) {
Efl.Ui.Focus.Manager.reset_history;
Efl.Ui.Focus.Manager.pop_history_stack;
Efl.Ui.Focus.Manager.setup_on_first_touch;
Efl.Ui.Focus.Manager.dirty_logic_freeze;
Efl.Ui.Focus.Manager.dirty_logic_unfreeze;
Efl.Object.constructor;
Efl.Object.finalize;
Efl.Object.provider_find;

View File

@ -61,6 +61,7 @@ _efl_ui_focus_manager_redirect_events_del(Efl_Ui_Focus_Manager *manager, Eo *obj
efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj);
efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED , obj);
efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, obj);
efl_event_callback_forwarder_del(manager, EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, obj);
}
void
@ -70,6 +71,7 @@ _efl_ui_focus_manager_redirect_events_add(Efl_Ui_Focus_Manager *manager, Eo *obj
efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj);
efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED , obj);
efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, obj);
efl_event_callback_forwarder_add(manager, EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, obj);
}
Eina_Bool