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);
78 evas_layer_find(Evas *e, short layer_num)
82 EINA_INLIST_FOREACH(e->layers, layer)
84 if (layer->layer == layer_num) return layer;
90 evas_layer_add(Evas_Layer *lay)
94 EINA_INLIST_FOREACH(lay->evas->layers, layer)
96 if (layer->layer > lay->layer)
98 lay->evas->layers = (Evas_Layer *)eina_inlist_prepend_relative(EINA_INLIST_GET(lay->evas->layers),
100 EINA_INLIST_GET(layer));
104 lay->evas->layers = (Evas_Layer *)eina_inlist_append(EINA_INLIST_GET(lay->evas->layers), EINA_INLIST_GET(lay));
108 evas_layer_del(Evas_Layer *lay)
113 e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
116 /* public functions */
119 * @addtogroup Evas_Object_Group
124 * Sets the layer of the evas that the given object will be part of.
125 * @param obj The given evas object.
126 * @param l The number of the layer to place the object on.
129 evas_object_layer_set(Evas_Object *obj, short l)
133 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
136 if (evas_object_intercept_call_layer_set(obj, l)) return;
137 if (obj->smart.parent) return;
138 if (obj->cur.layer == l)
140 evas_object_raise(obj);
143 e = obj->layer->evas;
144 evas_object_release(obj, 1);
146 evas_object_inject(obj, e);
148 evas_object_change(obj);
149 if (obj->clip.clipees)
151 evas_object_inform_call_restack(obj);
154 evas_object_change(obj);
155 if (!obj->smart.smart)
157 if (evas_object_is_in_output_rect(obj,
158 obj->layer->evas->pointer.x,
159 obj->layer->evas->pointer.y, 1, 1) &&
161 if (eina_list_data_find(obj->layer->evas->pointer.object.in, obj))
162 evas_event_feed_mouse_move(obj->layer->evas,
163 obj->layer->evas->pointer.x,
164 obj->layer->evas->pointer.y,
165 obj->layer->evas->last_timestamp,
168 evas_object_inform_call_restack(obj);
172 * Retrieves the layer of the evas that the given object is part of.
173 * @param obj The given evas object.
174 * @return Number of the layer.
177 evas_object_layer_get(const Evas_Object *obj)
179 MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
182 if (obj->smart.parent)
184 return obj->smart.parent->cur.layer;
186 return obj->cur.layer;