1. fixed some inefficient edje loading - moved checks to the cache code where
authorCarsten Haitzler <raster@rasterman.com>
Mon, 22 Jan 2007 12:44:57 +0000 (12:44 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Mon, 22 Jan 2007 12:44:57 +0000 (12:44 +0000)
it sould be
2. fixed edje handling of delete of objects so we don't lose clip info if we
move a swallowed object out
3. fix up norender stuff for evas a bit
4. pants.

5. coogee beach (sydney) in summer right now is beatiful - KICK ASS!

SVN revision: 28102

legacy/edje/src/lib/edje_cache.c
legacy/edje/src/lib/edje_load.c
legacy/edje/src/lib/edje_smart.c
legacy/evas/src/lib/canvas/evas_callbacks.c
legacy/evas/src/lib/canvas/evas_object_image.c
legacy/evas/src/lib/canvas/evas_render.c
legacy/evas/src/lib/include/evas_private.h

index fa83080..7345072 100644 (file)
@@ -124,7 +124,7 @@ Edje_File *
 _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
 {
    Edje_File *edf;
-   Evas_List *l;
+   Evas_List *l, *hist;
    Edje_Part_Collection *edc;
 
    edf = evas_hash_find(_edje_file_hash, file);
@@ -184,6 +184,72 @@ _edje_cache_file_coll_open(const char *file, const char *coll, int *error_ret, E
          {
             *error_ret = EDJE_LOAD_ERROR_UNKNOWN_COLLECTION;
          }
+       else
+         {
+            for (l = edc->parts; l; l = l->next)
+              {
+                 Edje_Part *ep, *ep2;
+                 
+                 /* Register any color classes in this parts descriptions. */
+                 ep = l->data;
+                 hist = NULL;
+                 hist = evas_list_append(hist, ep);
+                 ep2 = ep;
+                 while (ep2->dragable.confine_id >= 0)
+                   {
+                      ep2 = evas_list_nth(edc->parts, ep2->dragable.confine_id);
+                      if (evas_list_find(hist, ep2))
+                        {
+                           printf("EDJE ERROR: confine_to loops. invalidating loop.\n");
+                           ep2->dragable.confine_id = -1;
+                           break;
+                        }
+                      hist = evas_list_append(hist, ep2);
+                   }
+                 evas_list_free(hist);
+                 hist = NULL;
+                 hist = evas_list_append(hist, ep);
+                 ep2 = ep;
+                 while (ep2->dragable.events_id >= 0)
+                   {
+                      Edje_Part* prev;
+                      
+                      prev = ep2;
+                      
+                      ep2 = evas_list_nth(edc->parts, ep2->dragable.events_id);
+                      if (!ep2->dragable.x && !ep2->dragable.y)
+                        {
+                           prev->dragable.events_id = -1;
+                           break;
+                        }
+                      
+                      if (evas_list_find(hist, ep2))
+                        {
+                           printf("EDJE ERROR: events_to loops. invalidating loop.\n");
+                           ep2->dragable.events_id = -1;
+                           break;
+                        }
+                      hist = evas_list_append(hist, ep2);
+                   }
+                 evas_list_free(hist);
+                 hist = NULL;
+                 hist = evas_list_append(hist, ep);
+                 ep2 = ep;
+                 while (ep2->clip_to_id >= 0)
+                   {
+                      ep2 = evas_list_nth(edc->parts, ep2->clip_to_id);
+                      if (evas_list_find(hist, ep2))
+                        {
+                           printf("EDJE ERROR: clip_to loops. invalidating loop.\n");
+                           ep2->clip_to_id = -1;
+                           break;
+                        }
+                      hist = evas_list_append(hist, ep2);
+                   }
+                 evas_list_free(hist);
+                 hist = NULL;
+              }
+         }
      }
    if (edc_ret) *edc_ret = edc;
    
index bd483aa..49e204b 100644 (file)
@@ -55,12 +55,12 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
        Evas_List *l;
        int errors = 0;
 
-       /* check for invalid loops */
+       /* colorclass stuff */
        for (l = ed->collection->parts; (l && ! errors); l = l->next)
          {
             Edje_Part *ep;
             Evas_List *hist = NULL;
-
+            
             /* Register any color classes in this parts descriptions. */
             ep = l->data;
             if ((ep->default_desc) && (ep->default_desc->color_class)) 
@@ -72,63 +72,6 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
                  desc = hist->data;
                  if (desc->color_class) _edje_color_class_member_add(ed, desc->color_class);
               }
-            hist = NULL;
-            hist = evas_list_append(hist, ep);
-            while (ep->dragable.confine_id >= 0)
-              {
-                 ep = evas_list_nth(ed->collection->parts,
-                                    ep->dragable.confine_id);
-                 if (evas_list_find(hist, ep))
-                   {
-                      printf("EDJE ERROR: confine_to loops. invalidating loop.\n");
-                      ep->dragable.confine_id = -1;
-                      break;
-                   }
-                 hist = evas_list_append(hist, ep);
-              }
-            evas_list_free(hist);
-            hist = NULL;
-            hist = evas_list_append(hist, ep);
-            while (ep->dragable.events_id >= 0)
-              {
-                 Edje_Part* prev;
-
-                 prev = ep;
-
-                 ep = evas_list_nth(ed->collection->parts,
-                                    ep->dragable.events_id);
-                 
-                 if (!ep->dragable.x && !ep->dragable.y)
-                   {
-                      prev->dragable.events_id = -1;
-                      break;
-                   }
-
-                 if (evas_list_find(hist, ep))
-                   {
-                      printf("EDJE ERROR: events_to loops. invalidating loop.\n");
-                      ep->dragable.events_id = -1;
-                      break;
-                   }
-                 hist = evas_list_append(hist, ep);
-              }
-            evas_list_free(hist);
-            hist = NULL;
-            hist = evas_list_append(hist, ep);
-            while (ep->clip_to_id >= 0)
-              {
-                 ep = evas_list_nth(ed->collection->parts,
-                                    ep->clip_to_id);
-                 if (evas_list_find(hist, ep))
-                   {
-                      printf("EDJE ERROR: clip_to loops. invalidating loop.\n");
-                      ep->clip_to_id = -1;
-                      break;
-                   }
-                 hist = evas_list_append(hist, ep);
-              }
-            evas_list_free(hist);
-            hist = NULL;
          }
        /* build real parts */
        for (n = 0, l = ed->collection->parts; l; l = l->next, n++)
@@ -222,6 +165,7 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
          }
        if (n > 0)
          {
+            /* FIXME: keeping a table AND a list is just bad - nuke list */
             ed->table_parts = malloc(sizeof(Edje_Real_Part *) * n);
             ed->table_parts_size = n;
             /* FIXME: check malloc return */
@@ -285,6 +229,7 @@ edje_object_file_set(Evas_Object *obj, const char *file, const char *part)
        n = evas_list_count(ed->collection->programs);
        if (n > 0)
          {
+            /* FIXME: keeping a table AND a list is just bad - nuke list */
             ed->table_programs = malloc(sizeof(Edje_Program *) * n);
             ed->table_programs_size = n;
             /* FIXME: check malloc return */
index a275acb..e5188e1 100644 (file)
@@ -56,6 +56,19 @@ _edje_smart_add(Evas_Object * obj)
    evas_object_smart_data_set(obj, ed);
    ed->obj = obj;
    _edje_edjes = evas_list_append(_edje_edjes, obj);
+/*   
+     {
+       Evas_List *l;
+       
+       printf("--- EDJE DUMP [%i]\n", evas_list_count(_edje_edjes));
+       for (l = _edje_edjes; l; l = l->next)
+         {
+            ed = _edje_fetch(l->data);
+            printf("EDJE: %80s | %80s\n", ed->path, ed->part);
+         }
+       printf("--- EDJE DUMP [%i]\n", evas_list_count(_edje_edjes));
+     }
+ */
 }
 
 static void
@@ -71,6 +84,7 @@ _edje_smart_del(Evas_Object * obj)
    _edje_edjes = evas_list_remove(_edje_edjes, obj);
    evas_object_smart_data_set(obj, NULL);
    _edje_unref(ed);
+   _edje_file_del(ed);
 }
 
 static void 
index bc108a9..5297aee 100644 (file)
@@ -45,6 +45,7 @@ evas_object_event_callback_clear(Evas_Object *obj)
    if (!obj->callbacks) return;
    if (!obj->callbacks->deletions_waiting) return;
    obj->callbacks->deletions_waiting = 0;
+/*   
    evas_object_event_callback_list_post_free(&(obj->callbacks->in));
    evas_object_event_callback_list_post_free(&(obj->callbacks->out));
    evas_object_event_callback_list_post_free(&(obj->callbacks->down));
@@ -81,6 +82,13 @@ evas_object_event_callback_clear(Evas_Object *obj)
        free(obj->callbacks);
        obj->callbacks = NULL;
      }
+ */
+   evas_object_event_callback_list_post_free(&obj->callbacks->callbacks);
+   if (!obj->callbacks->callbacks)
+     {
+        free(obj->callbacks);
+       obj->callbacks = NULL;
+     }
 }
 
 void
@@ -88,6 +96,7 @@ evas_object_event_callback_cleanup(Evas_Object *obj)
 {
    /* MEM OK */
    if (!obj->callbacks) return;
+   /*
    evas_object_event_callback_list_free(&(obj->callbacks->in));
    evas_object_event_callback_list_free(&(obj->callbacks->out));
    evas_object_event_callback_list_free(&(obj->callbacks->down));
@@ -106,6 +115,10 @@ evas_object_event_callback_cleanup(Evas_Object *obj)
    evas_object_event_callback_list_free(&(obj->callbacks->obj_restack));
    free(obj->callbacks);
    obj->callbacks = NULL;
+    */
+   evas_object_event_callback_list_post_free(&obj->callbacks->callbacks);
+   free(obj->callbacks);
+   obj->callbacks = NULL;
 }
 
 void
