efl_ui_widget: relax the amount of event subscriptions

there is a very basic problem in eo events. We are having one central
array of event subscription, if for example a widget is now listening to
changes in its parent, then we are 100% asking for trouble.

As an example:
- A scroller with 100 buttons in it.
- Every button will have a subscription to the FOCUS_MANAGER_CHANGED
event

If you now scroll, the position is updated in the scroller, therefore
the position in scroller is updated. This has the result that the whole
list of 100 event subscriptions is walked, which is obviously bad,
however, this solution here is way easier than fixing eo (i am not even
sure there is a nice solution to it).

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9324
This commit is contained in:
Marcel Hollerbach 2019-07-15 21:25:43 +02:00 committed by Cedric BAIL
parent e76349cd41
commit a6fa2f12d6
1 changed files with 1 additions and 22 deletions

View File

@ -300,17 +300,6 @@ _candidacy_exam(Eo *obj)
static void _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd);
static void
_manager_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
{
if (!efl_alive_get(data))
return;
ELM_WIDGET_DATA_GET(data, pd);
_full_eval(data, pd);
}
static Efl_Ui_Focus_Object*
_focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool want, Eina_Bool should)
{
@ -333,19 +322,9 @@ _focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool want, Eina_Boo
{
old = pd->manager.manager;
if (pd->manager.provider)
efl_event_callback_del(pd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
pd->manager.manager = new;
pd->manager.provider = provider;
}
if (pd->manager.provider)
{
if (!want && !should)
efl_event_callback_del(pd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
else
efl_event_callback_add(pd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
}
return old;
}
@ -561,6 +540,7 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
if (old_registered_manager != pd->focus.manager)
{
_elm_widget_full_eval_children(obj, pd);
efl_event_callback_call(obj,
EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, old_registered_manager);
}
@ -4794,7 +4774,6 @@ _efl_ui_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd)
{
if (sd->manager.provider)
{
efl_event_callback_del(sd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
sd->manager.provider = NULL;
}
efl_access_object_attributes_clear(obj);