summaryrefslogtreecommitdiff
path: root/legacy/edje
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2008-11-14 11:06:15 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2008-11-14 11:06:15 +0000
commitf53febde3209eda2539a6acf7c6f8d4e147b8b12 (patch)
tree3869cf091a7d8f9962d8d5ae9fbc9b7afccf495d /legacy/edje
parent5768d41053eaf4c0673c627abdef6f38d737273b (diff)
Edje postponed calculations.
This makes use of new Evas_Smart_Class calculate() callback to postpone calculations until render time, possible saving lots of calculations to happen. It is another try, with Cedric's changes to force recalculations when requried (ie: just before doing some edje_object_*_get()), let's see if this one solve found issues. SVN revision: 37620
Diffstat (limited to 'legacy/edje')
-rw-r--r--legacy/edje/configure.ac2
-rw-r--r--legacy/edje/src/lib/edje_calc.c26
-rw-r--r--legacy/edje/src/lib/edje_callbacks.c12
-rw-r--r--legacy/edje/src/lib/edje_private.h2
-rw-r--r--legacy/edje/src/lib/edje_program.c2
-rw-r--r--legacy/edje/src/lib/edje_smart.c15
-rw-r--r--legacy/edje/src/lib/edje_util.c56
7 files changed, 93 insertions, 22 deletions
diff --git a/legacy/edje/configure.ac b/legacy/edje/configure.ac
index 1a9ccd627c..155e6b652e 100644
--- a/legacy/edje/configure.ac
+++ b/legacy/edje/configure.ac
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
3# get rid of that stupid cache mechanism 3# get rid of that stupid cache mechanism
4rm -f config.cache 4rm -f config.cache
5 5
6AC_INIT([edje], [0.9.9.050], [enlightenment-devel@lists.sourceforge.net]) 6AC_INIT([edje], [0.9.9.050.7], [enlightenment-devel@lists.sourceforge.net])
7AC_PREREQ(2.52) 7AC_PREREQ(2.52)
8AC_CONFIG_SRCDIR([configure.ac]) 8AC_CONFIG_SRCDIR([configure.ac])
9AC_CONFIG_MACRO_DIR([m4]) 9AC_CONFIG_MACRO_DIR([m4])
diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c
index 91fc593bc5..a89cabd4a1 100644
--- a/legacy/edje/src/lib/edje_calc.c
+++ b/legacy/edje/src/lib/edje_calc.c
@@ -137,21 +137,30 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl
137void 137void
138_edje_recalc(Edje *ed) 138_edje_recalc(Edje *ed)
139{ 139{
140 int i;
141
142 if (!ed->dirty)
143 {
144 return;
145 }
146 if ((ed->freeze > 0) || (_edje_freeze_val > 0)) 140 if ((ed->freeze > 0) || (_edje_freeze_val > 0))
147 { 141 {
148 ed->recalc = 1; 142 ed->recalc = 1;
149 if (!ed->calc_only) 143 if (!ed->calc_only)
150 { 144 {
151 if (_edje_freeze_val > 0) _edje_freeze_calc_count++; 145 if (_edje_freeze_val > 0) _edje_freeze_calc_count++;
152 return; 146 return ;
153 } 147 }
154 } 148 }
149 if (ed->postponed) return ;
150 evas_object_smart_changed(ed->obj);
151 ed->postponed = 1;
152}
153
154void
155_edje_recalc_do(Edje *ed)
156{
157 int i;
158
159 ed->postponed = 0;
160 if (!ed->dirty)
161 {
162 return;
163 }
155 for (i = 0; i < ed->table_parts_size; i++) 164 for (i = 0; i < ed->table_parts_size; i++)
156 { 165 {
157 Edje_Real_Part *ep; 166 Edje_Real_Part *ep;
@@ -168,8 +177,9 @@ _edje_recalc(Edje *ed)
168 if (ep->calculated != FLAG_XY) 177 if (ep->calculated != FLAG_XY)
169 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY); 178 _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY);
170 } 179 }
171 ed->dirty = 0;
172 if (!ed->calc_only) ed->recalc = 0; 180 if (!ed->calc_only) ed->recalc = 0;
181 ed->dirty = 0;
182 ed->calc_only = 0;
173} 183}
174 184
175int 185int
diff --git a/legacy/edje/src/lib/edje_callbacks.c b/legacy/edje/src/lib/edje_callbacks.c
index 66583aa6a9..3e584dc0c5 100644
--- a/legacy/edje/src/lib/edje_callbacks.c
+++ b/legacy/edje/src/lib/edje_callbacks.c
@@ -117,7 +117,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
117 } 117 }
118 ed->dirty = 1; 118 ed->dirty = 1;
119 } 119 }
120 _edje_recalc(ed); 120 _edje_recalc_do(ed);
121/* 121/*
122 _edje_thaw(ed); 122 _edje_thaw(ed);
123 _edje_unref(ed); 123 _edje_unref(ed);
@@ -139,7 +139,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
139 _edje_emit(ed, "drag", rp->part->name); 139 _edje_emit(ed, "drag", rp->part->name);
140 ed->dirty = 1; 140 ed->dirty = 1;
141 rp->drag.need_reset = 1; 141 rp->drag.need_reset = 1;
142 _edje_recalc(ed); 142 _edje_recalc_do(ed);
143 } 143 }
144 } 144 }
145 } 145 }
@@ -162,7 +162,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
162 rp->clicked_button = ev->button; 162 rp->clicked_button = ev->button;
163 rp->still_in = 1; 163 rp->still_in = 1;
164 } 164 }
165// _edje_recalc(ed); 165// _edje_recalc_do(ed);
166 _edje_thaw(ed); 166 _edje_thaw(ed);
167 _edje_unref(ed); 167 _edje_unref(ed);
168 return; 168 return;
@@ -226,7 +226,7 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
226 rp->clicked_button = 0; 226 rp->clicked_button = 0;
227 rp->still_in = 0; 227 rp->still_in = 0;
228 228
229// _edje_recalc(ed); 229// _edje_recalc_do(ed);
230 _edje_thaw(ed); 230 _edje_thaw(ed);
231 _edje_unref(ed); 231 _edje_unref(ed);
232 return; 232 return;
@@ -282,7 +282,7 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
282 rp->drag.tmp.y = ev->cur.canvas.y - rp->drag.down.y; 282 rp->drag.tmp.y = ev->cur.canvas.y - rp->drag.down.y;
283 ed->dirty = 1; 283 ed->dirty = 1;
284 } 284 }
285 _edje_recalc(ed); 285 _edje_recalc_do(ed);
286 } 286 }
287 if ((rp->part->dragable.x) || (rp->part->dragable.y)) 287 if ((rp->part->dragable.x) || (rp->part->dragable.y))
288 { 288 {
@@ -299,7 +299,7 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
299 if (!ignored) 299 if (!ignored)
300 _edje_emit(ed, "drag", rp->part->name); 300 _edje_emit(ed, "drag", rp->part->name);
301 ed->dirty = 1; 301 ed->dirty = 1;
302 _edje_recalc(ed); 302 _edje_recalc_do(ed);
303 } 303 }
304 } 304 }
305 } 305 }
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h
index a203fde7a1..6183870603 100644
--- a/legacy/edje/src/lib/edje_private.h
+++ b/legacy/edje/src/lib/edje_private.h
@@ -667,6 +667,7 @@ struct _Edje
667 unsigned short walking_actions : 1; 667 unsigned short walking_actions : 1;
668 unsigned short block_break : 1; 668 unsigned short block_break : 1;
669 unsigned short delete_me : 1; 669 unsigned short delete_me : 1;
670 unsigned short postponed : 1;
670}; 671};
671 672
672struct _Edje_Real_Part 673struct _Edje_Real_Part
@@ -1009,6 +1010,7 @@ void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos);
1009Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val); 1010Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val);
1010void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2); 1011void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2);
1011void _edje_recalc(Edje *ed); 1012void _edje_recalc(Edje *ed);
1013void _edje_recalc_do(Edje *ed);
1012int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y); 1014int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y);
1013void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y); 1015void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y);
1014 1016
diff --git a/legacy/edje/src/lib/edje_program.c b/legacy/edje/src/lib/edje_program.c
index 3e778f2f42..d80ae3840e 100644
--- a/legacy/edje/src/lib/edje_program.c
+++ b/legacy/edje/src/lib/edje_program.c
@@ -749,7 +749,7 @@ _edje_program_run(Edje *ed, Edje_Program *pr, int force, const char *ssig, const
749 _edje_embryo_test_run(ed, fname, ssig, ssrc); 749 _edje_embryo_test_run(ed, fname, ssig, ssrc);
750// _edje_emit(ed, "program,stop", pr->name); 750// _edje_emit(ed, "program,stop", pr->name);
751 if (_edje_block_break(ed)) goto break_prog; 751 if (_edje_block_break(ed)) goto break_prog;
752 _edje_recalc(ed); 752 _edje_recalc_do(ed);
753 } 753 }
754 else if (pr->action == EDJE_ACTION_TYPE_FOCUS_SET) 754 else if (pr->action == EDJE_ACTION_TYPE_FOCUS_SET)
755 { 755 {
diff --git a/legacy/edje/src/lib/edje_smart.c b/legacy/edje/src/lib/edje_smart.c
index 5ddc26ab73..1cd5dc4a19 100644
--- a/legacy/edje/src/lib/edje_smart.c
+++ b/legacy/edje/src/lib/edje_smart.c
@@ -13,6 +13,7 @@ static void _edje_smart_hide(Evas_Object * obj);
13static void _edje_smart_color_set(Evas_Object * obj, int r, int g, int b, int a); 13static void _edje_smart_color_set(Evas_Object * obj, int r, int g, int b, int a);
14static void _edje_smart_clip_set(Evas_Object * obj, Evas_Object * clip); 14static void _edje_smart_clip_set(Evas_Object * obj, Evas_Object * clip);
15static void _edje_smart_clip_unset(Evas_Object * obj); 15static void _edje_smart_clip_unset(Evas_Object * obj);
16static void _edje_smart_calculate(Evas_Object * obj);
16 17
17static Evas_Smart *_edje_smart = NULL; 18static Evas_Smart *_edje_smart = NULL;
18 19
@@ -45,7 +46,7 @@ edje_object_add(Evas *evas)
45 _edje_smart_color_set, 46 _edje_smart_color_set,
46 _edje_smart_clip_set, 47 _edje_smart_clip_set,
47 _edje_smart_clip_unset, 48 _edje_smart_clip_unset,
48 NULL, 49 _edje_smart_calculate,
49 NULL, 50 NULL,
50 NULL, 51 NULL,
51 NULL 52 NULL
@@ -170,7 +171,7 @@ _edje_smart_resize(Evas_Object * obj, Evas_Coord w, Evas_Coord h)
170 } 171 }
171// evas_object_resize(ed->clipper, ed->w, ed->h); 172// evas_object_resize(ed->clipper, ed->w, ed->h);
172 ed->dirty = 1; 173 ed->dirty = 1;
173 _edje_recalc(ed); 174 _edje_recalc_do(ed);
174 _edje_emit(ed, "resize", NULL); 175 _edje_emit(ed, "resize", NULL);
175} 176}
176 177
@@ -244,3 +245,13 @@ _edje_smart_clip_unset(Evas_Object * obj)
244 evas_object_clip_unset(ed->clipper); 245 evas_object_clip_unset(ed->clipper);
245// _edje_emit(ed, "clip_unset", NULL); 246// _edje_emit(ed, "clip_unset", NULL);
246} 247}
248
249static void
250_edje_smart_calculate(Evas_Object *obj)
251{
252 Edje *ed;
253
254 ed = evas_object_smart_data_get(obj);
255 if (!ed) return;
256 _edje_recalc_do(ed);
257}
diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c
index 0044e75c3d..7e419e7829 100644
--- a/legacy/edje/src/lib/edje_util.c
+++ b/legacy/edje/src/lib/edje_util.c
@@ -75,7 +75,7 @@ _edje_thaw_edje(Edje *ed)
75 if (ed2) _edje_thaw_edje(ed2); 75 if (ed2) _edje_thaw_edje(ed2);
76 } 76 }
77 } 77 }
78 if ((ed->recalc) && (ed->freeze <= 0)) _edje_recalc(ed); 78 if ((ed->recalc) && (ed->freeze <= 0)) _edje_recalc_do(ed);
79} 79}
80#endif 80#endif
81 81
@@ -785,6 +785,10 @@ edje_object_part_object_get(const Evas_Object *obj, const char *part)
785 785
786 ed = _edje_fetch(obj); 786 ed = _edje_fetch(obj);
787 if ((!ed) || (!part)) return NULL; 787 if ((!ed) || (!part)) return NULL;
788
789 /* Need to recalc before providing the object. */
790 _edje_recalc_do(ed);
791
788 rp = _edje_real_part_recursive_get(ed, (char *)part); 792 rp = _edje_real_part_recursive_get(ed, (char *)part);
789 if (!rp) return NULL; 793 if (!rp) return NULL;
790 return rp->object; 794 return rp->object;
@@ -818,6 +822,10 @@ edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coo
818 if (h) *h = 0; 822 if (h) *h = 0;
819 return; 823 return;
820 } 824 }
825
826 /* Need to recalc before providing the object. */
827 _edje_recalc_do(ed);
828
821 rp = _edje_real_part_recursive_get(ed, (char *)part); 829 rp = _edje_real_part_recursive_get(ed, (char *)part);
822 if (!rp) 830 if (!rp)
823 { 831 {
@@ -904,6 +912,10 @@ edje_object_part_text_get(const Evas_Object *obj, const char *part)
904 912
905 ed = _edje_fetch(obj); 913 ed = _edje_fetch(obj);
906 if ((!ed) || (!part)) return NULL; 914 if ((!ed) || (!part)) return NULL;
915
916 /* Need to recalc before providing the object. */
917 _edje_recalc_do(ed);
918
907 rp = _edje_real_part_recursive_get(ed, (char *)part); 919 rp = _edje_real_part_recursive_get(ed, (char *)part);
908 if (!rp) return NULL; 920 if (!rp) return NULL;
909 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE) 921 if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
@@ -1051,6 +1063,10 @@ edje_object_part_swallow(Evas_Object *obj, const char *part, Evas_Object *obj_sw
1051 1063
1052 ed = _edje_fetch(obj); 1064 ed = _edje_fetch(obj);
1053 if ((!ed) || (!part)) return; 1065 if ((!ed) || (!part)) return;
1066
1067 /* Need to recalc before providing the object. */
1068 _edje_recalc_do(ed);
1069
1054 rp = _edje_real_part_recursive_get(ed, (char *)part); 1070 rp = _edje_real_part_recursive_get(ed, (char *)part);
1055 if (!rp) return; 1071 if (!rp) return;
1056 if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return; 1072 if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return;
@@ -1189,7 +1205,7 @@ edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow)
1189 rp->swallow_params.max.w = 0; 1205 rp->swallow_params.max.w = 0;
1190 rp->swallow_params.max.h = 0; 1206 rp->swallow_params.max.h = 0;
1191 rp->edje->dirty = 1; 1207 rp->edje->dirty = 1;
1192 _edje_recalc(rp->edje); 1208 _edje_recalc_do(rp->edje);
1193 return; 1209 return;
1194 } 1210 }
1195} 1211}
@@ -1207,6 +1223,10 @@ edje_object_part_swallow_get(const Evas_Object *obj, const char *part)
1207 1223
1208 ed = _edje_fetch(obj); 1224 ed = _edje_fetch(obj);
1209 if ((!ed) || (!part)) return NULL; 1225 if ((!ed) || (!part)) return NULL;
1226
1227 /* Need to recalc before providing the object. */
1228 _edje_recalc_do(ed);
1229
1210 rp = _edje_real_part_recursive_get(ed, (char *)part); 1230 rp = _edje_real_part_recursive_get(ed, (char *)part);
1211 if (!rp) return NULL; 1231 if (!rp) return NULL;
1212 return rp->swallowed_object; 1232 return rp->swallowed_object;
@@ -1256,6 +1276,10 @@ edje_object_size_max_get(const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *m
1256 if (maxh) *maxh = 0; 1276 if (maxh) *maxh = 0;
1257 return; 1277 return;
1258 } 1278 }
1279
1280 /* Need to recalc before providing the object. */
1281 _edje_recalc_do(ed);
1282
1259 if (ed->collection->prop.max.w == 0) 1283 if (ed->collection->prop.max.w == 0)
1260 { 1284 {
1261 /* XXX TODO: convert maxw to 0, fix things that break. */ 1285 /* XXX TODO: convert maxw to 0, fix things that break. */
@@ -1298,7 +1322,7 @@ edje_object_calc_force(Evas_Object *obj)
1298 _edje_freeze_val = 0; 1322 _edje_freeze_val = 0;
1299 ed->freeze = 0; 1323 ed->freeze = 0;
1300 1324
1301 _edje_recalc(ed); 1325 _edje_recalc_do(ed);
1302 1326
1303 ed->freeze = pf; 1327 ed->freeze = pf;
1304 _edje_freeze_val = pf2; 1328 _edje_freeze_val = pf2;
@@ -1362,7 +1386,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co
1362 1386
1363 ok = 0; 1387 ok = 0;
1364 ed->dirty = 1; 1388 ed->dirty = 1;
1365 _edje_recalc(ed); 1389 _edje_recalc_do(ed);
1366 if (reset_maxwh) 1390 if (reset_maxwh)
1367 { 1391 {
1368 maxw = 0; 1392 maxw = 0;
@@ -1466,6 +1490,10 @@ edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val
1466 if (val_ret) *val_ret = 0; 1490 if (val_ret) *val_ret = 0;
1467 return ""; 1491 return "";
1468 } 1492 }
1493
1494 /* Need to recalc before providing the object. */
1495 _edje_recalc_do(ed);
1496
1469 rp = _edje_real_part_recursive_get(ed, (char *)part); 1497 rp = _edje_real_part_recursive_get(ed, (char *)part);
1470 if (!rp) 1498 if (!rp)
1471 { 1499 {
@@ -1510,6 +1538,10 @@ edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part)
1510 1538
1511 ed = _edje_fetch(obj); 1539 ed = _edje_fetch(obj);
1512 if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE; 1540 if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE;
1541
1542 /* Need to recalc before providing the object. */
1543 _edje_recalc_do(ed);
1544
1513 rp = _edje_real_part_recursive_get(ed, (char *)part); 1545 rp = _edje_real_part_recursive_get(ed, (char *)part);
1514 if (!rp) return EDJE_DRAG_DIR_NONE; 1546 if (!rp) return EDJE_DRAG_DIR_NONE;
1515 if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY; 1547 if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY;
@@ -1574,6 +1606,10 @@ edje_object_part_drag_value_get(const Evas_Object *obj, const char *part, double
1574 if (dy) *dy = 0; 1606 if (dy) *dy = 0;
1575 return; 1607 return;
1576 } 1608 }
1609
1610 /* Need to recalc before providing the object. */
1611 _edje_recalc_do(ed);
1612
1577 rp = _edje_real_part_recursive_get(ed, (char *)part); 1613 rp = _edje_real_part_recursive_get(ed, (char *)part);
1578 if (!rp) 1614 if (!rp)
1579 { 1615 {
@@ -1639,6 +1675,10 @@ edje_object_part_drag_size_get(const Evas_Object *obj, const char *part, double
1639 if (dh) *dh = 0; 1675 if (dh) *dh = 0;
1640 return; 1676 return;
1641 } 1677 }
1678
1679 /* Need to recalc before providing the object. */
1680 _edje_recalc_do(ed);
1681
1642 rp = _edje_real_part_recursive_get(ed, (char *)part); 1682 rp = _edje_real_part_recursive_get(ed, (char *)part);
1643 if (!rp) 1683 if (!rp)
1644 { 1684 {
@@ -1697,6 +1737,10 @@ edje_object_part_drag_step_get(const Evas_Object *obj, const char *part, double
1697 if (dy) *dy = 0; 1737 if (dy) *dy = 0;
1698 return; 1738 return;
1699 } 1739 }
1740
1741 /* Need to recalc before providing the object. */
1742 _edje_recalc_do(ed);
1743
1700 rp = _edje_real_part_recursive_get(ed, (char *)part); 1744 rp = _edje_real_part_recursive_get(ed, (char *)part);
1701 if (!rp) 1745 if (!rp)
1702 { 1746 {
@@ -1755,6 +1799,10 @@ edje_object_part_drag_page_get(const Evas_Object *obj, const char *part, double
1755 if (dy) *dy = 0; 1799 if (dy) *dy = 0;
1756 return; 1800 return;
1757 } 1801 }
1802
1803 /* Need to recalc before providing the object. */
1804 _edje_recalc_do(ed);
1805
1758 rp = _edje_real_part_recursive_get(ed, (char *)part); 1806 rp = _edje_real_part_recursive_get(ed, (char *)part);
1759 if (!rp) 1807 if (!rp)
1760 { 1808 {