summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-15 21:25:43 +0200
committerCedric BAIL <cedric.bail@free.fr>2019-07-17 10:17:46 -0700
commita6fa2f12d6f36a2dbfda4d425bf4e8ce74823ce3 (patch)
treebd560072f06f8c7bae7357efb2dc24a101d62e8e
parente76349cd41d92b5fcf189d21a79c8d40dfeb9604 (diff)
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
-rw-r--r--src/lib/elementary/efl_ui_widget.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index a8d8987a6e..f6ddf3270f 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -300,17 +300,6 @@ _candidacy_exam(Eo *obj)
300 300
301static void _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd); 301static void _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd);
302 302
303static void
304_manager_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
305{
306 if (!efl_alive_get(data))
307 return;
308
309 ELM_WIDGET_DATA_GET(data, pd);
310
311 _full_eval(data, pd);
312}
313
314static Efl_Ui_Focus_Object* 303static Efl_Ui_Focus_Object*
315_focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool want, Eina_Bool should) 304_focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool want, Eina_Bool should)
316{ 305{
@@ -333,19 +322,9 @@ _focus_manager_eval(Eo *obj, Elm_Widget_Smart_Data *pd, Eina_Bool want, Eina_Boo
333 { 322 {
334 old = pd->manager.manager; 323 old = pd->manager.manager;
335 324
336 if (pd->manager.provider)
337 efl_event_callback_del(pd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
338
339 pd->manager.manager = new; 325 pd->manager.manager = new;
340 pd->manager.provider = provider; 326 pd->manager.provider = provider;
341 } 327 }
342 if (pd->manager.provider)
343 {
344 if (!want && !should)
345 efl_event_callback_del(pd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
346 else
347 efl_event_callback_add(pd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
348 }
349 328
350 return old; 329 return old;
351} 330}
@@ -561,6 +540,7 @@ _full_eval(Eo *obj, Elm_Widget_Smart_Data *pd)
561 540
562 if (old_registered_manager != pd->focus.manager) 541 if (old_registered_manager != pd->focus.manager)
563 { 542 {
543 _elm_widget_full_eval_children(obj, pd);
564 efl_event_callback_call(obj, 544 efl_event_callback_call(obj,
565 EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, old_registered_manager); 545 EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, old_registered_manager);
566 } 546 }
@@ -4794,7 +4774,6 @@ _efl_ui_widget_efl_object_destructor(Eo *obj, Elm_Widget_Smart_Data *sd)
4794{ 4774{
4795 if (sd->manager.provider) 4775 if (sd->manager.provider)
4796 { 4776 {
4797 efl_event_callback_del(sd->manager.provider, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_changed_cb, obj);
4798 sd->manager.provider = NULL; 4777 sd->manager.provider = NULL;
4799 } 4778 }
4800 efl_access_object_attributes_clear(obj); 4779 efl_access_object_attributes_clear(obj);