From 9876a78fd37c20e96373434b5d129da48bc8bb66 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Sat, 16 Nov 2019 14:22:48 +0000 Subject: [PATCH] edje - box - calc min size correctly at start ... this fixes a logic hole where no chosen desc has been applied yet to a box and thus it has no start layout thus no way to calc a min size. this breaks min size calcs you do when setting up and object. this fixes that by forcing the chosen desk on a min size calc so there is one. @fix --- src/lib/edje/edje_box_layout.c | 5 ++-- src/lib/edje/edje_calc.c | 42 +++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/lib/edje/edje_box_layout.c b/src/lib/edje/edje_box_layout.c index a1c0d6048a..a3458cf281 100644 --- a/src/lib/edje/edje_box_layout.c +++ b/src/lib/edje/edje_box_layout.c @@ -107,7 +107,8 @@ static void _edje_box_layout(Evas_Object *obj, Evas_Object_Box_Data *priv, void *data) { Edje_Part_Box_Animation *anim = data; - if (anim->progress < 0.01) + + if (anim->progress == 0.0) { if (anim->start.layout) { @@ -194,7 +195,7 @@ _edje_box_recalc_apply(Edje *ed EINA_UNUSED, Edje_Real_Part *ep, Edje_Calc_Param ep->typedata.container->anim->end.layout = NULL; } - if (ep->description_pos < 0.01 || !ep->typedata.container->anim->start.layout) + if (ep->description_pos == 0.0 || !ep->typedata.container->anim->start.layout) { _edje_box_layout_find_all(chosen_desc->box.layout, chosen_desc->box.alt_layout, &ep->typedata.container->anim->start.layout, &ep->typedata.container->anim->start.data, &ep->typedata.container->anim->start.free_data); ep->typedata.container->anim->start.padding.x = chosen_desc->box.padding.x; diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index c636abed95..5e1ce0bcae 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -2965,6 +2965,22 @@ _edje_part_recalc_single_mesh0(Edje_Calc_Params *params, params->type.node->scale_3d.z = mesh_desc->mesh_node.scale_3d.z; } +static void +_edje_table_recalc_apply(Edje *ed EINA_UNUSED, + Edje_Real_Part *ep, + Edje_Calc_Params *p3 EINA_UNUSED, + Edje_Part_Description_Table *chosen_desc) +{ + evas_obj_table_homogeneous_set(ep->object, chosen_desc->table.homogeneous); + evas_obj_table_align_set(ep->object, TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y)); + evas_obj_table_padding_set(ep->object, chosen_desc->table.padding.x, chosen_desc->table.padding.y); + if (evas_object_smart_need_recalculate_get(ep->object)) + { + efl_canvas_group_need_recalculate_set(ep->object, 0); + efl_canvas_group_calculate(ep->object); + } +} + static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, @@ -3086,13 +3102,19 @@ _edje_part_recalc_single(Edje *ed, // limit size if needed if (((((Edje_Part_Description_Table *)chosen_desc)->table.min.h) || (((Edje_Part_Description_Table *)chosen_desc)->table.min.v))) - _edje_part_recalc_single_table(ep, chosen_desc, &minw, &minh); + { + _edje_table_recalc_apply(ed, ep, params, (Edje_Part_Description_Table *)chosen_desc); + _edje_part_recalc_single_table(ep, chosen_desc, &minw, &minh); + } break; case EDJE_PART_TYPE_BOX: // limit size if needed if ((((Edje_Part_Description_Box *)chosen_desc)->box.min.h) || (((Edje_Part_Description_Box *)chosen_desc)->box.min.v)) - _edje_part_recalc_single_box(ep, chosen_desc, &minw, &minh); + { + _edje_box_recalc_apply(ed, ep, params, (Edje_Part_Description_Box *)chosen_desc); + _edje_part_recalc_single_box(ep, chosen_desc, &minw, &minh); + } break; case EDJE_PART_TYPE_IMAGE: _edje_part_recalc_single_image0(ed, ep, params, (Edje_Part_Description_Image *)desc, pos); @@ -3160,22 +3182,6 @@ _edje_part_recalc_single(Edje *ed, _edje_part_recalc_single_map(ed, ep, center, zoom_center, light, persp, desc, chosen_desc, params); } -static void -_edje_table_recalc_apply(Edje *ed EINA_UNUSED, - Edje_Real_Part *ep, - Edje_Calc_Params *p3 EINA_UNUSED, - Edje_Part_Description_Table *chosen_desc) -{ - evas_obj_table_homogeneous_set(ep->object, chosen_desc->table.homogeneous); - evas_obj_table_align_set(ep->object, TO_DOUBLE(chosen_desc->table.align.x), TO_DOUBLE(chosen_desc->table.align.y)); - evas_obj_table_padding_set(ep->object, chosen_desc->table.padding.x, chosen_desc->table.padding.y); - if (evas_object_smart_need_recalculate_get(ep->object)) - { - efl_canvas_group_need_recalculate_set(ep->object, 0); - efl_canvas_group_calculate(ep->object); - } -} - static void _edje_proxy_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description_Proxy *chosen_desc, FLOAT_T pos) {