summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-07-06 16:29:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-04 10:24:03 +0900
commitfd9cf1d3b628f70d66ec85a4f2433c675d9ad243 (patch)
treebf534933141cc04b7495870015510257fdc54374
parent932ae95a4e537916fe66952bdadf8928b7c4661e (diff)
evas: Make all EO canvas objects visible by default
All legacy objects remain invisible by default. Any call to visible_set() will prevent the automatic show() to happen. show() will be done just before render time, which may be a bit too late in order to propagate the necessary changes. This may break some things where some objects are created internally using efl_add() instead of the legacy API, and the intent was not to show the object. @feature
Diffstat (limited to '')
-rw-r--r--src/lib/evas/canvas/efl_canvas_object.eo1
-rw-r--r--src/lib/evas/canvas/evas_object_image.c2
-rw-r--r--src/lib/evas/canvas/evas_object_main.c36
-rw-r--r--src/lib/evas/canvas/evas_render.c25
-rw-r--r--src/lib/evas/include/evas_private.h10
5 files changed, 68 insertions, 6 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo
index a284a43e93..b49a42addf 100644
--- a/src/lib/evas/canvas/efl_canvas_object.eo
+++ b/src/lib/evas/canvas/efl_canvas_object.eo
@@ -660,6 +660,7 @@ abstract Efl.Canvas.Object (Efl.Object, Efl.Gfx, Efl.Gfx.Stack, Efl.Animator,
660 implements { 660 implements {
661 Efl.Object.constructor; 661 Efl.Object.constructor;
662 Efl.Object.destructor; 662 Efl.Object.destructor;
663 Efl.Object.finalize;
663 Efl.Object.provider_find; 664 Efl.Object.provider_find;
664 Efl.Gfx.visible { get; set; } 665 Efl.Gfx.visible { get; set; }
665 Efl.Gfx.color { get; set; } 666 Efl.Gfx.color { get; set; }
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 9d1440573d..269898c6b2 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1443,7 +1443,7 @@ _efl_canvas_image_internal_efl_object_destructor(Eo *eo_obj, Evas_Image_Data *o
1443{ 1443{
1444 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 1444 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
1445 1445
1446 if (obj->legacy) 1446 if (obj->legacy.ctor)
1447 evas_object_image_video_surface_set(eo_obj, NULL); 1447 evas_object_image_video_surface_set(eo_obj, NULL);
1448 evas_object_image_free(eo_obj, obj); 1448 evas_object_image_free(eo_obj, obj);
1449 efl_destructor(efl_super(eo_obj, MY_CLASS)); 1449 efl_destructor(efl_super(eo_obj, MY_CLASS));
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index e0a3013edf..f1fef26b00 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -197,6 +197,27 @@ _efl_canvas_object_efl_object_constructor(Eo *eo_obj, Evas_Object_Protected_Data
197 return eo_obj; 197 return eo_obj;
198} 198}
199 199
200EOLIAN static Eo *
201_efl_canvas_object_efl_object_finalize(Eo *eo_obj, Evas_Object_Protected_Data *obj)
202{
203 Evas_Public_Data *e;
204
205 if (!EVAS_OBJECT_DATA_ALIVE(obj)) goto end;
206 if (obj->legacy.ctor) goto end;
207
208 if (obj->legacy.visible_set /* && ... */)
209 {
210 obj->legacy.finalized = EINA_TRUE;
211 goto end;
212 }
213
214 e = obj->layer->evas;
215 e->finalize_objects = eina_list_prepend(e->finalize_objects, eo_obj);
216
217end:
218 return efl_finalize(efl_super(eo_obj, MY_CLASS));
219}
220
200void 221void
201evas_object_change_reset(Evas_Object_Protected_Data *obj) 222evas_object_change_reset(Evas_Object_Protected_Data *obj)
202{ 223{
@@ -1833,6 +1854,9 @@ EOLIAN static void
1833_efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, 1854_efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
1834 Eina_Bool vis) 1855 Eina_Bool vis)
1835{ 1856{
1857 if (!obj->legacy.visible_set)
1858 obj->legacy.visible_set = EINA_TRUE;
1859
1836 if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 1, vis)) 1860 if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 1, vis))
1837 return; 1861 return;
1838 1862
@@ -1840,11 +1864,17 @@ _efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data *o
1840 else _hide(eo_obj, obj); 1864 else _hide(eo_obj, obj);
1841} 1865}
1842 1866
1843static Eina_Bool 1867EOLIAN static Eina_Bool
1844_efl_canvas_object_efl_gfx_visible_get(Eo *eo_obj EINA_UNUSED, 1868_efl_canvas_object_efl_gfx_visible_get(Eo *eo_obj EINA_UNUSED,
1845 Evas_Object_Protected_Data *obj) 1869 Evas_Object_Protected_Data *obj)
1846{ 1870{
1847 if (obj->delete_me) return EINA_FALSE; 1871 if (!EVAS_OBJECT_DATA_ALIVE(obj)) return EINA_FALSE;
1872#if 0
1873 // Try to return TRUE when an object is an EO object but not yet finalized.
1874 // This is disabled as it leads to render bugs.
1875 if (!obj->legacy.ctor && !obj->legacy.finalized && !obj->legacy.visible_set)
1876 return EINA_TRUE;
1877#endif
1848 return obj->cur->visible; 1878 return obj->cur->visible;
1849} 1879}
1850 1880
@@ -2506,7 +2536,7 @@ EOLIAN static void
2506_efl_canvas_object_legacy_ctor(Eo *eo_obj, Evas_Object_Protected_Data *obj) 2536_efl_canvas_object_legacy_ctor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
2507{ 2537{
2508 EINA_SAFETY_ON_FALSE_RETURN(!efl_finalized_get(eo_obj)); 2538 EINA_SAFETY_ON_FALSE_RETURN(!efl_finalized_get(eo_obj));
2509 obj->legacy = EINA_TRUE; 2539 obj->legacy.ctor = EINA_TRUE;
2510} 2540}
2511 2541
2512 2542
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 7d66296f01..aaa519b36d 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -2860,6 +2860,29 @@ end:
2860 eina_tiler_free(tiler); 2860 eina_tiler_free(tiler);
2861} 2861}
2862 2862
2863static void
2864evas_render_pre(Evas *eo_e, Evas_Public_Data *evas)
2865{
2866 Eo *eo_obj;
2867
2868 // Finalize EO objects now
2869 eina_evlog("+render_pre_objects_finalize", eo_e, 0.0, NULL);
2870
2871 EINA_LIST_FREE(evas->finalize_objects, eo_obj)
2872 {
2873 Evas_Object_Protected_Data *obj;
2874
2875 obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
2876 if (!EVAS_OBJECT_DATA_ALIVE(obj)) continue;
2877 obj->legacy.finalized = EINA_TRUE;
2878
2879 if (!obj->legacy.visible_set)
2880 efl_gfx_visible_set(eo_obj, EINA_TRUE);
2881 }
2882
2883 eina_evlog("-render_pre_objects_finalize", eo_e, 0.0, NULL);
2884}
2885
2863static Eina_Bool 2886static Eina_Bool
2864evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas, 2887evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas,
2865 void *surface, void *context, 2888 void *surface, void *context,
@@ -2881,6 +2904,8 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas,
2881 eina_evlog("+render_setup", eo_e, 0.0, NULL); 2904 eina_evlog("+render_setup", eo_e, 0.0, NULL);
2882 RD(level, " [--- UPDATE %i %i %ix%i\n", ux, uy, uw, uh); 2905 RD(level, " [--- UPDATE %i %i %ix%i\n", ux, uy, uw, uh);
2883 2906
2907 evas_render_pre(eo_e, evas);
2908
2884 off_x = cx - ux; 2909 off_x = cx - ux;
2885 off_y = cy - uy; 2910 off_y = cy - uy;
2886 /* build obscuring objects list (in order from bottom to top) */ 2911 /* build obscuring objects list (in order from bottom to top) */
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 3124f83c5c..5fc8e8486d 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -627,7 +627,7 @@ MAGIC_CHECK_FAILED(o, t, m)
627#define EVAS_OBJECT_LEGACY_API(_eo, ...) \ 627#define EVAS_OBJECT_LEGACY_API(_eo, ...) \
628 do { Evas_Object_Protected_Data *_o = efl_data_scope_get(_eo, EFL_CANVAS_OBJECT_CLASS); \ 628 do { Evas_Object_Protected_Data *_o = efl_data_scope_get(_eo, EFL_CANVAS_OBJECT_CLASS); \
629 if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \ 629 if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \
630 if (EINA_UNLIKELY(!_o->legacy)) { \ 630 if (EINA_UNLIKELY(!_o->legacy.ctor)) { \
631 char buf[1024]; snprintf(buf, sizeof(buf), "Calling legacy API on EO object '%s' is not permitted!", efl_class_name_get(_o->object)); \ 631 char buf[1024]; snprintf(buf, sizeof(buf), "Calling legacy API on EO object '%s' is not permitted!", efl_class_name_get(_o->object)); \
632 EINA_SAFETY_ERROR(buf); \ 632 EINA_SAFETY_ERROR(buf); \
633 } } while (0) 633 } } while (0)
@@ -919,6 +919,7 @@ struct _Evas_Public_Data
919 Eina_Array image_unref_queue; 919 Eina_Array image_unref_queue;
920 Eina_Array glyph_unref_queue; 920 Eina_Array glyph_unref_queue;
921 Eina_Array texts_unref_queue; 921 Eina_Array texts_unref_queue;
922 Eina_List *finalize_objects;
922 923
923 struct { 924 struct {
924 Evas_Post_Render_Job *jobs; 925 Evas_Post_Render_Job *jobs;
@@ -1249,7 +1250,6 @@ struct _Evas_Object_Protected_Data
1249 Eina_Bool child_has_map : 1; 1250 Eina_Bool child_has_map : 1;
1250 Eina_Bool efl_del_called : 1; 1251 Eina_Bool efl_del_called : 1;
1251 Eina_Bool no_render : 1; // since 1.15 1252 Eina_Bool no_render : 1; // since 1.15
1252 Eina_Bool legacy : 1; // used legacy constructor
1253 Eina_Bool clean_layer : 1; // destructor option 1253 Eina_Bool clean_layer : 1; // destructor option
1254 1254
1255 Eina_Bool snapshot_needs_redraw : 1; 1255 Eina_Bool snapshot_needs_redraw : 1;
@@ -1258,6 +1258,12 @@ struct _Evas_Object_Protected_Data
1258 Eina_Bool gfx_map_has : 1; 1258 Eina_Bool gfx_map_has : 1;
1259 Eina_Bool gfx_map_update : 1; 1259 Eina_Bool gfx_map_update : 1;
1260 1260
1261 struct {
1262 Eina_Bool ctor : 1; // used legacy constructor
1263 Eina_Bool visible_set : 1; // visibility manually set
1264 Eina_Bool finalized : 1; // object fully constructed
1265 } legacy;
1266
1261 struct { 1267 struct {
1262 Eina_Bool pass_events : 1; 1268 Eina_Bool pass_events : 1;
1263 Eina_Bool pass_events_valid : 1; 1269 Eina_Bool pass_events_valid : 1;