@@ -121,6 +134,7 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void
      
    if (obj->callbacks)
      {
+       /*
         switch (type)
           {
              case EVAS_CALLBACK_MOUSE_IN:
@@ -196,13 +210,46 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void
                return;
                break;
           }
+       */      
+       l_mod = &obj->callbacks->callbacks;
+        switch (type)
+          {
+             case EVAS_CALLBACK_MOUSE_DOWN:
+               {
+                  Evas_Event_Mouse_Down *ev = event_info;
+                  
+                  flags = ev->flags;
+                 if (ev->flags & (EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK))
+                   {
+                      if (obj->last_mouse_down_counter < (e->last_mouse_down_counter - 1))
+                        ev->flags &= ~(EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK);
+                   }
+                  obj->last_mouse_down_counter = e->last_mouse_down_counter;
+                 break;
+               }
+             case EVAS_CALLBACK_MOUSE_UP:
+               {
+                  Evas_Event_Mouse_Up *ev = event_info;
+                  
+                  flags = ev->flags;
+                 if (ev->flags & (EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK))
+                   {
+                      if (obj->last_mouse_up_counter < (e->last_mouse_up_counter - 1))
+                        ev->flags &= ~(EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK);
+                   }
+                  obj->last_mouse_up_counter = e->last_mouse_up_counter;
+                 break;
+               }
+             default:
+               break;
+          }
         obj->callbacks->walking_list++;
         for (l = *l_mod; l; l = l->next)
           {
             Evas_Func_Node *fn;
 
             fn = (Evas_Func_Node *)l;
-            if (!fn->delete_me)
+            if ((fn->type == type) && (!fn->delete_me))
               {
                  if (fn->func)
                    fn->func(fn->data, obj->layer->evas, obj, event_info);
@@ -226,8 +273,7 @@ evas_object_event_callback_call(Evas_Object *obj, Evas_Callback_Type type, void
      }
    
    if ((obj->no_propagate) && (l_mod) && (*l_mod)) return;
-   if ((obj->smart.parent) &&
-       (type != EVAS_CALLBACK_FREE) &&
+   if ((obj->smart.parent) && (type != EVAS_CALLBACK_FREE) &&
        (type <= EVAS_CALLBACK_KEY_UP))
      evas_object_event_callback_call(obj->smart.parent, type, event_info);
 }
@@ -417,6 +463,7 @@ evas_object_event_callback_add(Evas_Object *obj, Evas_Callback_Type type, void (
    if (!fn) return;
    fn->func = func;
    fn->data = (void *)data;
+   fn->type = type;
 
    if (!obj->callbacks)
      obj->callbacks = evas_mem_calloc(sizeof(Evas_Callbacks));
@@ -425,6 +472,7 @@ evas_object_event_callback_add(Evas_Object *obj, Evas_Callback_Type type, void (
        free(fn);
        return;
      }
+   /*
    switch (type)
      {
       case EVAS_CALLBACK_MOUSE_IN:
@@ -481,6 +529,9 @@ evas_object_event_callback_add(Evas_Object *obj, Evas_Callback_Type type, void (
        break;
      }
    *l_mod = evas_object_list_append(*l_mod, fn);
+    */
+   obj->callbacks->callbacks = 
+     evas_object_list_append(obj->callbacks->callbacks, fn);
 }
 
 /**
@@ -521,6 +572,7 @@ evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, void (
 
    if (!obj->callbacks) return NULL;
 
+   /*
    switch (type)
      {
       case EVAS_CALLBACK_MOUSE_IN:
@@ -592,5 +644,23 @@ evas_object_event_callback_del(Evas_Object *obj, Evas_Callback_Type type, void (
             return data;
          }
      }
+    */
+   for (l = obj->callbacks->callbacks; l; l = l->next)
+     {
+       Evas_Func_Node *fn;
+
+       fn = (Evas_Func_Node *)l;
+       if ((fn->func == func) && (fn->type == type) && (!fn->delete_me))
+         {
+            void *data;
+
+            data = fn->data;
+            fn->delete_me = 1;
+            obj->callbacks->deletions_waiting = 1;
+            if (!obj->callbacks->walking_list)
+              evas_object_event_callback_clear(obj);
+            return data;
+         }
+     }
    return NULL;
 }
index 01ab11c..d20a3da 100644 (file)
@@ -1707,6 +1707,11 @@ evas_object_image_render(Evas_Object *obj, void *output, void *context, void *su
                    }
                  else
                    ih = ((int)(idy + idh)) - iy;
+///              printf("  IMG: %ix%i -> %i %i | %ix%i\n",
+///                     o->cur.image.w, o->cur.image.h,
+///                     obj->cur.geometry.x + idx,
+///                     obj->cur.geometry.y + idy,
+///                     iw, ih);
                  if ((o->cur.border.l == 0) &&
                      (o->cur.border.r == 0) &&
                      (o->cur.border.t == 0) &&
index fe1c823..0878ff1 100644 (file)
@@ -278,99 +278,117 @@ evas_render_updates_internal(Evas *e, unsigned char make_updates, unsigned char
    obscuring_objects_orig = obscuring_objects;
    obscuring_objects = NULL;
    /* phase 6. go thru each update rect and render objects in it*/
-   while ((surface =
-          e->engine.func->output_redraws_next_update_get(e->engine.data.output,
-                                                        &ux, &uy, &uw, &uh,
-                                                        &cx, &cy, &cw, &ch)))
+   if (do_draw)
      {
-       int off_x, off_y;
-
-       if (make_updates)
-         {
-           Evas_Rectangle *rect;
-
-           rect = malloc(sizeof(Evas_Rectangle));
-           if (rect)
-             {
-               rect->x = ux; rect->y = uy; rect->w = uw; rect->h = uh;
-               updates = evas_list_append(updates, rect);
-             }
-         }
-       off_x = cx - ux;
-       off_y = cy - uy;
-       /* build obscuring objects list (in order from bottom to top) */
-       for (ll = obscuring_objects_orig; ll; ll = ll->next)
-         {
-            Evas_Object *obj;
-
-            obj = (Evas_Object *)(ll->data);
-            if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh))
-              obscuring_objects = evas_list_append(obscuring_objects, obj);
-         }
-       /* render all object that intersect with rect */
-       for (ll = active_objects; ll; ll = ll->next)
+       while ((surface =
+               e->engine.func->output_redraws_next_update_get(e->engine.data.output,
+                                                              &ux, &uy, &uw, &uh,
+                                                              &cx, &cy, &cw, &ch)))
          {
-            Evas_Object *obj;
-            Evas_List *l3;
-            obj = (Evas_Object *)(ll->data);
-
-            /* if it's in our outpout rect and it doesn't clip anything */
-            if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh) &&
-                (!obj->clip.clipees) &&
-                (obj->cur.visible) &&
-                (!obj->delete_me) &&
-                (obj->cur.cache.clip.visible) &&
-                (!obj->smart.smart) &&
-                (obj->cur.color.a > 0))
+            int off_x, off_y;
+            
+            if (make_updates)
               {
-                 int x, y, w, h;
-
-                 if ((obscuring_objects) && (obscuring_objects->data == obj))
-                   obscuring_objects = evas_list_remove(obscuring_objects, obj);
-                 x = cx; y = cy; w = cw; h = ch;
-                 RECTS_CLIP_TO_RECT(x, y, w, h,
-                                    obj->cur.cache.clip.x + off_x,
-                                    obj->cur.cache.clip.y + off_y,
-                                    obj->cur.cache.clip.w,
-                                    obj->cur.cache.clip.h);
-                 if ((w > 0) && (h > 0) && (do_draw))
+                 Evas_Rectangle *rect;
+                 
+                 rect = malloc(sizeof(Evas_Rectangle));
+                 if (rect)
                    {
-                      e->engine.func->context_clip_set(e->engine.data.output,
-                                                       e->engine.data.context,
-                                                       x, y, w, h);
-#if 1 /* FIXME: this can slow things down... figure out optimum... coverage */
-                      for (l3 = obscuring_objects; l3; l3 = l3->next)
+                      rect->x = ux; rect->y = uy; rect->w = uw; rect->h = uh;
+                      updates = evas_list_append(updates, rect);
+                   }
+              }
+            off_x = cx - ux;
+            off_y = cy - uy;
+            /* build obscuring objects list (in order from bottom to top) */
+            for (ll = obscuring_objects_orig; ll; ll = ll->next)
+              {
+                 Evas_Object *obj;
+                 
+                 obj = (Evas_Object *)(ll->data);
+                 if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh))
+                   obscuring_objects = evas_list_append(obscuring_objects, obj);
+              }
+            /* render all object that intersect with rect */
+            for (ll = active_objects; ll; ll = ll->next)
+              {
+                 Evas_Object *obj;
+                 Evas_List *l3;
+                 obj = (Evas_Object *)(ll->data);
+                 
+                 /* if it's in our outpout rect and it doesn't clip anything */
+                 if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh) &&
+                     (!obj->clip.clipees) &&
+                     (obj->cur.visible) &&
+                     (!obj->delete_me) &&
+                     (obj->cur.cache.clip.visible) &&
+                     (!obj->smart.smart) &&
+                     (obj->cur.color.a > 0))
+                   {
+                      int x, y, w, h;
+                      
+                      if ((obscuring_objects) && (obscuring_objects->data == obj))
+                        obscuring_objects = evas_list_remove(obscuring_objects, obj);
+                      x = cx; y = cy; w = cw; h = ch;
+                      RECTS_CLIP_TO_RECT(x, y, w, h,
+                                         obj->cur.cache.clip.x + off_x,
+                                         obj->cur.cache.clip.y + off_y,
+                                         obj->cur.cache.clip.w,
+                                         obj->cur.cache.clip.h);
+                      if ((w > 0) && (h > 0))
                         {
-                           Evas_Object *obj2;
-
-                           obj2 = (Evas_Object *)l3->data;
-                           e->engine.func->context_cutout_add(e->engine.data.output,
-                                                              e->engine.data.context,
-                                                              obj2->cur.cache.clip.x + off_x,
-                                                              obj2->cur.cache.clip.y + off_y,
-                                                              obj2->cur.cache.clip.w,
-                                                              obj2->cur.cache.clip.h);
-                        }
+///                   printf("CLIP: %p | %i %i, %ix%i | %p %i %i %ix%i\n",
+///                          obj,
+///                          x, y, w, h,
+///                          obj->cur.clipper,
+///                          obj->cur.cache.clip.x + off_x,
+///                          obj->cur.cache.clip.y + off_y,
+///                          obj->cur.cache.clip.w,
+///                          obj->cur.cache.clip.h
+///                          );
+///                        if (((obj->cur.cache.clip.x + off_x) == 0) &&
+///                            ((obj->cur.cache.clip.w) == 960))
+///                          {
+///                             abort();
+///                          }
+                        
+                           e->engine.func->context_clip_set(e->engine.data.output,
+                                                            e->engine.data.context,
+                                                            x, y, w, h);
+#if 1 /* FIXME: this can slow things down... figure out optimum... coverage */
+                           for (l3 = obscuring_objects; l3; l3 = l3->next)
+                             {
+                                Evas_Object *obj2;
+                                
+                                obj2 = (Evas_Object *)l3->data;
+                                e->engine.func->context_cutout_add(e->engine.data.output,
+                                                                   e->engine.data.context,
+                                                                   obj2->cur.cache.clip.x + off_x,
+                                                                   obj2->cur.cache.clip.y + off_y,
+                                                                   obj2->cur.cache.clip.w,
+                                                                   obj2->cur.cache.clip.h);
+                             }
 #endif
-                      obj->func->render(obj,
-                                        e->engine.data.output,
-                                        e->engine.data.context,
-                                        surface,
-                                        off_x, off_y);
-                      e->engine.func->context_cutout_clear(e->engine.data.output,
-                                                           e->engine.data.context);
+                           obj->func->render(obj,
+                                             e->engine.data.output,
+                                             e->engine.data.context,
+                                             surface,
+                                             off_x, off_y);
+                           e->engine.func->context_cutout_clear(e->engine.data.output,
+                                                                e->engine.data.context);
+                        }
                    }
               }
