From d498065cb418ccce53f1cb9f3e62f2cfb671e912 Mon Sep 17 00:00:00 2001 From: Vyacheslav Reutskiy Date: Mon, 13 Nov 2017 10:50:44 +0200 Subject: [PATCH] edje: add event for inform about circular dependency This commit add the event "circular,dependency" for edje object. Given event is called when edje found the circular dependency between parts in object. This event will be usefull and informative paired with Edje_Edit API. --- src/bin/edje/edje_player.c | 22 ++++++++++++++++++++++ src/lib/edje/edje_calc.c | 2 +- src/lib/edje/edje_object.eo | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/bin/edje/edje_player.c b/src/bin/edje/edje_player.c index a246bf2..938fabb 100644 --- a/src/bin/edje/edje_player.c +++ b/src/bin/edje/edje_player.c @@ -835,6 +835,27 @@ _edje_reload(void *data EINA_UNUSED, Evas_Object *obj, const char *emission EINA _edje_load_or_show_error(obj, file, group); } +static void +_edje_circul(void *data, Evas_Object *obj EINA_UNUSED, void *event_info) +{ + char buf[1024] = ""; + Eina_List *parts = event_info; + Eina_List *l; + char *part_name; + char *group = data; + + part_name = eina_list_data_get(eina_list_last(parts)); + strncat(buf, part_name, strlen(part_name)); + EINA_LIST_FOREACH(parts, l, part_name) + { + strncat(buf, " -> ", strlen(" -> ")); + strncat(buf, part_name, strlen(part_name)); + } + + fprintf(stderr, "Group '%s' have a circul dependency between parts: %s\n", + group, buf); +} + static Eina_Bool _edje_load_or_show_error(Evas_Object *edje, const char *file, const char *group) { @@ -930,6 +951,7 @@ _create_edje(Evas *evas, const struct opts *opts) edje_file_collection_list_free(groups); } } + evas_object_smart_callback_add(edje, "circular,dependency", _edje_circul, opts->group); edje_object_size_max_get(edje, &maxw, &maxh); edje_object_size_min_get(edje, &minw, &minh); diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 1442cb8..f69cded 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -93,7 +93,6 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Rea pd_##type->type.orientation.data[2], \ pd_##type->type.orientation.data[3]); - void _edje_calc_params_clear(Edje_Calc_Params *p) { @@ -3846,6 +3845,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta strncat(depends_path, part_name, sizeof(depends_path) - strlen(depends_path) - 1); } + efl_event_callback_legacy_call(ed->obj, EDJE_OBJECT_EVENT_CIRCULAR_DEPENDENCY, clist); ERR("Circular dependency in the group '%s' : %s", ed->group, depends_path); eina_list_free(clist); diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo index 895f06d..53f2b6a 100644 --- a/src/lib/edje/edje_object.eo +++ b/src/lib/edje/edje_object.eo @@ -214,5 +214,6 @@ class Edje.Object (Efl.Canvas.Group, Efl.File, Efl.Container, Efl.Part, } events { recalc; [[Edje re-calculated the object.]] + circular,dependency; [[Edje found circular dependencies between parts of the object.]] } } -- 2.7.4