On Tue, Sep 9, 2008 at 9:34 PM, Gustavo Sverzut Barbieri
<[EMAIL PROTECTED]> wrote:
> On Tue, Sep 9, 2008 at 9:14 PM, Gustavo Sverzut Barbieri
> <[EMAIL PROTECTED]> wrote:
>> On Tue, Sep 9, 2008 at 8:41 PM,  <[EMAIL PROTECTED]> wrote:
>>> Author:       barbieri
>>> Date:         2008-09-09 16:41:42 -0700 (Tue, 09 Sep 2008)
>>> New Revision: 35908
>>>
>>> Modified:
>>>  trunk/edje/src/lib/edje_calc.c trunk/edje/src/lib/edje_private.h 
>>> trunk/edje/src/lib/edje_smart.c trunk/edje/src/lib/edje_util.c
>>> Log:
>>>
>>> Revert edje calculate optimizations.
>>>
>>> Edje is tricky, it's event processing is too weird and Cedric's
>>> changes to make it work are not working as expected. Edje freezes
>>> itself while processing signals, but in mouse down cb it forces
>>> recalculate, which seems was previously ignored, but now they are not.
>>>
>>> We should look at how to fix this and then re-apply this patch.
>>
>> Attached is a patch to attempt to fix the issues. It will not look for
>> postponed flag before recalculate (postpone does not force it anymore)
>> and for input event callbacks it will force recalculation with
>> _edje_recalc_do().
>>
>> I grep'ed for other _edje_recalc() code, there are some suspicious
>> cases in edje_program(), it would be great if people with
>> embryo-intensive applications could apply this patch and report if
>> there are problems.
>
> As  I suspected, edje_program.c code does need to forcelly call
> _edje_recalc_do(). Attached are two patches, the preferred one that
> just forces recalc after scripts (embryo) run and another that forces
> it after all kind of programs run. Please try the preferred and if it
> does not work try alternative. Please report which one worked or
> failed.

update of patch so it applies nicely to current svn. Nothing else changed.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [EMAIL PROTECTED]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
Index: src/lib/edje_program.c
===================================================================
--- src/lib/edje_program.c	(revision 36009)
+++ src/lib/edje_program.c	(working copy)
@@ -783,7 +783,7 @@ _edje_program_run(Edje *ed, Edje_Program *pr, int
 	_edje_embryo_test_run(ed, fname, ssig, ssrc);
 	_edje_emit(ed, "program,stop", pr->name);
 	if (_edje_block_break(ed)) goto break_prog;
-	_edje_recalc(ed);
+	_edje_recalc_do(ed);
      }
    else
      {
Index: src/lib/edje_util.c
===================================================================
--- src/lib/edje_util.c	(revision 36009)
+++ src/lib/edje_util.c	(working copy)
@@ -787,6 +787,10 @@ edje_object_part_object_get(const Evas_Object *obj
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!part)) return NULL;
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp) return NULL;
    return rp->object;
@@ -820,6 +824,10 @@ edje_object_part_geometry_get(const Evas_Object *o
 	if (h) *h = 0;
 	return;
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp)
      {
@@ -900,6 +908,10 @@ edje_object_part_text_get(const Evas_Object *obj,
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!part)) return NULL;
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp) return NULL;
    if (rp->part->type == EDJE_PART_TYPE_TEXT)
@@ -927,6 +939,10 @@ edje_object_part_swallow(Evas_Object *obj, const c
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!part)) return;
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp) return;
    if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return;
@@ -1093,7 +1109,7 @@ edje_object_part_unswallow(Evas_Object *obj, Evas_
 	rp->swallow_params.max.w = 0;
 	rp->swallow_params.max.h = 0;
 	rp->edje->dirty = 1;
-	_edje_recalc(rp->edje);
+	_edje_recalc_do(rp->edje);
 	return;
      }
 }
@@ -1111,6 +1127,10 @@ edje_object_part_swallow_get(const Evas_Object *ob
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!part)) return NULL;
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp) return NULL;
    return rp->swallowed_object;
