2013-06-20 03:53:29 -07:00
|
|
|
#include "evas_common_private.h"
|
2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_private.h"
|
|
|
|
|
2009-06-20 00:17:40 -07:00
|
|
|
static void _evas_layer_free(Evas_Layer *lay);
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
void
|
2013-05-02 00:47:16 -07:00
|
|
|
evas_object_inject(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas *e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
Evas_Layer *lay;
|
2015-02-10 03:44:38 -08:00
|
|
|
Evas_Public_Data *evas;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-11-11 18:22:39 -08:00
|
|
|
if (!obj) return;
|
|
|
|
if (!e) return;
|
2005-10-26 19:44:36 -07:00
|
|
|
if (obj->in_layer) return;
|
2016-08-15 06:44:41 -07:00
|
|
|
evas = efl_data_scope_get(e, EVAS_CANVAS_CLASS);
|
2015-02-10 03:44:38 -08:00
|
|
|
if (!evas) return;
|
|
|
|
evas_canvas_async_block(evas);
|
2013-03-12 05:58:19 -07:00
|
|
|
lay = evas_layer_find(e, obj->cur->layer);
|
2002-11-08 00:02:15 -08:00
|
|
|
if (!lay)
|
|
|
|
{
|
2011-06-18 02:16:22 -07:00
|
|
|
lay = evas_layer_new(e);
|
2013-03-12 05:58:19 -07:00
|
|
|
lay->layer = obj->cur->layer;
|
2011-06-18 02:16:22 -07:00
|
|
|
evas_layer_add(lay);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_data_ref(eo_obj, NULL);
|
2012-10-08 18:58:41 -07:00
|
|
|
lay->objects = (Evas_Object_Protected_Data *)eina_inlist_append(EINA_INLIST_GET(lay->objects), EINA_INLIST_GET(obj));
|
2005-11-08 03:59:21 -08:00
|
|
|
lay->usage++;
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->layer = lay;
|
2005-10-26 19:44:36 -07:00
|
|
|
obj->in_layer = 1;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-05-02 00:47:16 -07:00
|
|
|
evas_object_release(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, int clean_layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2005-10-26 19:44:36 -07:00
|
|
|
if (!obj->in_layer) return;
|
2016-07-18 23:42:10 -07:00
|
|
|
if (!obj->layer->walking_objects)
|
|
|
|
obj->layer->objects = (Evas_Object_Protected_Data *)eina_inlist_remove(EINA_INLIST_GET(obj->layer->objects), EINA_INLIST_GET(obj));
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_data_unref(eo_obj, obj);
|
2016-07-18 23:42:10 -07:00
|
|
|
if (!obj->layer->walking_objects)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2016-07-18 23:42:10 -07:00
|
|
|
obj->layer->usage--;
|
|
|
|
if (clean_layer)
|
2011-06-18 02:16:22 -07:00
|
|
|
{
|
2016-07-18 23:42:10 -07:00
|
|
|
if (obj->layer->usage <= 0)
|
|
|
|
{
|
|
|
|
evas_layer_del(obj->layer);
|
|
|
|
_evas_layer_free(obj->layer);
|
|
|
|
}
|
2011-06-18 02:16:22 -07:00
|
|
|
}
|
2016-07-18 23:42:10 -07:00
|
|
|
obj->layer = NULL;
|
|
|
|
obj->in_layer = 0;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2016-07-18 23:42:10 -07:00
|
|
|
else
|
|
|
|
obj->layer->removes = eina_list_append(obj->layer->removes, obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Layer *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_layer_new(Evas *eo_e)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Public_Data *e = efl_data_ref(eo_e, EVAS_CANVAS_CLASS);
|
2002-11-08 00:02:15 -08:00
|
|
|
Evas_Layer *lay;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
lay = calloc(1, sizeof(Evas_Layer));
|
|
|
|
if (!lay) return NULL;
|
|
|
|
lay->evas = e;
|
|
|
|
return lay;
|
|
|
|
}
|
|
|
|
|
2009-06-20 00:17:40 -07:00
|
|
|
static void
|
|
|
|
_evas_layer_free(Evas_Layer *lay)
|
|
|
|
{
|
|
|
|
free(lay);
|
|
|
|
}
|
|
|
|
|
2016-07-18 23:42:10 -07:00
|
|
|
void
|
|
|
|
_evas_layer_flush_removes(Evas_Layer *lay)
|
|
|
|
{
|
2016-08-09 08:30:55 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
|
|
|
|
2016-07-18 23:42:10 -07:00
|
|
|
if (lay->walking_objects) return;
|
2016-08-09 08:30:55 -07:00
|
|
|
EINA_LIST_FREE(lay->removes, obj)
|
2016-07-18 23:42:10 -07:00
|
|
|
{
|
|
|
|
lay->objects = (Evas_Object_Protected_Data *)
|
|
|
|
eina_inlist_remove(EINA_INLIST_GET(lay->objects),
|
|
|
|
EINA_INLIST_GET(obj));
|
|
|
|
obj->layer = NULL;
|
|
|
|
obj->in_layer = 0;
|
2016-08-09 08:30:55 -07:00
|
|
|
if (lay->usage > 0) lay->usage--;
|
2016-07-18 23:42:10 -07:00
|
|
|
}
|
|
|
|
if (lay->usage <= 0)
|
|
|
|
{
|
|
|
|
evas_layer_del(lay);
|
|
|
|
_evas_layer_free(lay);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-01-09 21:38:47 -08:00
|
|
|
void
|
|
|
|
evas_layer_pre_free(Evas_Layer *lay)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2016-07-18 23:42:10 -07:00
|
|
|
lay->walking_objects++;
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(lay->objects, obj)
|
2003-01-09 21:38:47 -08:00
|
|
|
{
|
2011-06-18 02:16:22 -07:00
|
|
|
if ((!obj->smart.parent) && (!obj->delete_me))
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_del(obj->object);
|
2003-01-09 21:38:47 -08:00
|
|
|
}
|
2016-07-18 23:42:10 -07:00
|
|
|
lay->walking_objects--;
|
|
|
|
_evas_layer_flush_removes(lay);
|
2003-01-09 21:38:47 -08:00
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
void
|
2009-06-20 00:17:40 -07:00
|
|
|
evas_layer_free_objects(Evas_Layer *lay)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2013-11-26 03:46:49 -08:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2013-11-26 03:46:49 -08:00
|
|
|
EINA_INLIST_FREE(lay->objects, obj)
|
|
|
|
{
|
2016-12-15 21:35:52 -08:00
|
|
|
evas_object_free(obj->object, EINA_FALSE);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2009-06-15 07:25:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_layer_clean(Evas *eo_e)
|
2009-06-15 07:25:21 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2009-06-15 07:25:21 -07:00
|
|
|
Evas_Layer *tmp;
|
|
|
|
|
|
|
|
while (e->layers)
|
|
|
|
{
|
2011-06-18 02:16:22 -07:00
|
|
|
tmp = e->layers;
|
|
|
|
evas_layer_del(tmp);
|
|
|
|
_evas_layer_free(tmp);
|
2009-06-15 07:25:21 -07:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Layer *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_layer_find(Evas *eo_e, short layer_num)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Layer *layer;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(e->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2011-06-18 02:16:22 -07:00
|
|
|
if (layer->layer == layer_num) return layer;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_layer_add(Evas_Layer *lay)
|
|
|
|
{
|
2008-10-17 04:23:18 -07:00
|
|
|
Evas_Layer *layer;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2008-10-21 05:19:57 -07:00
|
|
|
EINA_INLIST_FOREACH(lay->evas->layers, layer)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2011-06-18 02:16:22 -07:00
|
|
|
if (layer->layer > lay->layer)
|
|
|
|
{
|
|
|
|
lay->evas->layers = (Evas_Layer *)eina_inlist_prepend_relative(EINA_INLIST_GET(lay->evas->layers),
|
|
|
|
EINA_INLIST_GET(lay),
|
|
|
|
EINA_INLIST_GET(layer));
|
|
|
|
return;
|
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2008-10-17 04:23:18 -07:00
|
|
|
lay->evas->layers = (Evas_Layer *)eina_inlist_append(EINA_INLIST_GET(lay->evas->layers), EINA_INLIST_GET(lay));
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_layer_del(Evas_Layer *lay)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Public_Data *e;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
e = lay->evas;
|
2008-10-17 04:23:18 -07:00
|
|
|
e->layers = (Evas_Layer *)eina_inlist_remove(EINA_INLIST_GET(e->layers), EINA_INLIST_GET(lay));
|
2013-05-02 00:47:16 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_data_unref(e->evas, e);
|
2013-05-02 00:47:16 -07:00
|
|
|
lay->evas = NULL;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2012-07-23 21:59:22 -07:00
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_layer_set_child(Evas_Object *eo_obj, Evas_Object *par, short l)
|
2012-07-23 21:59:22 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
|
|
|
Evas_Object_Protected_Data *par_obj = efl_data_scope_get(par, EFL_CANVAS_OBJECT_CLASS);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2012-07-23 21:59:22 -07:00
|
|
|
if (obj->delete_me) return;
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->layer == l) return;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_release(eo_obj, obj, 1);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
|
|
|
|
{
|
|
|
|
state_write->layer = l;
|
|
|
|
}
|
|
|
|
EINA_COW_STATE_WRITE_END(obj, state_write, cur);
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
obj->layer = par_obj->layer;
|
2012-07-23 21:59:22 -07:00
|
|
|
obj->layer->usage++;
|
2012-10-08 18:58:41 -07:00
|
|
|
if (obj->is_smart)
|
2012-07-23 21:59:22 -07:00
|
|
|
{
|
|
|
|
Eina_Inlist *contained;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *member;
|
2012-08-02 09:05:49 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
contained = (Eina_Inlist *)evas_object_smart_members_get_direct(eo_obj);
|
2012-07-23 21:59:22 -07:00
|
|
|
EINA_INLIST_FOREACH(contained, member)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_layer_set_child(member->object, eo_obj, l);
|
2012-07-23 21:59:22 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
/* public functions */
|
|
|
|
|
2015-04-03 07:23:22 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_layer_set(Evas_Object *obj, short l)
|
|
|
|
{
|
2016-03-01 10:06:28 -08:00
|
|
|
efl_gfx_stack_layer_set((Evas_Object *)obj, l);
|
2015-04-03 07:23:22 -07:00
|
|
|
}
|
|
|
|
|
2014-03-11 04:51:35 -07:00
|
|
|
EOLIAN void
|
2016-06-20 21:26:15 -07:00
|
|
|
_efl_canvas_object_efl_gfx_stack_layer_set(Eo *eo_obj,
|
2015-04-03 07:23:22 -07:00
|
|
|
Evas_Object_Protected_Data *obj,
|
|
|
|
short l)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas *eo_e;
|
|
|
|
|
2011-06-18 02:08:33 -07:00
|
|
|
if (obj->delete_me) return;
|
2015-02-10 03:44:38 -08:00
|
|
|
evas_object_async_block(obj);
|
2016-10-06 20:43:21 -07:00
|
|
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_LAYER_SET, 1, l)) return;
|
2005-10-26 19:44:36 -07:00
|
|
|
if (obj->smart.parent) return;
|
2013-03-12 05:58:19 -07:00
|
|
|
if (obj->cur->layer == l)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_raise(eo_obj);
|
2011-06-18 02:16:22 -07:00
|
|
|
return;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
eo_e = obj->layer->evas->evas;
|
|
|
|
evas_object_release(eo_obj, obj, 1);
|
2013-03-12 05:58:19 -07:00
|
|
|
EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
|
|
|
|
{
|
|
|
|
state_write->layer = l;
|
|
|
|
}
|
|
|
|
EINA_COW_STATE_WRITE_END(obj, state_write, cur);
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inject(eo_obj, obj, eo_e);
|
2002-11-08 00:02:15 -08:00
|
|
|
obj->restack = 1;
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2002-12-09 22:45:18 -08:00
|
|
|
if (obj->clip.clipees)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inform_call_restack(eo_obj);
|
2011-06-18 02:16:22 -07:00
|
|
|
return;
|
2002-12-09 22:45:18 -08:00
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_change(eo_obj, obj);
|
2016-10-21 05:25:41 -07:00
|
|
|
if (!obj->is_smart && obj->cur->visible)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2016-10-21 05:25:41 -07:00
|
|
|
_evas_canvas_event_pointer_in_rect_mouse_move_feed(obj->layer->evas, eo_obj, obj,
|
|
|
|
1, 1, EINA_TRUE,
|
|
|
|
NULL);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2012-07-23 21:59:22 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
Eina_Inlist *contained;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Object_Protected_Data *member;
|
|
|
|
|
|
|
|
contained = (Eina_Inlist *)evas_object_smart_members_get_direct(eo_obj);
|
2012-07-23 21:59:22 -07:00
|
|
|
EINA_INLIST_FOREACH(contained, member)
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_object_layer_set_child(member->object, eo_obj, l);
|
2012-07-23 21:59:22 -07:00
|
|
|
}
|
|
|
|
}
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_inform_call_restack(eo_obj);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2015-04-03 07:23:22 -07:00
|
|
|
EAPI short
|
|
|
|
evas_object_layer_get(const Evas_Object *obj)
|
|
|
|
{
|
2016-03-01 10:06:28 -08:00
|
|
|
return efl_gfx_stack_layer_get((Evas_Object *)obj);
|
2015-04-03 07:23:22 -07:00
|
|
|
}
|
|
|
|
|
2014-03-11 04:51:35 -07:00
|
|
|
EOLIAN short
|
2016-06-20 21:26:15 -07:00
|
|
|
_efl_canvas_object_efl_gfx_stack_layer_get(Eo *eo_obj EINA_UNUSED,
|
2015-04-03 07:23:22 -07:00
|
|
|
Evas_Object_Protected_Data *obj)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2007-12-12 15:52:18 -08:00
|
|
|
if (obj->smart.parent)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *smart_parent_obj = efl_data_scope_get(obj->smart.parent, EFL_CANVAS_OBJECT_CLASS);
|
2014-03-11 04:51:35 -07:00
|
|
|
return smart_parent_obj->cur->layer;
|
2007-12-12 15:52:18 -08:00
|
|
|
}
|
2014-03-11 04:51:35 -07:00
|
|
|
return obj->cur->layer;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2014-03-11 04:51:35 -07:00
|
|
|
|