edje: block "recalc" event emission if it isn't being subscribed to

Summary:
this gets called a ton

ref T8321
Depends on D10356

Reviewers: bu5hm4n, cedric

Reviewed By: bu5hm4n, cedric

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8321

Differential Revision: https://phab.enlightenment.org/D10357
This commit is contained in:
Mike Blumenkrantz 2019-10-14 09:29:50 -04:00
parent f174bf2eb2
commit b1a2d82417
3 changed files with 26 additions and 1 deletions

View File

@ -1043,7 +1043,7 @@ _edje_recalc_do(Edje *ed)
#endif
if (!ed->calc_only)
{
if (ed->recalc_call)
if (ed->recalc_call && ed->has_recalc_event_cb)
efl_event_callback_legacy_call(ed->obj, EFL_LAYOUT_EVENT_RECALC, NULL);
}
else

View File

@ -1802,6 +1802,7 @@ struct _Edje
Eina_Bool need_map_update : 1;
Eina_Bool canvas_animator : 1;
Eina_Bool has_state_clip : 1;
Eina_Bool has_recalc_event_cb : 1;
};
struct _Edje_Calc_Params_Map

View File

@ -601,9 +601,33 @@ _efl_canvas_layout_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Edje
}
/* Internal EO APIs and hidden overrides */
EOLIAN static Eina_Bool
_efl_canvas_layout_efl_object_event_callback_priority_add(Eo *obj, Edje *pd, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
{
if (desc == EFL_LAYOUT_EVENT_RECALC)
{
pd->has_recalc_event_cb = EINA_TRUE;
}
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
}
EOLIAN static Eina_Bool
_efl_canvas_layout_efl_object_event_callback_array_priority_add(Eo *obj, Edje *pd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
{
for (int i = 0; array[i].desc; ++i)
{
if (array[i].desc == EFL_LAYOUT_EVENT_RECALC)
{
pd->has_recalc_event_cb = EINA_TRUE;
}
}
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
}
#define EFL_CANVAS_LAYOUT_EXTRA_OPS \
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_canvas_layout), \
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_canvas_layout_efl_object_event_callback_priority_add), \
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_canvas_layout_efl_object_event_callback_array_priority_add), \
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_canvas_layout_efl_object_dbg_info_get)
#include "efl_canvas_layout.eo.c"