@@ -1160,6 +1180,10 @@ edje_object_size_max_get(const Evas_Object *obj, E
 	if (maxh) *maxh = 0;
 	return;
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    if (ed->collection->prop.max.w == 0)
      {
 	/* XXX TODO: convert maxw to 0, fix things that break. */
@@ -1202,7 +1226,7 @@ edje_object_calc_force(Evas_Object *obj)
    _edje_freeze_val = 0;
    ed->freeze = 0;
    
-   _edje_recalc(ed);
+   _edje_recalc_do(ed);
    
    ed->freeze = pf;
    _edje_freeze_val = pf2;
@@ -1266,7 +1290,7 @@ edje_object_size_min_restricted_calc(Evas_Object *
 
 	ok = 0;
 	ed->dirty = 1;
-	_edje_recalc(ed);
+	_edje_recalc_do(ed);
 	if (reset_maxwh)
 	  {
 	     maxw = 0;
@@ -1370,6 +1394,10 @@ edje_object_part_state_get(const Evas_Object *obj,
 	if (val_ret) *val_ret = 0;
 	return "";
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp)
      {
@@ -1414,6 +1442,10 @@ edje_object_part_drag_dir_get(const Evas_Object *o
 
    ed = _edje_fetch(obj);
    if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE;
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp) return EDJE_DRAG_DIR_NONE;
    if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY;
@@ -1478,6 +1510,10 @@ edje_object_part_drag_value_get(const Evas_Object
 	if (dy) *dy = 0;
 	return;
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp)
      {
@@ -1543,6 +1579,10 @@ edje_object_part_drag_size_get(const Evas_Object *
 	if (dh) *dh = 0;
 	return;
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp)
      {
@@ -1601,6 +1641,10 @@ edje_object_part_drag_step_get(const Evas_Object *
 	if (dy) *dy = 0;
 	return;
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp)
      {
@@ -1659,6 +1703,10 @@ edje_object_part_drag_page_get(const Evas_Object *
 	if (dy) *dy = 0;
 	return;
      }
+
+   /* Need to recalc before providing the object. */
+   _edje_recalc_do(ed);
+
    rp = _edje_real_part_recursive_get(ed, (char *)part);
    if (!rp)
      {
@@ -2176,5 +2224,5 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_O
      evas_object_precise_is_inside_set(obj_swallow, 1);
 
    rp->edje->dirty = 1;
-   _edje_recalc(rp->edje);
+   _edje_recalc_do(rp->edje);
 }
Index: src/lib/edje_private.h
===================================================================
--- src/lib/edje_private.h	(revision 36009)
+++ src/lib/edje_private.h	(working copy)
@@ -676,6 +676,7 @@ struct _Edje
    unsigned short        walking_actions : 1;
    unsigned short        block_break : 1;
    unsigned short        delete_me : 1;
+   unsigned short        postponed : 1;
 };
 
 struct _Edje_Real_Part
@@ -1005,6 +1006,7 @@ void  _edje_part_pos_set(Edje *ed, Edje_Real_Part
 Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val);
 void  _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char  *d1, double v1, const char *d2, double v2);
 void  _edje_recalc(Edje *ed);
+void  _edje_recalc_do(Edje *ed);
 int   _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y);
 void  _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y);
 
Index: src/lib/edje_callbacks.c
===================================================================
--- src/lib/edje_callbacks.c	(revision 36009)
+++ src/lib/edje_callbacks.c	(working copy)
@@ -119,7 +119,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Obj
 	       }
 	     ed->dirty = 1;
 	  }
-	_edje_recalc(ed);
+	_edje_recalc_do(ed);
 /*
 	_edje_thaw(ed);
 	_edje_unref(ed);
@@ -141,7 +141,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Obj
 		    _edje_emit(ed, "drag", rp->part->name);
 		  ed->dirty = 1;
 		  rp->drag.need_reset = 1;
-		  _edje_recalc(ed);
+		  _edje_recalc_do(ed);
 	       }
 	  }
      }
@@ -164,7 +164,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Obj
 	rp->clicked_button = ev->button;
 	rp->still_in = 1;
      }
-//   _edje_recalc(ed);
+//   _edje_recalc_do(ed);
    _edje_thaw(ed);
    _edje_unref(ed);
    return;
@@ -228,7 +228,7 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Objec
    rp->clicked_button = 0;
    rp->still_in = 0;
 
-//   _edje_recalc(ed);
+//   _edje_recalc_do(ed);
    _edje_thaw(ed);
    _edje_unref(ed);
    return;
@@ -284,7 +284,7 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Obj
 	       rp->drag.tmp.y = ev->cur.canvas.y - rp->drag.down.y;
 	     ed->dirty = 1;
 	  }
-	_edje_recalc(ed);
+	_edje_recalc_do(ed);
      }
    if ((rp->part->dragable.x) || (rp->part->dragable.y))
      {
@@ -301,7 +301,7 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Obj
 		  if (!ignored)
 		    _edje_emit(ed, "drag", rp->part->name);
 		  ed->dirty = 1;
-		  _edje_recalc(ed);
+		  _edje_recalc_do(ed);
 	       }
 	  }
      }
Index: src/lib/edje_smart.c
===================================================================
--- src/lib/edje_smart.c	(revision 36009)
+++ src/lib/edje_smart.c	(working copy)
@@ -13,6 +13,7 @@ static void _edje_smart_hide(Evas_Object * obj);
 static void _edje_smart_color_set(Evas_Object * obj, int r, int g, int b, int a);
 static void _edje_smart_clip_set(Evas_Object * obj, Evas_Object * clip);
 static void _edje_smart_clip_unset(Evas_Object * obj);
+static void _edje_smart_calculate(Evas_Object * obj);
 
 static Evas_Smart *_edje_smart = NULL;
 
@@ -45,7 +46,7 @@ edje_object_add(Evas *evas)
 	       _edje_smart_color_set,
 	       _edje_smart_clip_set,
 	       _edje_smart_clip_unset,
-	       NULL,
+	       _edje_smart_calculate,
 	       NULL
 	  };
 	_edje_smart = evas_smart_class_new(&sc);
@@ -238,3 +239,13 @@ _edje_smart_clip_unset(Evas_Object * obj)
    evas_object_clip_unset(ed->clipper);
 //   _edje_emit(ed, "clip_unset", NULL);
 }
+
+static void
+_edje_smart_calculate(Evas_Object *obj)
+{
+   Edje *ed;
+
+   ed = evas_object_smart_data_get(obj);
+   if (!ed) return;
+   _edje_recalc_do(ed);
+}
Index: src/lib/edje_calc.c
===================================================================
--- src/lib/edje_calc.c	(revision 36009)
+++ src/lib/edje_calc.c	(working copy)
@@ -136,6 +136,14 @@ _edje_part_description_apply(Edje *ed, Edje_Real_P
 void
 _edje_recalc(Edje *ed)
 {
+   if (ed->postponed) return ;
+   evas_object_smart_changed(ed->obj);
+   ed->postponed = 1;
+}
+
+void
+_edje_recalc_do(Edje *ed)
+{
    int i;
 
    if (!ed->dirty)
@@ -168,6 +176,7 @@ _edje_recalc(Edje *ed)
 	  _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY);
      }
    ed->dirty = 0;
+   ed->postponed = 0;
    if (!ed->calc_only) ed->recalc = 0;
 }
 
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to