aboutsummaryrefslogtreecommitdiffstats
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
parentefl src - mark fallthrough switch statements in 3rd party code (diff)
downloadefl-fd9cf1d3b628f70d66ec85a4f2433c675d9ad243.tar.gz
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
-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,
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Object.finalize;
Efl.Object.provider_find;
Efl.Gfx.visible { get; set; }
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
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
- if (obj->legacy)
+ if (obj->legacy.ctor)
evas_object_image_video_surface_set(eo_obj, NULL);
evas_object_image_free(eo_obj, obj);
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
return eo_obj;
}
+EOLIAN static Eo *
+_efl_canvas_object_efl_object_finalize(Eo *eo_obj, Evas_Object_Protected_Data *obj)
+{
+ Evas_Public_Data *e;
+
+ if (!EVAS_OBJECT_DATA_ALIVE(obj)) goto end;
+ if (obj->legacy.ctor) goto end;
+
+ if (obj->legacy.visible_set /* && ... */)
+ {
+ obj->legacy.finalized = EINA_TRUE;
+ goto end;
+ }
+
+ e = obj->layer->evas;
+ e->finalize_objects = eina_list_prepend(e->finalize_objects, eo_obj);
+
+end:
+ return efl_finalize(efl_super(eo_obj, MY_CLASS));
+}
+
void
evas_object_change_reset(Evas_Object_Protected_Data *obj)
{
@@ -1833,6 +1854,9 @@ EOLIAN static void
_efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data *obj,
Eina_Bool vis)
{
+ if (!obj->legacy.visible_set)
+ obj->legacy.visible_set = EINA_TRUE;
+
if (_evas_object_intercept_call_evas(obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 1, vis))
return;
@@ -1840,11 +1864,17 @@ _efl_canvas_object_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Protected_Data *o
else _hide(eo_obj, obj);
}
-static Eina_Bool
+EOLIAN static Eina_Bool
_efl_canvas_object_efl_gfx_visible_get(Eo *eo_obj EINA_UNUSED,
Evas_Object_Protected_Data *obj)
{
- if (obj->delete_me) return EINA_FALSE;
+ if (!EVAS_OBJECT_DATA_ALIVE(obj)) return EINA_FALSE;
+#if 0
+ // Try to return TRUE when an object is an EO object but not yet finalized.
+ // This is disabled as it leads to render bugs.
+ if (!obj->legacy.ctor && !obj->legacy.finalized && !obj->legacy.visible_set)
+ return EINA_TRUE;
+#endif
return obj->cur->visible;
}
@@ -2506,7 +2536,7 @@ EOLIAN static void
_efl_canvas_object_legacy_ctor(Eo *eo_obj, Evas_Object_Protected_Data *obj)
{
EINA_SAFETY_ON_FALSE_RETURN(!efl_finalized_get(eo_obj));
- obj->legacy = EINA_TRUE;
+ obj->legacy.ctor = EINA_TRUE;
}
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:
eina_tiler_free(tiler);
}
+static void
+evas_render_pre(Evas *eo_e, Evas_Public_Data *evas)
+{
+ Eo *eo_obj;
+
+ // Finalize EO objects now
+ eina_evlog("+render_pre_objects_finalize", eo_e, 0.0, NULL);
+
+ EINA_LIST_FREE(evas->finalize_objects, eo_obj)
+ {
+ Evas_Object_Protected_Data *obj;
+
+ obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
+ if (!EVAS_OBJECT_DATA_ALIVE(obj)) continue;
+ obj->legacy.finalized = EINA_TRUE;
+
+ if (!obj->legacy.visible_set)
+ efl_gfx_visible_set(eo_obj, EINA_TRUE);
+ }
+
+ eina_evlog("-render_pre_objects_finalize", eo_e, 0.0, NULL);
+}
+
static Eina_Bool
evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas,
void *surface, void *context,
@@ -2881,6 +2904,8 @@ evas_render_updates_internal_loop(Evas *eo_e, Evas_Public_Data *evas,
eina_evlog("+render_setup", eo_e, 0.0, NULL);
RD(level, " [--- UPDATE %i %i %ix%i\n", ux, uy, uw, uh);
+ evas_render_pre(eo_e, evas);
+
off_x = cx - ux;
off_y = cy - uy;
/* 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)
#define EVAS_OBJECT_LEGACY_API(_eo, ...) \
do { Evas_Object_Protected_Data *_o = efl_data_scope_get(_eo, EFL_CANVAS_OBJECT_CLASS); \
if (EINA_UNLIKELY(!_o)) return __VA_ARGS__; \
- if (EINA_UNLIKELY(!_o->legacy)) { \
+ if (EINA_UNLIKELY(!_o->legacy.ctor)) { \
char buf[1024]; snprintf(buf, sizeof(buf), "Calling legacy API on EO object '%s' is not permitted!", efl_class_name_get(_o->object)); \
EINA_SAFETY_ERROR(buf); \
} } while (0)
@@ -919,6 +919,7 @@ struct _Evas_Public_Data
Eina_Array image_unref_queue;
Eina_Array glyph_unref_queue;
Eina_Array texts_unref_queue;
+ Eina_List *finalize_objects;
struct {
Evas_Post_Render_Job *jobs;
@@ -1249,7 +1250,6 @@ struct _Evas_Object_Protected_Data
Eina_Bool child_has_map : 1;
Eina_Bool efl_del_called : 1;
Eina_Bool no_render : 1; // since 1.15
- Eina_Bool legacy : 1; // used legacy constructor
Eina_Bool clean_layer : 1; // destructor option
Eina_Bool snapshot_needs_redraw : 1;
@@ -1258,6 +1258,12 @@ struct _Evas_Object_Protected_Data
Eina_Bool gfx_map_has : 1;
Eina_Bool gfx_map_update : 1;
+ struct {
+ Eina_Bool ctor : 1; // used legacy constructor
+ Eina_Bool visible_set : 1; // visibility manually set
+ Eina_Bool finalized : 1; // object fully constructed
+ } legacy;
+
struct {
Eina_Bool pass_events : 1;
Eina_Bool pass_events_valid : 1;