summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-09-13 16:12:04 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-09-13 16:12:41 -0700
commitf9401c16f061941549463950b272a5417ed0d640 (patch)
treead0d18811ef07c0b0e027660ef4908ad5a4c009d
parent23495add5bfb4fcb6b2e24e37fe3898800c6795a (diff)
downloadefl-f9401c16f061941549463950b272a5417ed0d640.tar.gz
evas: link output with evas canvas at finalize time.
-rw-r--r--src/lib/evas/canvas/efl_canvas_output.eo2
-rw-r--r--src/lib/evas/canvas/evas_out.c52
2 files changed, 39 insertions, 15 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_output.eo b/src/lib/evas/canvas/efl_canvas_output.eo
index b4b904d225..cb7137fb6e 100644
--- a/src/lib/evas/canvas/efl_canvas_output.eo
+++ b/src/lib/evas/canvas/efl_canvas_output.eo
@@ -45,6 +45,8 @@ class Efl.Canvas.Output (Efl.Object, Efl.Gfx.Buffer)
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Object.parent.set;
+ Efl.Object.finalize;
}
events {
pixels,ready;
diff --git a/src/lib/evas/canvas/evas_out.c b/src/lib/evas/canvas/evas_out.c
index ac02900f5d..12f0ea275a 100644
--- a/src/lib/evas/canvas/evas_out.c
+++ b/src/lib/evas/canvas/evas_out.c
@@ -13,27 +13,15 @@ struct _Efl_Canvas_Output_Data
{
void *info;/*, *context, *output;*/
Evas_Coord x, y, w, h;
+
+ Eina_Bool finalized : 1;
};
EOLIAN static Eo *
-_efl_canvas_output_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Output_Data *eo_dat)
+_efl_canvas_output_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Output_Data *data EINA_UNUSED)
{
- Eo *eo_parent = NULL;
- Evas_Public_Data *e;
-
- eo_parent = efl_parent_get(eo_obj);
- e = efl_data_scope_get(eo_parent, EVAS_CANVAS_CLASS);
- evas_canvas_async_block(e);
-
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
- if (!e) return NULL;
- e->outputs = eina_list_append(e->outputs, eo_obj);
- if (e->engine.func->info) eo_dat->info = e->engine.func->info(eo_parent);
- // XXX: context and output are currently held in the core engine and are
- // allocated by engine specific internal code. this all needs a new engine
- // api to make it work
-
return eo_obj;
}
@@ -46,6 +34,7 @@ _efl_canvas_output_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Output_Data *eo_
eo_parent = efl_parent_get(eo_obj);
e = efl_data_scope_get(eo_parent, EVAS_CANVAS_CLASS);
evas_canvas_async_block(e);
+
if (!e) return;
// XXX: need to free output and context one they get allocated one day
// e->engine.func->context_free(eo_dat->output, eo_dat->context);
@@ -113,4 +102,37 @@ _efl_canvas_output_unlock(Eo *obj EINA_UNUSED, Efl_Canvas_Output_Data *pd EINA_U
return EINA_FALSE;
}
+static void
+_efl_canvas_output_efl_object_parent_set(Eo *obj, Efl_Canvas_Output_Data *pd, Efl_Object *parent)
+{
+ if (parent != NULL && pd->finalized) return ;
+
+ efl_parent_set(efl_super(obj, EFL_CANVAS_OUTPUT_CLASS), parent);
+}
+
+static Efl_Object *
+_efl_canvas_output_efl_object_finalize(Eo *obj, Efl_Canvas_Output_Data *pd)
+{
+ Eo *eo_parent = NULL;
+ Evas_Public_Data *e;
+
+ eo_parent = efl_parent_get(obj);
+
+ if (!eo_parent || !efl_isa(eo_parent, EVAS_CANVAS_CLASS)) return NULL;
+ e = efl_data_scope_get(eo_parent, EVAS_CANVAS_CLASS);
+ evas_canvas_async_block(e);
+
+ if (!e) return NULL;
+
+ e->outputs = eina_list_append(e->outputs, obj);
+ if (e->engine.func->info) pd->info = e->engine.func->info(eo_parent);
+ // XXX: context and output are currently held in the core engine and are
+ // allocated by engine specific internal code. this all needs a new engine
+ // api to make it work
+
+ pd->finalized = EINA_TRUE;
+
+ return obj;
+}
+
#include "canvas/efl_canvas_output.eo.c"