summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/canvas/evas_layer.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-11-04 11:51:42 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-11-04 11:51:42 +0000
commitc15e9c6575c3b5f39ded167dda5259de3de96151 (patch)
tree5115d7ae3620af24c2bc094cd062575af7adeda9 /legacy/evas/src/lib/canvas/evas_layer.c
parenta5ac6a987caec5a7f7596a25d0a065b9cc94c50c (diff)
merge: and now Evas
I've tested make -j 3 install and it works nicely I've tested expedite with software and opengl xlib, and it works. Not tested other engines, so please report any problems (engines or other) on the ML. TODO: examples and tests, I'll add them later ISSUE: Eina_Unicode size check. It indirectly depends on eina_config.h, which is created at the end of the configure script. So its size is always 0. I don't know how that size is used, so I can't do a lot, for now. SVN revision: 78895
Diffstat (limited to 'legacy/evas/src/lib/canvas/evas_layer.c')
-rw-r--r--legacy/evas/src/lib/canvas/evas_layer.c252
1 files changed, 0 insertions, 252 deletions
diff --git a/legacy/evas/src/lib/canvas/evas_layer.c b/legacy/evas/src/lib/canvas/evas_layer.c
deleted file mode 100644
index fa86aa9..0000000
--- a/legacy/evas/src/lib/canvas/evas_layer.c
+++ /dev/null
@@ -1,252 +0,0 @@
1#include "evas_common.h"
2#include "evas_private.h"
3
4static void _evas_layer_free(Evas_Layer *lay);
5
6void
7evas_object_inject(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas *e)
8{
9 Evas_Layer *lay;
10
11 if (obj->in_layer) return;
12 lay = evas_layer_find(e, obj->cur.layer);
13 if (!lay)
14 {
15 lay = evas_layer_new(e);
16 lay->layer = obj->cur.layer;
17 evas_layer_add(lay);
18 }
19 lay->objects = (Evas_Object_Protected_Data *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj));
20 lay->usage++;
21 obj->layer = lay;
22 obj->in_layer = 1;
23}
24
25void
26evas_object_release(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, int clean_layer)
27{
28 if (!obj->in_layer) return;
29 obj->layer->objects = (Evas_Object_Protected_Data *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj));
30 obj->layer->usage--;
31 if (clean_layer)
32 {
33 if (obj->layer->usage <= 0)
34 {
35 evas_layer_del(obj->layer);
36 _evas_layer_free(obj->layer);
37 }
38 }
39 obj->layer = NULL;
40 obj->in_layer = 0;
41}
42
43Evas_Layer *
44evas_layer_new(Evas *eo_e)
45{
46 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
47 Evas_Layer *lay;
48
49 lay = calloc(1, sizeof(Evas_Layer));
50 if (!lay) return NULL;
51 lay->evas = e;
52 return lay;
53}
54
55static void
56_evas_layer_free(Evas_Layer *lay)
57{
58 free(lay);
59}
60
61void
62evas_layer_pre_free(Evas_Layer *lay)
63{
64 Evas_Object_Protected_Data *obj;
65
66 EINA_INLIST_FOREACH(lay->objects, obj)
67 {
68 if ((!obj->smart.parent) && (!obj->delete_me))
69 evas_object_del(obj->object);
70 }
71}
72
73void
74evas_layer_free_objects(Evas_Layer *lay)
75{
76 while (lay->objects)
77 {
78 Evas_Object_Protected_Data *obj;
79
80 obj = (Evas_Object_Protected_Data *)lay->objects;
81 evas_object_free(obj->object, 0);
82 }
83}
84
85void
86evas_layer_clean(Evas *eo_e)
87{
88 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
89 Evas_Layer *tmp;
90
91 while (e->layers)
92 {
93 tmp = e->layers;
94 evas_layer_del(tmp);
95 _evas_layer_free(tmp);
96 }
97}
98
99Evas_Layer *
100evas_layer_find(Evas *eo_e, short layer_num)
101{
102 Evas_Public_Data *e = eo_data_get(eo_e, EVAS_CLASS);
103 Evas_Layer *layer;
104
105 EINA_INLIST_FOREACH(e->layers, layer)
106 {
107 if (layer->layer == layer_num) return layer;
108 }
109 return NULL;
110}
111
112void
113evas_layer_add(Evas_Layer *lay)
114{
115 Evas_Layer *layer;
116
117 EINA_INLIST_FOREACH(lay->evas->layers, layer)
118 {
119 if (layer->layer > lay->layer)
120 {
121 lay->evas->layers = (Evas_Layer *)eina_inlist_prepend_relative(EINA_INLIST_GET(lay->evas->layers),
122 EINA_INLIST_GET(lay),
123 EINA_INLIST_GET(layer));
124 return;
125 }
126 }
127 lay->evas->layers = (Evas_Layer *)eina_inlist_append(EINA_INLIST_GET(lay->evas->layers), EINA_INLIST_GET(lay));
128}
129
130void
131evas_layer_del(Evas_Layer *lay)
132{
133 Evas_Public_Data *e;
134
135 e = lay->evas;
136 e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
137}
138
139static void
140_evas_object_layer_set_child(Evas_Object *eo_obj, Evas_Object *par, short l)
141{
142 Evas_Object_Protected_Data *obj = eo_data_get(eo_obj, EVAS_OBJ_CLASS);
143 Evas_Object_Protected_Data *par_obj = eo_data_get(par, EVAS_OBJ_CLASS);
144
145 if (obj->delete_me) return;
146 if (obj->cur.layer == l) return;
147 evas_object_release(eo_obj, obj, 1);
148 obj->cur.layer = l;
149 obj->layer = par_obj->layer;
150 obj->layer->usage++;
151 if (obj->is_smart)
152 {
153 Eina_Inlist *contained;
154 Evas_Object_Protected_Data *member;
155
156 contained = (Eina_Inlist *)evas_object_smart_members_get_direct(eo_obj);
157 EINA_INLIST_FOREACH(contained, member)
158 {
159 _evas_object_layer_set_child(member->object, eo_obj, l);
160 }
161 }
162}
163
164/* public functions */
165
166EAPI void
167evas_object_layer_set(Evas_Object *eo_obj, short l)
168{
169 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
170 return;
171 MAGIC_CHECK_END();
172 eo_do(eo_obj, evas_obj_layer_set(l));
173}
174
175void
176_layer_set(Eo *eo_obj, void *_obj, va_list *list)
177{
178 short l = va_arg(*list, int);
179
180 Evas *eo_e;
181 Evas_Object_Protected_Data *obj = _obj;
182
183 if (obj->delete_me) return;
184 if (evas_object_intercept_call_layer_set(eo_obj, l)) return;
185 if (obj->smart.parent) return;
186 if (obj->cur.layer == l)
187 {
188 evas_object_raise(eo_obj);
189 return;
190 }
191 eo_e = obj->layer->evas->evas;
192 evas_object_release(eo_obj, obj, 1);
193 obj->cur.layer = l;
194 evas_object_inject(eo_obj, obj, eo_e);
195 obj->restack = 1;
196 evas_object_change(eo_obj, obj);
197 if (obj->clip.clipees)
198 {
199 evas_object_inform_call_restack(eo_obj);
200 return;
201 }
202 evas_object_change(eo_obj, obj);
203 if (!obj->is_smart)
204 {
205 if (evas_object_is_in_output_rect(eo_obj, obj,
206 obj->layer->evas->pointer.x,
207 obj->layer->evas->pointer.y, 1, 1) &&
208 obj->cur.visible)
209 if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj))
210 evas_event_feed_mouse_move(obj->layer->evas->evas,
211 obj->layer->evas->pointer.x,
212 obj->layer->evas->pointer.y,
213 obj->layer->evas->last_timestamp,
214 NULL);
215 }
216 else
217 {
218 Eina_Inlist *contained;
219 Evas_Object_Protected_Data *member;
220
221 contained = (Eina_Inlist *)evas_object_smart_members_get_direct(eo_obj);
222 EINA_INLIST_FOREACH(contained, member)
223 {
224 _evas_object_layer_set_child(member->object, eo_obj, l);
225 }
226 }
227 evas_object_inform_call_restack(eo_obj);
228}
229
230EAPI short
231evas_object_layer_get(const Evas_Object *eo_obj)
232{
233 MAGIC_CHECK(eo_obj, Evas_Object, MAGIC_OBJ);
234 return 0;
235 MAGIC_CHECK_END();
236 short layer = 0;
237 eo_do((Eo *)eo_obj, evas_obj_layer_get(&layer));
238 return layer;
239}
240
241void
242_layer_get(Eo *eo_obj EINA_UNUSED, void *_obj, va_list *list)
243{
244 short *layer = va_arg(*list, short *);
245 const Evas_Object_Protected_Data *obj = _obj;
246 if (obj->smart.parent)
247 {
248 Evas_Object_Protected_Data *smart_parent_obj = eo_data_get(obj->smart.parent, EVAS_OBJ_CLASS);
249 *layer = smart_parent_obj->cur.layer;
250 }
251 *layer = obj->cur.layer;
252}