diff options
Diffstat (limited to '')
-rw-r--r-- | legacy/edje/src/lib/edje_calc.c | 12 | ||||
-rw-r--r-- | legacy/edje/src/lib/edje_private.h | 2 | ||||
-rw-r--r-- | legacy/edje/src/lib/edje_smart.c | 12 | ||||
-rw-r--r-- | legacy/edje/src/lib/edje_util.c | 56 | ||||
-rw-r--r-- | legacy/emotion/src/lib/emotion_smart.c | 1 | ||||
-rw-r--r-- | legacy/evas/src/lib/Evas.h | 8 | ||||
-rw-r--r-- | legacy/evas/src/lib/canvas/evas_main.c | 1 | ||||
-rw-r--r-- | legacy/evas/src/lib/canvas/evas_object_smart.c | 158 | ||||
-rw-r--r-- | legacy/evas/src/lib/canvas/evas_render.c | 2 | ||||
-rw-r--r-- | legacy/evas/src/lib/include/evas_private.h | 2 |
10 files changed, 248 insertions, 6 deletions
diff --git a/legacy/edje/src/lib/edje_calc.c b/legacy/edje/src/lib/edje_calc.c index f62f26ab9d..37a41edd77 100644 --- a/legacy/edje/src/lib/edje_calc.c +++ b/legacy/edje/src/lib/edje_calc.c | |||
@@ -136,13 +136,22 @@ _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, doubl | |||
136 | void | 136 | void |
137 | _edje_recalc(Edje *ed) | 137 | _edje_recalc(Edje *ed) |
138 | { | 138 | { |
139 | if (ed->postponed) return ; | ||
140 | evas_object_smart_changed(ed->obj); | ||
141 | ed->postponed = 1; | ||
142 | } | ||
143 | |||
144 | void | ||
145 | _edje_recalc_do(Edje *ed) | ||
146 | { | ||
139 | int i; | 147 | int i; |
140 | 148 | ||
141 | if (!ed->dirty) return; | 149 | if (!ed->dirty) return; |
142 | if (ed->freeze) | 150 | if (ed->freeze) |
143 | { | 151 | { |
144 | ed->recalc = 1; | 152 | ed->recalc = 1; |
145 | if (!ed->calc_only) return; | 153 | if (!ed->calc_only && |
154 | !ed->postponed) return; | ||
146 | } | 155 | } |
147 | for (i = 0; i < ed->table_parts_size; i++) | 156 | for (i = 0; i < ed->table_parts_size; i++) |
148 | { | 157 | { |
@@ -161,6 +170,7 @@ _edje_recalc(Edje *ed) | |||
161 | _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY); | 170 | _edje_part_recalc(ed, ep, (~ep->calculated) & FLAG_XY); |
162 | } | 171 | } |
163 | ed->dirty = 0; | 172 | ed->dirty = 0; |
173 | ed->postponed = 0; | ||
164 | if (!ed->calc_only) ed->recalc = 0; | 174 | if (!ed->calc_only) ed->recalc = 0; |
165 | } | 175 | } |
166 | 176 | ||
diff --git a/legacy/edje/src/lib/edje_private.h b/legacy/edje/src/lib/edje_private.h index 4bc95ccfea..603ab3ef5e 100644 --- a/legacy/edje/src/lib/edje_private.h +++ b/legacy/edje/src/lib/edje_private.h | |||
@@ -681,6 +681,7 @@ struct _Edje | |||
681 | unsigned short walking_actions : 1; | 681 | unsigned short walking_actions : 1; |
682 | unsigned short block_break : 1; | 682 | unsigned short block_break : 1; |
683 | unsigned short delete_me : 1; | 683 | unsigned short delete_me : 1; |
684 | unsigned short postponed : 1; | ||
684 | }; | 685 | }; |
685 | 686 | ||
686 | struct _Edje_Real_Part | 687 | struct _Edje_Real_Part |
@@ -1007,6 +1008,7 @@ void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos); | |||
1007 | Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val); | 1008 | Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val); |
1008 | void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2); | 1009 | void _edje_part_description_apply(Edje *ed, Edje_Real_Part *ep, const char *d1, double v1, const char *d2, double v2); |
1009 | void _edje_recalc(Edje *ed); | 1010 | void _edje_recalc(Edje *ed); |
1011 | void _edje_recalc_do(Edje *ed); | ||
1010 | int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y); | 1012 | int _edje_part_dragable_calc(Edje *ed, Edje_Real_Part *ep, double *x, double *y); |
1011 | void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y); | 1013 | void _edje_dragable_pos_set(Edje *ed, Edje_Real_Part *ep, double x, double y); |
1012 | 1014 | ||
diff --git a/legacy/edje/src/lib/edje_smart.c b/legacy/edje/src/lib/edje_smart.c index b4f027ff5e..a3b23abc53 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); | |||
13 | static void _edje_smart_color_set(Evas_Object * obj, int r, int g, int b, int a); | 13 | static void _edje_smart_color_set(Evas_Object * obj, int r, int g, int b, int a); |
14 | static void _edje_smart_clip_set(Evas_Object * obj, Evas_Object * clip); | 14 | static void _edje_smart_clip_set(Evas_Object * obj, Evas_Object * clip); |
15 | static void _edje_smart_clip_unset(Evas_Object * obj); | 15 | static void _edje_smart_clip_unset(Evas_Object * obj); |
16 | static void _edje_smart_calculate(Evas_Object * obj); | ||
16 | 17 | ||
17 | static Evas_Smart *_edje_smart = NULL; | 18 | static Evas_Smart *_edje_smart = NULL; |
18 | 19 | ||
@@ -45,6 +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, |
49 | _edje_smart_calculate, | ||
48 | NULL | 50 | NULL |
49 | }; | 51 | }; |
50 | _edje_smart = evas_smart_class_new(&sc); | 52 | _edje_smart = evas_smart_class_new(&sc); |
@@ -237,3 +239,13 @@ _edje_smart_clip_unset(Evas_Object * obj) | |||
237 | evas_object_clip_unset(ed->clipper); | 239 | evas_object_clip_unset(ed->clipper); |
238 | // _edje_emit(ed, "clip_unset", NULL); | 240 | // _edje_emit(ed, "clip_unset", NULL); |
239 | } | 241 | } |
242 | |||
243 | static void | ||
244 | _edje_smart_calculate(Evas_Object *obj) | ||
245 | { | ||
246 | Edje *ed; | ||
247 | |||
248 | ed = evas_object_smart_data_get(obj); | ||
249 | if (!ed) return; | ||
250 | _edje_recalc_do(ed); | ||
251 | } | ||
diff --git a/legacy/edje/src/lib/edje_util.c b/legacy/edje/src/lib/edje_util.c index 4d91bd62ee..ec3eb3f924 100644 --- a/legacy/edje/src/lib/edje_util.c +++ b/legacy/edje/src/lib/edje_util.c | |||
@@ -715,6 +715,10 @@ edje_object_part_object_get(const Evas_Object *obj, const char *part) | |||
715 | 715 | ||
716 | ed = _edje_fetch(obj); | 716 | ed = _edje_fetch(obj); |
717 | if ((!ed) || (!part)) return NULL; | 717 | if ((!ed) || (!part)) return NULL; |
718 | |||
719 | /* Need to recalc before providing the object. */ | ||
720 | _edje_recalc_do(ed); | ||
721 | |||
718 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 722 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
719 | if (!rp) return NULL; | 723 | if (!rp) return NULL; |
720 | return rp->object; | 724 | return rp->object; |
@@ -748,6 +752,10 @@ edje_object_part_geometry_get(const Evas_Object *obj, const char *part, Evas_Coo | |||
748 | if (h) *h = 0; | 752 | if (h) *h = 0; |
749 | return; | 753 | return; |
750 | } | 754 | } |
755 | |||
756 | /* Need to recalc before providing the object. */ | ||
757 | _edje_recalc_do(ed); | ||
758 | |||
751 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 759 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
752 | if (!rp) | 760 | if (!rp) |
753 | { | 761 | { |
@@ -828,6 +836,10 @@ edje_object_part_text_get(const Evas_Object *obj, const char *part) | |||
828 | 836 | ||
829 | ed = _edje_fetch(obj); | 837 | ed = _edje_fetch(obj); |
830 | if ((!ed) || (!part)) return NULL; | 838 | if ((!ed) || (!part)) return NULL; |
839 | |||
840 | /* Need to recalc before providing the object. */ | ||
841 | _edje_recalc_do(ed); | ||
842 | |||
831 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 843 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
832 | if (!rp) return NULL; | 844 | if (!rp) return NULL; |
833 | if (rp->part->type == EDJE_PART_TYPE_TEXT) | 845 | 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 | |||
855 | 867 | ||
856 | ed = _edje_fetch(obj); | 868 | ed = _edje_fetch(obj); |
857 | if ((!ed) || (!part)) return; | 869 | if ((!ed) || (!part)) return; |
870 | |||
871 | /* Need to recalc before providing the object. */ | ||
872 | _edje_recalc_do(ed); | ||
873 | |||
858 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 874 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
859 | if (!rp) return; | 875 | if (!rp) return; |
860 | if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return; | 876 | if (rp->part->type != EDJE_PART_TYPE_SWALLOW) return; |
@@ -1021,7 +1037,7 @@ edje_object_part_unswallow(Evas_Object *obj, Evas_Object *obj_swallow) | |||
1021 | rp->swallow_params.max.w = 0; | 1037 | rp->swallow_params.max.w = 0; |
1022 | rp->swallow_params.max.h = 0; | 1038 | rp->swallow_params.max.h = 0; |
1023 | rp->edje->dirty = 1; | 1039 | rp->edje->dirty = 1; |
1024 | _edje_recalc(rp->edje); | 1040 | _edje_recalc_do(rp->edje); |
1025 | return; | 1041 | return; |
1026 | } | 1042 | } |
1027 | } | 1043 | } |
@@ -1039,6 +1055,10 @@ edje_object_part_swallow_get(const Evas_Object *obj, const char *part) | |||
1039 | 1055 | ||
1040 | ed = _edje_fetch(obj); | 1056 | ed = _edje_fetch(obj); |
1041 | if ((!ed) || (!part)) return NULL; | 1057 | if ((!ed) || (!part)) return NULL; |
1058 | |||
1059 | /* Need to recalc before providing the object. */ | ||
1060 | _edje_recalc_do(ed); | ||
1061 | |||
1042 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1062 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1043 | if (!rp) return NULL; | 1063 | if (!rp) return NULL; |
1044 | return rp->swallowed_object; | 1064 | return rp->swallowed_object; |
@@ -1088,6 +1108,10 @@ edje_object_size_max_get(const Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *m | |||
1088 | if (maxh) *maxh = 0; | 1108 | if (maxh) *maxh = 0; |
1089 | return; | 1109 | return; |
1090 | } | 1110 | } |
1111 | |||
1112 | /* Need to recalc before providing the object. */ | ||
1113 | _edje_recalc_do(ed); | ||
1114 | |||
1091 | if (ed->collection->prop.max.w == 0) | 1115 | if (ed->collection->prop.max.w == 0) |
1092 | { | 1116 | { |
1093 | /* XXX TODO: convert maxw to 0, fix things that break. */ | 1117 | /* XXX TODO: convert maxw to 0, fix things that break. */ |
@@ -1125,7 +1149,7 @@ edje_object_calc_force(Evas_Object *obj) | |||
1125 | ed->dirty = 1; | 1149 | ed->dirty = 1; |
1126 | pf = ed->freeze; | 1150 | pf = ed->freeze; |
1127 | ed->freeze = 0; | 1151 | ed->freeze = 0; |
1128 | _edje_recalc(ed); | 1152 | _edje_recalc_do(ed); |
1129 | ed->freeze = pf; | 1153 | ed->freeze = pf; |
1130 | } | 1154 | } |
1131 | 1155 | ||
@@ -1187,7 +1211,7 @@ edje_object_size_min_restricted_calc(Evas_Object *obj, Evas_Coord *minw, Evas_Co | |||
1187 | 1211 | ||
1188 | ok = 0; | 1212 | ok = 0; |
1189 | ed->dirty = 1; | 1213 | ed->dirty = 1; |
1190 | _edje_recalc(ed); | 1214 | _edje_recalc_do(ed); |
1191 | if (reset_maxwh) | 1215 | if (reset_maxwh) |
1192 | { | 1216 | { |
1193 | maxw = 0; | 1217 | maxw = 0; |
@@ -1291,6 +1315,10 @@ edje_object_part_state_get(const Evas_Object *obj, const char *part, double *val | |||
1291 | if (val_ret) *val_ret = 0; | 1315 | if (val_ret) *val_ret = 0; |
1292 | return ""; | 1316 | return ""; |
1293 | } | 1317 | } |
1318 | |||
1319 | /* Need to recalc before providing the object. */ | ||
1320 | _edje_recalc_do(ed); | ||
1321 | |||
1294 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1322 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1295 | if (!rp) | 1323 | if (!rp) |
1296 | { | 1324 | { |
@@ -1335,6 +1363,10 @@ edje_object_part_drag_dir_get(const Evas_Object *obj, const char *part) | |||
1335 | 1363 | ||
1336 | ed = _edje_fetch(obj); | 1364 | ed = _edje_fetch(obj); |
1337 | if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE; | 1365 | if ((!ed) || (!part)) return EDJE_DRAG_DIR_NONE; |
1366 | |||
1367 | /* Need to recalc before providing the object. */ | ||
1368 | _edje_recalc_do(ed); | ||
1369 | |||
1338 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1370 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1339 | if (!rp) return EDJE_DRAG_DIR_NONE; | 1371 | if (!rp) return EDJE_DRAG_DIR_NONE; |
1340 | if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY; | 1372 | if ((rp->part->dragable.x) && (rp->part->dragable.y)) return EDJE_DRAG_DIR_XY; |
@@ -1399,6 +1431,10 @@ edje_object_part_drag_value_get(const Evas_Object *obj, const char *part, double | |||
1399 | if (dy) *dy = 0; | 1431 | if (dy) *dy = 0; |
1400 | return; | 1432 | return; |
1401 | } | 1433 | } |
1434 | |||
1435 | /* Need to recalc before providing the object. */ | ||
1436 | _edje_recalc_do(ed); | ||
1437 | |||
1402 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1438 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1403 | if (!rp) | 1439 | if (!rp) |
1404 | { | 1440 | { |
@@ -1464,6 +1500,10 @@ edje_object_part_drag_size_get(const Evas_Object *obj, const char *part, double | |||
1464 | if (dh) *dh = 0; | 1500 | if (dh) *dh = 0; |
1465 | return; | 1501 | return; |
1466 | } | 1502 | } |
1503 | |||
1504 | /* Need to recalc before providing the object. */ | ||
1505 | _edje_recalc_do(ed); | ||
1506 | |||
1467 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1507 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1468 | if (!rp) | 1508 | if (!rp) |
1469 | { | 1509 | { |
@@ -1522,6 +1562,10 @@ edje_object_part_drag_step_get(const Evas_Object *obj, const char *part, double | |||
1522 | if (dy) *dy = 0; | 1562 | if (dy) *dy = 0; |
1523 | return; | 1563 | return; |
1524 | } | 1564 | } |
1565 | |||
1566 | /* Need to recalc before providing the object. */ | ||
1567 | _edje_recalc_do(ed); | ||
1568 | |||
1525 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1569 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1526 | if (!rp) | 1570 | if (!rp) |
1527 | { | 1571 | { |
@@ -1580,6 +1624,10 @@ edje_object_part_drag_page_get(const Evas_Object *obj, const char *part, double | |||
1580 | if (dy) *dy = 0; | 1624 | if (dy) *dy = 0; |
1581 | return; | 1625 | return; |
1582 | } | 1626 | } |
1627 | |||
1628 | /* Need to recalc before providing the object. */ | ||
1629 | _edje_recalc_do(ed); | ||
1630 | |||
1583 | rp = _edje_real_part_recursive_get(ed, (char *)part); | 1631 | rp = _edje_real_part_recursive_get(ed, (char *)part); |
1584 | if (!rp) | 1632 | if (!rp) |
1585 | { | 1633 | { |
@@ -2097,5 +2145,5 @@ _edje_real_part_swallow(Edje_Real_Part *rp, Evas_Object *obj_swallow) | |||
2097 | evas_object_precise_is_inside_set(obj_swallow, 1); | 2145 | evas_object_precise_is_inside_set(obj_swallow, 1); |
2098 | 2146 | ||
2099 | rp->edje->dirty = 1; | 2147 | rp->edje->dirty = 1; |
2100 | _edje_recalc(rp->edje); | 2148 | _edje_recalc_do(rp->edje); |
2101 | } | 2149 | } |
diff --git a/legacy/emotion/src/lib/emotion_smart.c b/legacy/emotion/src/lib/emotion_smart.c index 5943820564..848bc2ea29 100644 --- a/legacy/emotion/src/lib/emotion_smart.c +++ b/legacy/emotion/src/lib/emotion_smart.c | |||
@@ -1164,6 +1164,7 @@ _smart_init(void) | |||
1164 | _smart_color_set, | 1164 | _smart_color_set, |
1165 | _smart_clip_set, | 1165 | _smart_clip_set, |
1166 | _smart_clip_unset, | 1166 | _smart_clip_unset, |
1167 | NULL, | ||
1167 | NULL | 1168 | NULL |
1168 | }; | 1169 | }; |
1169 | smart = evas_smart_class_new(&sc); | 1170 | smart = evas_smart_class_new(&sc); |
diff --git a/legacy/evas/src/lib/Evas.h b/legacy/evas/src/lib/Evas.h index 73156d6cf9..e5c1e44428 100644 --- a/legacy/evas/src/lib/Evas.h +++ b/legacy/evas/src/lib/Evas.h | |||
@@ -137,7 +137,7 @@ typedef enum _Evas_Aspect_Control | |||
137 | } Evas_Aspect_Control; | 137 | } Evas_Aspect_Control; |
138 | 138 | ||
139 | 139 | ||
140 | #define EVAS_SMART_CLASS_VERSION 1 /** the version you have to put into the version field in the smart class struct */ | 140 | #define EVAS_SMART_CLASS_VERSION 2 /** the version you have to put into the version field in the smart class struct */ |
141 | struct _Evas_Smart_Class /** a smart object class */ | 141 | struct _Evas_Smart_Class /** a smart object class */ |
142 | { | 142 | { |
143 | const char *name; /** the string name of the class */ | 143 | const char *name; /** the string name of the class */ |
@@ -153,6 +153,7 @@ struct _Evas_Smart_Class /** a smart object class */ | |||
153 | void (*color_set) (Evas_Object *o, int r, int g, int b, int a); // FIXME: DELETE ME | 153 | void (*color_set) (Evas_Object *o, int r, int g, int b, int a); // FIXME: DELETE ME |
154 | void (*clip_set) (Evas_Object *o, Evas_Object *clip); // FIXME: DELETE ME | 154 | void (*clip_set) (Evas_Object *o, Evas_Object *clip); // FIXME: DELETE ME |
155 | void (*clip_unset) (Evas_Object *o); // FIXME: DELETE ME | 155 | void (*clip_unset) (Evas_Object *o); // FIXME: DELETE ME |
156 | void (*calculate) (Evas_Object *o); | ||
156 | 157 | ||
157 | const void *data; | 158 | const void *data; |
158 | }; | 159 | }; |
@@ -767,6 +768,11 @@ extern "C" { | |||
767 | EAPI void evas_object_smart_callback_add (Evas_Object *obj, const char *event, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data); | 768 | EAPI void evas_object_smart_callback_add (Evas_Object *obj, const char *event, void (*func) (void *data, Evas_Object *obj, void *event_info), const void *data); |
768 | EAPI void *evas_object_smart_callback_del (Evas_Object *obj, const char *event, void (*func) (void *data, Evas_Object *obj, void *event_info)); | 769 | EAPI void *evas_object_smart_callback_del (Evas_Object *obj, const char *event, void (*func) (void *data, Evas_Object *obj, void *event_info)); |
769 | EAPI void evas_object_smart_callback_call (Evas_Object *obj, const char *event, void *event_info); | 770 | EAPI void evas_object_smart_callback_call (Evas_Object *obj, const char *event, void *event_info); |
771 | EAPI void evas_object_smart_changed (Evas_Object *obj); | ||
772 | EAPI void evas_object_smart_need_recalculate_set(Evas_Object *obj, Evas_Bool value); | ||
773 | EAPI Evas_Bool evas_object_smart_need_recalculate_get(Evas_Object *obj); | ||
774 | EAPI void evas_object_smart_calculate (Evas_Object *obj); | ||
775 | |||
770 | 776 | ||
771 | /* events */ | 777 | /* events */ |
772 | EAPI void evas_event_freeze (Evas *e); | 778 | EAPI void evas_event_freeze (Evas *e); |
diff --git a/legacy/evas/src/lib/canvas/evas_main.c b/legacy/evas/src/lib/canvas/evas_main.c index 27b3ce6ed8..1a9b34c8bb 100644 --- a/legacy/evas/src/lib/canvas/evas_main.c +++ b/legacy/evas/src/lib/canvas/evas_main.c | |||
@@ -70,6 +70,7 @@ evas_new(void) | |||
70 | evas_array_setup(&e->pending_objects, 16); | 70 | evas_array_setup(&e->pending_objects, 16); |
71 | evas_array_setup(&e->obscuring_objects, 16); | 71 | evas_array_setup(&e->obscuring_objects, 16); |
72 | evas_array_setup(&e->temporary_objects, 16); | 72 | evas_array_setup(&e->temporary_objects, 16); |
73 | evas_array_setup(&e->calculate_objects, 16); | ||
73 | 74 | ||
74 | return e; | 75 | return e; |
75 | } | 76 | } |
diff --git a/legacy/evas/src/lib/canvas/evas_object_smart.c b/legacy/evas/src/lib/canvas/evas_object_smart.c index 811cb813a7..608a8282c7 100644 --- a/legacy/evas/src/lib/canvas/evas_object_smart.c +++ b/legacy/evas/src/lib/canvas/evas_object_smart.c | |||
@@ -13,6 +13,7 @@ struct _Evas_Object_Smart | |||
13 | Evas_Object_List *contained; | 13 | Evas_Object_List *contained; |
14 | int walking_list; | 14 | int walking_list; |
15 | Evas_Bool deletions_waiting : 1; | 15 | Evas_Bool deletions_waiting : 1; |
16 | Evas_Bool need_recalculate : 1; | ||
16 | }; | 17 | }; |
17 | 18 | ||
18 | struct _Evas_Smart_Callback | 19 | struct _Evas_Smart_Callback |
@@ -436,6 +437,163 @@ evas_object_smart_callback_call(Evas_Object *obj, const char *event, void *event | |||
436 | evas_object_smart_callbacks_clear(obj); | 437 | evas_object_smart_callbacks_clear(obj); |
437 | } | 438 | } |
438 | 439 | ||
440 | /** | ||
441 | * Set the need_recalculate flag of given smart object. | ||
442 | * | ||
443 | * If this flag is set then calculate() callback (method) of the given | ||
444 | * smart object will be called, if one is provided, during render phase | ||
445 | * usually evas_render(). After this step, this flag will be automatically | ||
446 | * unset. | ||
447 | * | ||
448 | * If no calculate() is provided, this flag will be left unchanged. | ||
449 | * | ||
450 | * @note just setting this flag will not make scene dirty and evas_render() | ||
451 | * will have no effect. To do that, use evas_object_smart_changed(), | ||
452 | * that will automatically call this function with 1 as parameter. | ||
453 | * | ||
454 | * @param obj the smart object | ||
455 | * @param value if one want to set or unset the need_recalculate flag. | ||
456 | * | ||
457 | * @ingroup Evas_Smart_Object_Group | ||
458 | */ | ||
459 | EAPI void | ||
460 | evas_object_smart_need_recalculate_set(Evas_Object *obj, Evas_Bool value) | ||
461 | { | ||
462 | Evas_Object_Smart *o; | ||
463 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
464 | return; | ||
465 | MAGIC_CHECK_END(); | ||
466 | o = obj->object_data; | ||
467 | MAGIC_CHECK(o, Evas_Object_Smart, MAGIC_OBJ_SMART); | ||
468 | return; | ||
469 | MAGIC_CHECK_END(); | ||
470 | |||
471 | value = !!value; | ||
472 | if (o->need_recalculate == value) | ||
473 | return; | ||
474 | o->need_recalculate = value; | ||
475 | |||
476 | if (!obj->smart.smart->smart_class->calculate) | ||
477 | return; | ||
478 | |||
479 | /* XXX: objects can be present multiple times in calculate_objects() | ||
480 | * XXX: after a set-unset-set cycle, but it's not a problem since | ||
481 | * XXX: on _evas_render_call_smart_calculate() will check for the flag | ||
482 | * XXX: and it will be unset after the first. | ||
483 | */ | ||
484 | if (o->need_recalculate) | ||
485 | { | ||
486 | Evas *e; | ||
487 | e = obj->layer->evas; | ||
488 | _evas_array_append(&e->calculate_objects, obj); | ||
489 | } | ||
490 | /* TODO: else, remove from array */ | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * Get the current value of need_recalculate flag. | ||
495 | * | ||
496 | * @note this flag will be unset during the render phase, after calculate() | ||
497 | * is called if one is provided. If no calculate() is provided, then | ||
498 | * the flag will be left unchanged after render phase. | ||
499 | * | ||
500 | * @param obj the smart object | ||
501 | * @return if flag is set or not. | ||
502 | * | ||
503 | * @ingroup Evas_Smart_Object_Group | ||
504 | */ | ||
505 | EAPI Evas_Bool | ||
506 | evas_object_smart_need_recalculate_get(Evas_Object *obj) | ||
507 | { | ||
508 | Evas_Object_Smart *o; | ||
509 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
510 | return; | ||
511 | MAGIC_CHECK_END(); | ||
512 | o = obj->object_data; | ||
513 | MAGIC_CHECK(o, Evas_Object_Smart, MAGIC_OBJ_SMART); | ||
514 | return; | ||
515 | MAGIC_CHECK_END(); | ||
516 | |||
517 | return o->need_recalculate; | ||
518 | } | ||
519 | |||
520 | /** | ||
521 | * Call user provided calculate() and unset need_calculate. | ||
522 | * | ||
523 | * @param obj the smart object | ||
524 | * @return if flag is set or not. | ||
525 | * | ||
526 | * @ingroup Evas_Smart_Object_Group | ||
527 | */ | ||
528 | EAPI void | ||
529 | evas_object_smart_calculate(Evas_Object *obj) | ||
530 | { | ||
531 | Evas_Object_Smart *o; | ||
532 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
533 | return; | ||
534 | MAGIC_CHECK_END(); | ||
535 | o = obj->object_data; | ||
536 | MAGIC_CHECK(o, Evas_Object_Smart, MAGIC_OBJ_SMART); | ||
537 | return; | ||
538 | MAGIC_CHECK_END(); | ||
539 | |||
540 | if (obj->smart.smart->smart_class->calculate) | ||
541 | obj->smart.smart->smart_class->calculate(obj); | ||
542 | o->need_recalculate = 0; | ||
543 | } | ||
544 | |||
545 | /** | ||
546 | * Call calculate() on all smart objects that need_recalculate. | ||
547 | * | ||
548 | * @internal | ||
549 | */ | ||
550 | void | ||
551 | evas_call_smarts_calculate(Evas *e) | ||
552 | { | ||
553 | Evas_Array *calculate; | ||
554 | unsigned int i; | ||
555 | |||
556 | calculate = &e->calculate_objects; | ||
557 | for (i = 0; i < calculate->count; ++i) | ||
558 | { | ||
559 | Evas_Object *obj; | ||
560 | Evas_Object_Smart *o; | ||
561 | |||
562 | obj = _evas_array_get(calculate, i); | ||
563 | if (obj->delete_me) | ||
564 | continue; | ||
565 | |||
566 | o = obj->object_data; | ||
567 | if (o->need_recalculate) | ||
568 | { | ||
569 | obj->smart.smart->smart_class->calculate(obj); | ||
570 | o->need_recalculate = 0; | ||
571 | } | ||
572 | } | ||
573 | |||
574 | evas_array_flush(calculate); | ||
575 | } | ||
576 | |||
577 | /** | ||
578 | * Mark smart object as changed, dirty. | ||
579 | * | ||
580 | * This will inform the scene that it changed and needs to be redraw, also | ||
581 | * setting need_recalculate on the given object. | ||
582 | * | ||
583 | * @see evas_object_smart_need_recalculate_set(). | ||
584 | * | ||
585 | * @ingroup Evas_Smart_Object_Group | ||
586 | */ | ||
587 | EAPI void | ||
588 | evas_object_smart_changed(Evas_Object *obj) | ||
589 | { | ||
590 | MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ); | ||
591 | return; | ||
592 | MAGIC_CHECK_END(); | ||
593 | evas_object_change(obj); | ||
594 | evas_object_smart_need_recalculate_set(obj, 1); | ||
595 | } | ||
596 | |||
439 | /* internal calls */ | 597 | /* internal calls */ |
440 | static void | 598 | static void |
441 | evas_object_smart_callbacks_clear(Evas_Object *obj) | 599 | evas_object_smart_callbacks_clear(Evas_Object *obj) |
diff --git a/legacy/evas/src/lib/canvas/evas_render.c b/legacy/evas/src/lib/canvas/evas_render.c index 8eb6a9670c..c36d4389b4 100644 --- a/legacy/evas/src/lib/canvas/evas_render.c +++ b/legacy/evas/src/lib/canvas/evas_render.c | |||
@@ -341,6 +341,8 @@ evas_render_updates_internal(Evas *e, unsigned char make_updates, unsigned char | |||
341 | MAGIC_CHECK_END(); | 341 | MAGIC_CHECK_END(); |
342 | if (!e->changed) return NULL; | 342 | if (!e->changed) return NULL; |
343 | 343 | ||
344 | evas_call_smarts_calculate(e); | ||
345 | |||
344 | /* Check if the modified object mean recalculating every thing */ | 346 | /* Check if the modified object mean recalculating every thing */ |
345 | if (!e->invalidate) | 347 | if (!e->invalidate) |
346 | _evas_render_check_pending_objects(&e->pending_objects, e); | 348 | _evas_render_check_pending_objects(&e->pending_objects, e); |
diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h index d2d56710ba..2f6a790a1b 100644 --- a/legacy/evas/src/lib/include/evas_private.h +++ b/legacy/evas/src/lib/include/evas_private.h | |||
@@ -288,6 +288,7 @@ struct _Evas | |||
288 | Evas_Array pending_objects; | 288 | Evas_Array pending_objects; |
289 | Evas_Array obscuring_objects; | 289 | Evas_Array obscuring_objects; |
290 | Evas_Array temporary_objects; | 290 | Evas_Array temporary_objects; |
291 | Evas_Array calculate_objects; | ||
291 | 292 | ||
292 | int delete_grabs; | 293 | int delete_grabs; |
293 | int walking_grabs; | 294 | int walking_grabs; |
@@ -713,6 +714,7 @@ void evas_object_smart_member_lower(Evas_Object *member); | |||
713 | void evas_object_smart_member_stack_above(Evas_Object *member, Evas_Object *other); | 714 | void evas_object_smart_member_stack_above(Evas_Object *member, Evas_Object *other); |
714 | void evas_object_smart_member_stack_below(Evas_Object *member, Evas_Object *other); | 715 | void evas_object_smart_member_stack_below(Evas_Object *member, Evas_Object *other); |
715 | const Evas_Object_List *evas_object_smart_members_get_direct(const Evas_Object *obj); | 716 | const Evas_Object_List *evas_object_smart_members_get_direct(const Evas_Object *obj); |
717 | void evas_call_smarts_calculate(Evas *e); | ||
716 | void *evas_mem_calloc(int size); | 718 | void *evas_mem_calloc(int size); |
717 | void evas_object_event_callback_all_del(Evas_Object *obj); | 719 | void evas_object_event_callback_all_del(Evas_Object *obj); |
718 | void evas_object_event_callback_cleanup(Evas_Object *obj); | 720 | void evas_object_event_callback_cleanup(Evas_Object *obj); |