+            /* punch rect out */
+            e->engine.func->output_redraws_next_update_push(e->engine.data.output,
+                                                            surface,
+                                                            ux, uy, uw, uh);
+            /* free obscuring objects list */
+            obscuring_objects = evas_list_free(obscuring_objects);
          }
-       /* punch rect out */
-       e->engine.func->output_redraws_next_update_push(e->engine.data.output,
-                                                      surface,
-                                                      ux, uy, uw, uh);
-       /* free obscuring objects list */
-       obscuring_objects = evas_list_free(obscuring_objects);
+       /* flush redraws */
+       e->engine.func->output_flush(e->engine.data.output);
      }
-   /* flush redraws */
-   e->engine.func->output_flush(e->engine.data.output);
    /* clear redraws */
    e->engine.func->output_redraws_clear(e->engine.data.output);
    /* and do a post render pass */
index ebd885f..f519834 100644 (file)
@@ -247,6 +247,8 @@ struct _Evas_Callbacks
 {
    unsigned char     deletions_waiting : 1;
    int               walking_list;
+   Evas_Object_List *callbacks;
+/*   
    Evas_Object_List *down;
    Evas_Object_List *up;
    Evas_Object_List *move;
@@ -263,6 +265,7 @@ struct _Evas_Callbacks
    Evas_Object_List *obj_move;
    Evas_Object_List *obj_resize;
    Evas_Object_List *obj_restack;
+ */
 };
 
 struct _Evas
@@ -449,9 +452,10 @@ struct _Evas_Object
 struct _Evas_Func_Node
 {
    Evas_Object_List  _list_data;
-   char delete_me : 1;
    void (*func) (void *data, Evas *e, Evas_Object *obj, void *event_info);
    void *data;
+   Evas_Callback_Type type;
+   char delete_me : 1;
 };
 
 struct _Evas_Data_Node