On Tue, Aug 19, 2008 at 11:44 AM, Cedric BAIL <[EMAIL PROTECTED]> wrote:
> On Mon, Aug 18, 2008 at 6:24 PM, Cedric BAIL <[EMAIL PROTECTED]> wrote:
>> On Sat, Aug 16, 2008 at 3:15 AM, Jose Gonzalez <[EMAIL PROTECTED]> wrote:
>>> Just to make it clear what I think about this: This kind of thing is
>>> something that really needs to be done, one way or another. :)
>>>
>>> Some time back, I thought about having the edje recalc function called
>>> by smart class render-pre/post funcs, and these funcs I wanted to be called
>>> by the obj's internal render-pre/post ones as this would be useful for
>>> creating
>>> semi-custom, stateful, objs that rendered to image buffers (possibly native
>>> surfaces). But I saw that there were problems with that due to the very
>>> kinds
>>> of things you mention, the events system and possibly other things, as I
>>> mentioned to Cedric once here.
>>> You could have an additional smart class func, say a "calculate" one and
>>> then do as you suggest.. but the main issue here is whether this kind of
>>> smart
>>> class specific approach is the "best" way to deal with this kind of general
>>> issue.
>>> I've mentioned two other possible ways to deal with this in a more
>>> generic
>>> manner - for example an ecore_evas based one akin to what's done with
>>> sub-canvases
>>> (which is useful for those), or a more 'evas only' one akin to what you
>>> have here
>>> but using user supplied callbacks. There are other possibilities.. evas
>>> could
>>> expose an EVAS_RENDER_EVENT and have callbacks one can add for such, called
>>> prior
>>> to the internal evas-render loop... and other possibilities.
>>
>>> I don't know what might be best.. just that this is something needed but
>>> that needs more thought, some experimenting, etc. Maybe raster, nathan,
>>> hisham,
>>> and others can give more feedback on this - maybe your proposal *is* the
>>> best
>>> way to deal with this general issue, but it won't hurt to consider other
>>> possible
>>> ways if they have potentially wider applicability. :)
>>
>> Ok, here is a patch that improve the speed for evas part of Gustavo
>> work. I did rename the callback to calculate. Regarding if it's the
>> best way, that I don't know, but it's easy to implement on both side
>> and fast.
>>
>> Between the edje patch is currently not correct as many getter expect
>> the underlying object to be calculated. If you apply the attached
>> patch (not really a smart patch) you will see that many user of edje
>> expect it to be calculated at some point.
>
> And here is the edje patch. It did fix E17 use of edje and I didn't
> see any problem. But please test this serie of patch against your own
> apps as it could break things.
Already a fix for some swallow case.
--
Cedric BAIL
diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c
index 005ca2b..131675f 100644
--- a/src/lib/edje_calc.c
+++ b/src/lib/edje_calc.c
@@ -136,13 +136,22 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl
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) return;
if (ed->freeze)
{
ed->recalc = 1;
- if (!ed->calc_only) return;
+ if (!ed->calc_only &&
+ !ed->postponed) return;
}
for (i = 0; i < ed->table_parts_size; i++)
{
@@ -161,6 +170,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;
}
diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h
index 8d60b7e..edcd44d 100644
--- a/src/lib/edje_private.h
+++ b/src/lib/edje_private.h
@@ -681,6 +681,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
@@ -1007,6 +1008,7 @@ void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos);
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);
diff --git a/src/lib/edje_smart.c b/src/lib/edje_smart.c
index b4f027f..16b73f3 100644
--- a/src/lib/edje_smart.c
+++ b/src/lib/edje_smart.c
@@ -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,6 +46,7 @@ edje_object_add(Evas *evas)
_edje_smart_color_set,
_edje_smart_clip_set,
_edje_smart_clip_unset,
+ _edje_smart_calculate,
NULL
};
_edje_smart = evas_smart_class_new(&sc);
@@ -237,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);
+}
diff --git a/src/lib/edje_util.c b/src/lib/edje_util.c
index dd2971a..a133c4f 100644
--- a/src/lib/edje_util.c
+++ b/src/lib/edje_util.c
@@ -715,6 +715,10 @@ edje_object_part_object_get(Evas_Object *obj, const char *part)
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;
@@ -748,6 +752,10 @@ edje_object_part_geometry_get(Evas_Object *obj, const char *part, Evas_Coord *x,
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)
{
@@ -828,6 +836,10 @@ edje_object_part_text_get(Evas_Object *obj, const char *part)
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)
@@ -855,6 +867,10 @@ edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_sw
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;
@@ -1021,7 +1037,7 @@ edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
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;
}
}
@@ -1039,6 +1055,10 @@ edje_object_part_swallow_get(Evas_Object *obj, const char *part)
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;
@@ -1088,6 +1108,10 @@ edje_object_size_max_get(Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh)
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. */
@@ -1125,7 +1149,7 @@ edje_object_calc_force(Evas_Object *obj)
ed->dirty = 1;
pf = ed->freeze;
ed->freeze = 0;
- _edje_recalc(ed);
+ _edje_recalc_do(ed);
ed->freeze = pf;
}
@@ -1187,7 +1211,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co
ok = 0;
ed->dirty = 1;
- _edje_recalc(ed);
+ _edje_recalc_do(ed);
if (reset_maxwh)
{
maxw = 0;
@@ -1291,6 +1315,10 @@ edje_object_part_state_get(Evas_Object *obj, const char *part, double *val_ret)
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)
{
@@ -1335,6 +1363,10 @@ edje_object_part_drag_dir_get(Evas_Object *obj, const char *part)
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;
@@ -1399,6 +1431,10 @@ edje_object_part_drag_value_get(Evas_Object *obj, const char *part, double *dx,
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)
{
@@ -1464,6 +1500,10 @@ edje_object_part_drag_size_get(Evas_Object *obj, const char *part, double *dw, d
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)
{
@@ -1522,6 +1562,10 @@ edje_object_part_drag_step_get(Evas_Object *obj, const char *part, double *dx, d
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)
{
@@ -1580,6 +1624,10 @@ edje_object_part_drag_page_get(Evas_Object *obj, const char *part, double *dx, d
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)
{
@@ -2097,5 +2145,5 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow)
evas_object_precise_is_inside_set(obj_swallow, 1);
rp->edje->dirty = 1;
- _edje_recalc(rp->edje);
+ _edje_recalc_do(rp->edje);
}
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel