summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVyacheslav Reutskiy <v.reutskiy@samsung.com>2017-11-13 10:50:44 +0200
committerVyacheslav Reutskiy <v.reutskiy@samsung.com>2017-11-13 10:57:19 +0200
commitd498065cb418ccce53f1cb9f3e62f2cfb671e912 (patch)
tree53798ef0f7405ef9101115abbaaa87c21f2bdbe1 /src
parent7764abe8f60e88749c2f2f09383dfdccfb8ce4d2 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/edje/edje_player.c22
-rw-r--r--src/lib/edje/edje_calc.c2
-rw-r--r--src/lib/edje/edje_object.eo1
3 files changed, 24 insertions, 1 deletions
diff --git a/src/bin/edje/edje_player.c b/src/bin/edje/edje_player.c
index a246bf292c..938fabb28d 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
835 _edje_load_or_show_error(obj, file, group); 835 _edje_load_or_show_error(obj, file, group);
836} 836}
837 837
838static void
839_edje_circul(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
840{
841 char buf[1024] = "";
842 Eina_List *parts = event_info;
843 Eina_List *l;
844 char *part_name;
845 char *group = data;
846
847 part_name = eina_list_data_get(eina_list_last(parts));
848 strncat(buf, part_name, strlen(part_name));
849 EINA_LIST_FOREACH(parts, l, part_name)
850 {
851 strncat(buf, " -> ", strlen(" -> "));
852 strncat(buf, part_name, strlen(part_name));
853 }
854
855 fprintf(stderr, "Group '%s' have a circul dependency between parts: %s\n",
856 group, buf);
857}
858
838static Eina_Bool 859static Eina_Bool
839_edje_load_or_show_error(Evas_Object *edje, const char *file, const char *group) 860_edje_load_or_show_error(Evas_Object *edje, const char *file, const char *group)
840{ 861{
@@ -930,6 +951,7 @@ _create_edje(Evas *evas, const struct opts *opts)
930 edje_file_collection_list_free(groups); 951 edje_file_collection_list_free(groups);
931 } 952 }
932 } 953 }
954 evas_object_smart_callback_add(edje, "circular,dependency", _edje_circul, opts->group);
933 955
934 edje_object_size_max_get(edje, &maxw, &maxh); 956 edje_object_size_max_get(edje, &maxw, &maxh);
935 edje_object_size_min_get(edje, &minw, &minh); 957 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 1442cb8f14..f69cdedc7f 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
93 pd_##type->type.orientation.data[2], \ 93 pd_##type->type.orientation.data[2], \
94 pd_##type->type.orientation.data[3]); 94 pd_##type->type.orientation.data[3]);
95 95
96
97void 96void
98_edje_calc_params_clear(Edje_Calc_Params *p) 97_edje_calc_params_clear(Edje_Calc_Params *p)
99{ 98{
@@ -3846,6 +3845,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
3846 strncat(depends_path, part_name, 3845 strncat(depends_path, part_name,
3847 sizeof(depends_path) - strlen(depends_path) - 1); 3846 sizeof(depends_path) - strlen(depends_path) - 1);
3848 } 3847 }
3848 efl_event_callback_legacy_call(ed->obj, EDJE_OBJECT_EVENT_CIRCULAR_DEPENDENCY, clist);
3849 ERR("Circular dependency in the group '%s' : %s", 3849 ERR("Circular dependency in the group '%s' : %s",
3850 ed->group, depends_path); 3850 ed->group, depends_path);
3851 eina_list_free(clist); 3851 eina_list_free(clist);
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index 895f06d0cd..53f2b6a4cc 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,
214 } 214 }
215 events { 215 events {
216 recalc; [[Edje re-calculated the object.]] 216 recalc; [[Edje re-calculated the object.]]
217 circular,dependency; [[Edje found circular dependencies between parts of the object.]]
217 } 218 }
218} 219}