edje: filter means, we can't change any state when we check for match. Delay, we...
authorcedric <cedric>
Wed, 8 Feb 2012 14:41:21 +0000 (14:41 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 8 Feb 2012 14:41:21 +0000 (14:41 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@67763 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/edje_private.h
src/lib/edje_program.c

index 8226be7..f391098 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * 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.
 
index 004538c..cff2853 100644 (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 */
index f82c99d..98b6b9b 100644 (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);