From: cedric Date: Wed, 8 Feb 2012 14:41:21 +0000 (+0000) Subject: edje: filter means, we can't change any state when we check for match. Delay, we... X-Git-Tag: 2.0_alpha~74^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eb4865aded2883eecf8533e412c29503aef8b078;p=framework%2Fuifw%2Fedje.git edje: filter means, we can't change any state when we check for match. Delay, we should. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@67763 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/ChangeLog b/ChangeLog index 8226be7..f391098 100644 --- a/ChangeLog +++ b/ChangeLog @@ -327,4 +327,5 @@ * Fix bug when using EDJE_CALC_CACHE and using relative to x and y on separate part. + * Fix bug with filter preventing any action to be triggered. diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index 004538c..cff2853 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -613,6 +613,8 @@ struct _Edje_Program /* a conditional program to be run */ int src; /* part where parameter is being retrieved */ int dst; /* part where parameter is being stored */ } param; + + Eina_Bool exec : 1; }; struct _Edje_Program_Target /* the target of an action */ diff --git a/src/lib/edje_program.c b/src/lib/edje_program.c index f82c99d..98b6b9b 100644 --- a/src/lib/edje_program.c +++ b/src/lib/edje_program.c @@ -1039,10 +1039,8 @@ struct _Edje_Program_Data { #ifdef EDJE_PROGRAM_CACHE Eina_List *matches; - int matched; #endif Edje *ed; - const char *signal; const char *source; }; @@ -1056,24 +1054,10 @@ static Eina_Bool _edje_glob_callback(Edje_Program *pr, void *dt) { rp = _edje_real_part_get(data->ed, pr->filter.part ? pr->filter.part : data->source); if (rp) - exec = (rp->chosen_description->state.name == pr->filter.state); + exec = (rp->chosen_description->state.name == pr->filter.state); } -#ifdef EDJE_PROGRAM_CACHE - data->matched++; -#endif - - if (exec) - _edje_program_run(data->ed, pr, 0, data->signal, data->source); - - if (_edje_block_break(data->ed)) - { -#ifdef EDJE_PROGRAM_CACHE - eina_list_free(data->matches); - data->matches = NULL; -#endif - return EINA_TRUE; - } + pr->exec = exec; #ifdef EDJE_PROGRAM_CACHE data->matches = eina_list_append(data->matches, pr); @@ -1082,7 +1066,6 @@ static Eina_Bool _edje_glob_callback(Edje_Program *pr, void *dt) return EINA_FALSE; } - void _edje_callbacks_patterns_clean(Edje *ed) { @@ -1127,7 +1110,7 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, if (ed->collection && ed->L) _edje_lua2_script_func_signal(ed, sig, src); - + if (ed->collection) { #ifdef EDJE_PROGRAM_CACHE @@ -1156,11 +1139,11 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, if (eina_hash_find(ec->prog_cache.no_matches, tmps)) { - done = 1; + done = 1; } else if ((matches = eina_hash_find(ec->prog_cache.matches, tmps))) { - EINA_LIST_FOREACH(matches, l, pr) + EINA_LIST_FOREACH(matches, l, pr) { Eina_Bool exec = EINA_TRUE; @@ -1169,15 +1152,12 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, Edje_Real_Part *rp; rp = _edje_real_part_get(ed, pr->filter.part ? pr->filter.part : src); - if (rp) - { - if (rp->program) - exec = EINA_FALSE; - else - exec = (rp->chosen_description->state.name == pr->filter.state); - } + if (rp && !rp->program) + exec = (rp->chosen_description->state.name == pr->filter.state); } + pr->exec = exec; +#if 0 if (exec) { _edje_program_run(ed, pr, 0, sig, src); @@ -1186,7 +1166,19 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, goto break_prog; } } +#endif } + + EINA_LIST_FOREACH(matches, l, pr) + if (pr->exec) + { + _edje_program_run(ed, pr, 0, sig, src); + if (_edje_block_break(ed)) + { + goto break_prog; + } + } + done = 1; } } @@ -1197,9 +1189,7 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, data.ed = ed; data.source = src; - data.signal = sig; #ifdef EDJE_PROGRAM_CACHE - data.matched = 0; data.matches = NULL; #endif if (ed->table_programs_size > 0) @@ -1223,12 +1213,31 @@ _edje_emit_handle(Edje *ed, const char *sig, const char *src, ed->patterns.programs.exact_match); EINA_LIST_FOREACH(match, l, pr) _edje_glob_callback(pr, &data); + +#ifdef EDJE_PROGRAM_CACHE + EINA_LIST_FOREACH(data.matches, l, pr) +#else + EINA_LIST_FREE(data.matches, pr) +#endif + { + if (pr->exec) + _edje_program_run(ed, pr, 0, sig, src); + + if (_edje_block_break(ed)) + { +#ifdef EDJE_PROGRAM_CACHE + eina_list_free(data.matches); + data.matches = NULL; +#endif + goto break_prog; + } + } } #ifdef EDJE_PROGRAM_CACHE if (tmps) { - if (data.matched == 0) + if (data.matches == NULL) { if (!ec->prog_cache.no_matches) ec->prog_cache.no_matches = eina_hash_string_superfast_new(NULL);