summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-10-15 16:33:15 -0700
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-12 10:15:03 +0100
commitab41ea1a8909403d0e2cd2547763bbd526a459a1 (patch)
treeda8c9415dd0bbdb7ec23a6136bdaa1706218788e
parentd930ac230fdb7fcc0d568c40ddf7301dc28b471d (diff)
toolbar: delay evaluation of the toolbar size until it stabilize.
Elementary is not using much the calculate callback from Evas. This create all sort of problem where it transform O(n) algorithm. Like sizing a toolbar for next frame to O(n^n) by actually sizing the toolbar every time an object is inserted. T2777
-rw-r--r--src/lib/elm_toolbar.c16
-rw-r--r--src/lib/elm_toolbar.eo1
2 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/elm_toolbar.c b/src/lib/elm_toolbar.c
index e93c552a6..d52394790 100644
--- a/src/lib/elm_toolbar.c
+++ b/src/lib/elm_toolbar.c
@@ -1304,7 +1304,7 @@ _item_theme_hook(Evas_Object *obj,
1304 (VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL); 1304 (VIEW(it), EVAS_HINT_FILL, EVAS_HINT_FILL);
1305 } 1305 }
1306 _resizing_eval_item(it); 1306 _resizing_eval_item(it);
1307 _sizing_eval(obj); 1307 evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
1308} 1308}
1309 1309
1310static void 1310static void
@@ -1475,7 +1475,7 @@ _elm_toolbar_elm_widget_theme_apply(Eo *obj, Elm_Toolbar_Data *sd)
1475 _item_theme_hook(obj, sd->more_item, scale, sd->icon_size); 1475 _item_theme_hook(obj, sd->more_item, scale, sd->icon_size);
1476 1476
1477 _elm_toolbar_highlight_in_theme(obj); 1477 _elm_toolbar_highlight_in_theme(obj);
1478 _sizing_eval(obj); 1478 evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
1479 1479
1480 return EINA_TRUE; 1480 return EINA_TRUE;
1481} 1481}
@@ -1659,9 +1659,8 @@ _item_resize(void *data,
1659 Evas_Object *obj EINA_UNUSED, 1659 Evas_Object *obj EINA_UNUSED,
1660 void *event_info EINA_UNUSED) 1660 void *event_info EINA_UNUSED)
1661{ 1661{
1662 _sizing_eval(data); 1662 evas_object_smart_need_recalculate_set(data, EINA_TRUE);
1663 _resizing_eval(data); 1663 _resizing_eval(data);
1664
1665} 1664}
1666 1665
1667static void 1666static void
@@ -3360,7 +3359,7 @@ _elm_toolbar_shrink_mode_set(Eo *obj, Elm_Toolbar_Data *sd, Elm_Toolbar_Shrink_M
3360 eo_do(obj, elm_interface_scrollable_policy_set 3359 eo_do(obj, elm_interface_scrollable_policy_set
3361 (ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF)); 3360 (ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF));
3362 3361
3363 _sizing_eval(obj); 3362 evas_object_smart_need_recalculate_set(obj, EINA_TRUE);
3364} 3363}
3365 3364
3366EOLIAN static Elm_Toolbar_Shrink_Mode 3365EOLIAN static Elm_Toolbar_Shrink_Mode
@@ -3958,5 +3957,12 @@ _elm_toolbar_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, E
3958 return EINA_FALSE; 3957 return EINA_FALSE;
3959} 3958}
3960 3959
3960EOLIAN void
3961_elm_toolbar_evas_object_smart_calculate(Eo *obj, Elm_Toolbar_Data *pd)
3962{
3963 _sizing_eval(obj);
3964}
3965
3966
3961#include "elm_toolbar.eo.c" 3967#include "elm_toolbar.eo.c"
3962#include "elm_toolbar_item.eo.c" 3968#include "elm_toolbar_item.eo.c"
diff --git a/src/lib/elm_toolbar.eo b/src/lib/elm_toolbar.eo
index 3069c0338..25e6034bc 100644
--- a/src/lib/elm_toolbar.eo
+++ b/src/lib/elm_toolbar.eo
@@ -359,6 +359,7 @@ class Elm.Toolbar (Elm.Widget, Elm_Interface_Scrollable,
359 implements { 359 implements {
360 class.constructor; 360 class.constructor;
361 Eo.Base.constructor; 361 Eo.Base.constructor;
362 Evas.Object_Smart.calculate;
362 Evas.Object_Smart.move; 363 Evas.Object_Smart.move;
363 Evas.Object_Smart.add; 364 Evas.Object_Smart.add;
364 Evas.Object_Smart.del; 365 Evas.Object_Smart.del;