1 #include "evas_common.h"
2 #include "evas_private.h"
5 evas_object_inject(Evas_Object *obj, Evas *e)
9 if (obj->in_layer) return;
10 lay = evas_layer_find(e, obj->cur.layer);
13 lay = evas_layer_new(e);
14 lay->layer = obj->cur.layer;
17 lay->objects = (Evas_Object *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj));
24 evas_object_release(Evas_Object *obj, int clean_layer)
26 if (!obj->in_layer) return;
27 obj->layer->objects = (Evas_Object *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj));
31 if (obj->layer->usage <= 0)
33 evas_layer_del(obj->layer);
34 evas_layer_free(obj->layer);
42 evas_layer_new(Evas *e)
46 lay = calloc(1, sizeof(Evas_Layer));
47 if (!lay) return NULL;
53 evas_layer_pre_free(Evas_Layer *lay)
57 EINA_INLIST_FOREACH(lay->objects, obj)
59 if ((!obj->smart.parent) && (!obj->delete_me))
65 evas_layer_free(Evas_Layer *lay)
71 obj = (Evas_Object *)lay->objects;
72 evas_object_free(obj, 0);
77 evas_layer_clean(Evas *e)
90 evas_layer_find(Evas *e, short layer_num)
94 EINA_INLIST_FOREACH(e->layers, layer)
96 if (layer->layer == layer_num) return layer;
102 evas_layer_add(Evas_Layer *lay)
106 EINA_INLIST_FOREACH(lay->evas->layers, layer)
108 if (layer->layer > lay->layer)
110 lay->evas->layers = (Evas_Layer *)eina_inlist_prepend_relative(EINA_INLIST_GET(lay->evas->layers),
111 EINA_INLIST_GET(lay),
112 EINA_INLIST_GET(layer));
116 lay->evas->layers = (Evas_Layer *)eina_inlist_append(EINA_INLIST_GET(lay->evas->layers), EINA_INLIST_GET(lay));
120 evas_layer_del(Evas_Layer *lay)
125 e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
128 /* public functions */
131 * @addtogroup Evas_Object_Group
136 * Sets the layer of the evas that the given object will be part of.
138 * It is not possible to change the layer of a smart object's child.
140 * @param obj The given evas object.
141 * @param l The number of the layer to place the object on.
144 evas_object_layer_set(Evas_Object *obj, short l)
148 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
151 if (evas_object_intercept_call_layer_set(obj, l)) return;
152 if (obj->smart.parent) return;
153 if (obj->cur.layer == l)
155 evas_object_raise(obj);
158 e = obj->layer->evas;
159 evas_object_release(obj, 1);
161 evas_object_inject(obj, e);
163 evas_object_change(obj);
164 if (obj->clip.clipees)
166 evas_object_inform_call_restack(obj);
169 evas_object_change(obj);
170 if (!obj->smart.smart)
172 if (evas_object_is_in_output_rect(obj,
173 obj->layer->evas->pointer.x,
174 obj->layer->evas->pointer.y, 1, 1) &&
176 if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj))
177 evas_event_feed_mouse_move(obj->layer->evas,
178 obj->layer->evas->pointer.x,
179 obj->layer->evas->pointer.y,
180 obj->layer->evas->last_timestamp,
183 evas_object_inform_call_restack(obj);
187 * Retrieves the layer of the evas that the given object is part of.
189 * Be carefull, it doesn't make sense to change the layer of smart object's
190 * child. So the returned value could be wrong in some case. Don't rely on
193 * @param obj The given evas object.
194 * @return Number of the layer.
197 evas_object_layer_get(const Evas_Object *obj)
199 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
202 if (obj->smart.parent)
204 return obj->smart.parent->cur.layer;
206 return obj->cur.layer;