edje: filter means, we can't change any state when we check for match. Delay, we should.

SVN revision: 67763
This commit is contained in:
Cedric BAIL 2012-02-08 14:41:21 +00:00
parent 26c7ebd1e7
commit ed1558ff84
3 changed files with 44 additions and 32 deletions

View File

@ -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.

View File

@ -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 */

View File

@ -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);