summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_vg_root_node.c
diff options
context:
space:
mode:
authorsubhransu mohanty <sub.mohanty@samsung.com>2017-10-23 11:05:34 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-10-23 11:05:38 -0700
commitd26759555737681f454dbf80653a72dc506d355f (patch)
tree025abce62951f7808ba8dd1c8ee8ae5644221026 /src/lib/evas/canvas/evas_vg_root_node.c
parent74155b6e3424fe2cf9c6a92e0853e627ba865359 (diff)
evas: add set function for root_node property.
Summary: Currently user ask for the root_node from the evas_vg object and then attach its tree by setting the root node as parent. With this change this process will be explicit. user has to set the root node to the evas_vg object and the object will take the ownership of the tree. User can query the current vg_tree by root_node_get api. Test Plan: Fixed the test app to reflects this change. Reviewers: jpeg, cedric Reviewed By: jpeg, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5347 Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/lib/evas/canvas/evas_vg_root_node.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/src/lib/evas/canvas/evas_vg_root_node.c b/src/lib/evas/canvas/evas_vg_root_node.c
deleted file mode 100644
index 3fa746f25a..0000000000
--- a/src/lib/evas/canvas/evas_vg_root_node.c
+++ /dev/null
@@ -1,97 +0,0 @@
1#include "evas_common_private.h"
2#include "evas_private.h"
3
4#include "evas_vg_private.h"
5#include "efl_vg_root_node.eo.h"
6
7#include <string.h>
8
9#define MY_CLASS EFL_VG_ROOT_NODE_CLASS
10
11typedef struct _Efl_VG_Root_Node_Data Efl_VG_Root_Node_Data;
12struct _Efl_VG_Root_Node_Data
13{
14 Evas_Object *parent;
15 Evas_Object_Protected_Data *data;
16};
17
18static void
19_evas_vg_root_node_render_pre(Eo *obj EINA_UNUSED,
20 Eina_Matrix3 *parent,
21 Ector_Surface *s,
22 void *data,
23 Efl_VG_Data *nd)
24{
25 Efl_VG_Container_Data *pd = data;
26 Eina_List *l;
27 Eo *child;
28
29 EFL_VG_COMPUTE_MATRIX(current, parent, nd);
30
31 EINA_LIST_FOREACH(pd->children, l, child)
32 _evas_vg_render_pre(child, s, current);
33}
34
35static void
36_evas_vg_root_node_changed(void *data, const Efl_Event *event)
37{
38 Efl_VG_Root_Node_Data *pd = data;
39 Efl_VG_Data *bd = efl_data_scope_get(event->object, EFL_VG_CLASS);
40
41 if (bd->changed) return;
42 bd->changed = EINA_TRUE;
43
44 if (pd->parent) evas_object_change(pd->parent, pd->data);
45}
46
47static void
48_efl_vg_root_node_efl_object_parent_set(Eo *obj,
49 Efl_VG_Root_Node_Data *pd,
50 Eo *parent)
51{
52 // Nice little hack, jump over parent parent_set in Efl_VG_Root
53 efl_parent_set(efl_super(obj, EFL_VG_CLASS), parent);
54 if (parent && !efl_isa(parent, EVAS_VG_CLASS))
55 {
56 ERR("Parent of VG_ROOT_NODE must be a VG_CLASS");
57 }
58 else
59 {
60 pd->parent = parent;
61 pd->data = parent ? efl_data_scope_get(parent, EFL_CANVAS_OBJECT_CLASS) : NULL;
62 }
63}
64
65static Eo *
66_efl_vg_root_node_efl_object_constructor(Eo *obj,
67 Efl_VG_Root_Node_Data *pd)
68{
69 Efl_VG_Container_Data *cd;
70 Efl_VG_Data *nd;
71 Eo *parent;
72
73 // We are copying here the code of the vg container to make it possible to
74 // enforce that the root node is the only one to attach to an Evas_Object_VG
75 cd = efl_data_scope_get(obj, EFL_VG_CONTAINER_CLASS);
76 cd->children = NULL;
77 cd->names = eina_hash_stringshared_new(NULL);
78
79 // Nice little hack, jump over parent constructor in Efl_VG_Root
80 obj = efl_constructor(efl_super(obj, EFL_VG_CLASS));
81 parent = efl_parent_get(obj);
82 efl_vg_name_set(obj, "root");
83 if (!efl_isa(parent, EVAS_VG_CLASS)) {
84 ERR("Parent of VG_ROOT_NODE must be a VG_CLASS");
85 return NULL;
86 }
87
88 nd = efl_data_scope_get(obj, EFL_VG_CLASS);
89 nd->render_pre = _evas_vg_root_node_render_pre;
90 nd->data = cd;
91
92 efl_event_callback_add(obj, EFL_GFX_EVENT_CHANGED, _evas_vg_root_node_changed, pd);
93
94 return obj;
95}
96
97#include "efl_vg_root_node.eo.c"