2013-12-25 06:13:41 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Eina.h>
|
2016-04-20 02:26:35 -07:00
|
|
|
#include <fnmatch.h>
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2013-12-25 06:19:07 -08:00
|
|
|
#include "Eo.h"
|
2013-12-25 06:13:41 -08:00
|
|
|
#include "eo_ptr_indirection.h"
|
|
|
|
#include "eo_private.h"
|
|
|
|
|
|
|
|
static int event_freeze_count = 0;
|
|
|
|
|
|
|
|
typedef struct _Eo_Callback_Description Eo_Callback_Description;
|
|
|
|
|
2016-04-19 01:21:21 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
2016-05-17 08:00:13 -07:00
|
|
|
const char *name;
|
2016-04-19 01:40:11 -07:00
|
|
|
const char *comment;
|
2016-05-05 08:08:08 -07:00
|
|
|
Eo *composite_parent;
|
2016-04-23 22:38:02 -07:00
|
|
|
Eina_Inlist *generic_data;
|
|
|
|
Eo ***wrefs;
|
2016-07-13 17:07:47 -07:00
|
|
|
Eina_List *futures;
|
2016-08-09 06:10:05 -07:00
|
|
|
} Efl_Object_Extension;
|
2016-04-19 01:21:21 -07:00
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
typedef struct
|
|
|
|
{
|
2016-05-17 02:25:31 -07:00
|
|
|
Eina_Inlist *children;
|
2016-04-19 01:40:11 -07:00
|
|
|
Eo *parent;
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext;
|
2016-04-20 15:50:46 -07:00
|
|
|
|
|
|
|
Eina_Inlist *current;
|
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
Eo_Callback_Description **callbacks;
|
|
|
|
unsigned int callbacks_count;
|
|
|
|
|
2016-04-19 01:40:11 -07:00
|
|
|
unsigned short walking_list;
|
|
|
|
unsigned short event_freeze_count;
|
|
|
|
Eina_Bool deletions_waiting : 1;
|
2016-06-20 02:37:02 -07:00
|
|
|
Eina_Bool callback_stopped : 1;
|
2016-10-21 07:02:27 -07:00
|
|
|
Eina_Bool parent_sunk : 1; // If parent ref has already been settled (parent has been set, or we are in add_ref mode
|
2016-08-09 06:10:05 -07:00
|
|
|
} Efl_Object_Data;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-04-29 05:43:36 -07:00
|
|
|
typedef enum {
|
|
|
|
DATA_PTR,
|
|
|
|
DATA_OBJ,
|
2016-07-07 02:41:23 -07:00
|
|
|
DATA_OBJ_WEAK,
|
2016-04-29 05:43:36 -07:00
|
|
|
DATA_VAL
|
|
|
|
} Eo_Generic_Data_Node_Type;
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
2016-07-07 02:41:23 -07:00
|
|
|
const Eo *obj;
|
2016-04-19 01:40:11 -07:00
|
|
|
Eina_Stringshare *key;
|
2016-04-29 05:08:07 -07:00
|
|
|
union {
|
2016-07-07 02:41:23 -07:00
|
|
|
Eina_Value *val;
|
|
|
|
Eo *obj;
|
|
|
|
void *ptr;
|
2016-04-29 05:08:07 -07:00
|
|
|
} d;
|
2016-04-29 05:43:36 -07:00
|
|
|
Eo_Generic_Data_Node_Type d_type;
|
2013-12-25 06:13:41 -08:00
|
|
|
} Eo_Generic_Data_Node;
|
|
|
|
|
2016-04-20 15:50:46 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Event_Description *desc;
|
2016-08-31 17:15:35 -07:00
|
|
|
unsigned int current;
|
2016-04-20 15:50:46 -07:00
|
|
|
} Eo_Current_Callback_Description;
|
2016-04-19 01:21:21 -07:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
static inline void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_free(Efl_Object_Extension *ext)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
free(ext);
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
|
2016-07-13 17:07:47 -07:00
|
|
|
static inline Efl_Object_Extension *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_need(Efl_Object_Data *pd)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-07-13 17:07:47 -07:00
|
|
|
if (!pd->ext) pd->ext = calloc(1, sizeof(Efl_Object_Extension));
|
|
|
|
return pd->ext;
|
2016-04-23 22:38:02 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_noneed(Efl_Object_Data *pd)
|
2016-04-23 22:38:02 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2016-07-13 17:07:47 -07:00
|
|
|
if ((!ext) ||
|
|
|
|
(ext->name) ||
|
|
|
|
(ext->comment) ||
|
|
|
|
(ext->generic_data) ||
|
|
|
|
(ext->wrefs) ||
|
|
|
|
(ext->composite_parent) ||
|
|
|
|
(ext->futures)) return;
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_free(pd->ext);
|
2016-04-23 22:38:02 -07:00
|
|
|
pd->ext = NULL;
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
|
2016-08-30 05:34:10 -07:00
|
|
|
static void _key_generic_cb_del(void *data, const Efl_Event *event);
|
2016-04-23 22:38:02 -07:00
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
static void
|
|
|
|
_eo_generic_data_node_free(Eo_Generic_Data_Node *node)
|
|
|
|
{
|
2016-04-29 05:20:21 -07:00
|
|
|
switch (node->d_type)
|
|
|
|
{
|
2016-07-07 02:41:23 -07:00
|
|
|
case DATA_PTR:
|
|
|
|
break;
|
2016-04-29 05:20:21 -07:00
|
|
|
case DATA_OBJ:
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_del(node->d.obj, EFL_EVENT_DEL, _key_generic_cb_del, node);
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(node->d.obj);
|
2016-07-07 02:41:23 -07:00
|
|
|
break;
|
|
|
|
case DATA_OBJ_WEAK:
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_del(node->d.obj, EFL_EVENT_DEL, _key_generic_cb_del, node);
|
2016-07-07 02:41:23 -07:00
|
|
|
break;
|
2016-04-29 05:20:21 -07:00
|
|
|
case DATA_VAL:
|
2016-07-07 02:41:23 -07:00
|
|
|
eina_value_free(node->d.val);
|
|
|
|
break;
|
2016-04-29 05:20:21 -07:00
|
|
|
}
|
2013-12-25 06:13:41 -08:00
|
|
|
eina_stringshare_del(node->key);
|
|
|
|
free(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_eo_generic_data_del_all(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-04-12 09:04:11 -07:00
|
|
|
Eo_Generic_Data_Node *node;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!ext) return;
|
2016-04-29 05:20:21 -07:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
while (ext->generic_data)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
node = (Eo_Generic_Data_Node *)ext->generic_data;
|
|
|
|
ext->generic_data = eina_inlist_remove(ext->generic_data,
|
2016-04-29 05:20:21 -07:00
|
|
|
EINA_INLIST_GET(node));
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
_eo_generic_data_node_free(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-17 09:02:37 -07:00
|
|
|
static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_eo_key_generic_direct_del(Efl_Object_Data *pd, Eo_Generic_Data_Node *node, Eina_Bool call_free)
|
2016-07-07 02:41:23 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2016-07-07 02:41:23 -07:00
|
|
|
|
|
|
|
ext->generic_data = eina_inlist_remove
|
|
|
|
(ext->generic_data, EINA_INLIST_GET(node));
|
|
|
|
if (call_free) _eo_generic_data_node_free(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_eo_key_generic_del(const Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, Eina_Bool call_free)
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
|
|
|
Eo_Generic_Data_Node *node;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2016-04-12 09:04:11 -07:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
EINA_INLIST_FOREACH(ext->generic_data, node)
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(node->key, key))
|
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
ext->generic_data = eina_inlist_remove
|
|
|
|
(ext->generic_data, EINA_INLIST_GET(node));
|
2016-07-07 02:41:23 -07:00
|
|
|
if (call_free) _eo_generic_data_node_free(node);
|
2016-04-12 09:04:11 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-29 05:43:36 -07:00
|
|
|
/* Return TRUE if the object was newly added. */
|
2016-07-07 02:41:23 -07:00
|
|
|
static Eo_Generic_Data_Node *
|
2016-08-09 06:10:05 -07:00
|
|
|
_key_generic_set(const Eo *obj, Efl_Object_Data *pd, const char *key, const void *data, Eo_Generic_Data_Node_Type d_type, Eina_Bool call_free)
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
|
|
|
Eo_Generic_Data_Node *node;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-07-07 02:41:23 -07:00
|
|
|
if (!key) return NULL;
|
2016-04-23 22:38:02 -07:00
|
|
|
if (ext)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-05-17 09:02:37 -07:00
|
|
|
if (!data)
|
|
|
|
{
|
2016-07-07 02:41:23 -07:00
|
|
|
_eo_key_generic_del(obj, pd, key, call_free);
|
|
|
|
return NULL;
|
2016-05-17 09:02:37 -07:00
|
|
|
}
|
2016-04-23 22:38:02 -07:00
|
|
|
EINA_INLIST_FOREACH(ext->generic_data, node)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!strcmp(node->key, key))
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
2016-04-29 05:43:36 -07:00
|
|
|
if ((node->d_type == d_type) && (node->d.ptr == data))
|
2016-07-07 20:26:07 -07:00
|
|
|
return NULL;
|
2016-04-23 22:38:02 -07:00
|
|
|
ext->generic_data = eina_inlist_remove
|
|
|
|
(ext->generic_data, EINA_INLIST_GET(node));
|
|
|
|
_eo_generic_data_node_free(node);
|
|
|
|
break;
|
2016-04-12 09:04:11 -07:00
|
|
|
}
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-13 17:07:47 -07:00
|
|
|
ext = _efl_object_extension_need(pd);
|
2016-04-23 22:38:02 -07:00
|
|
|
if (ext)
|
|
|
|
{
|
|
|
|
node = calloc(1, sizeof(Eo_Generic_Data_Node));
|
2016-07-07 20:26:07 -07:00
|
|
|
if (!node) return NULL;
|
2016-07-07 02:41:23 -07:00
|
|
|
node->obj = obj;
|
2016-04-23 22:38:02 -07:00
|
|
|
node->key = eina_stringshare_add(key);
|
2016-04-29 05:43:36 -07:00
|
|
|
node->d.ptr = (void *) data;
|
|
|
|
node->d_type = d_type;
|
2016-04-23 22:38:02 -07:00
|
|
|
ext->generic_data = eina_inlist_prepend
|
|
|
|
(ext->generic_data, EINA_INLIST_GET(node));
|
2016-07-07 02:41:23 -07:00
|
|
|
return node;
|
2016-04-23 22:38:02 -07:00
|
|
|
}
|
2016-04-29 05:43:36 -07:00
|
|
|
|
2016-07-07 02:41:23 -07:00
|
|
|
return NULL;
|
2016-04-12 09:04:11 -07:00
|
|
|
}
|
|
|
|
|
2016-04-29 05:43:36 -07:00
|
|
|
static void *
|
2016-08-09 06:10:05 -07:00
|
|
|
_key_generic_get(const Eo *obj, Efl_Object_Data *pd, const char *key, Eo_Generic_Data_Node_Type d_type)
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
|
|
|
Eo_Generic_Data_Node *node;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2016-04-12 09:04:11 -07:00
|
|
|
|
|
|
|
if (!key) return NULL;
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!ext) return NULL;
|
|
|
|
EINA_INLIST_FOREACH(ext->generic_data, node)
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(node->key, key))
|
|
|
|
{
|
2016-04-29 05:43:36 -07:00
|
|
|
if (node->d_type == d_type)
|
2016-04-12 09:04:11 -07:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
ext->generic_data = eina_inlist_promote
|
|
|
|
(ext->generic_data, EINA_INLIST_GET(node));
|
2016-04-29 05:43:36 -07:00
|
|
|
return node->d.ptr;
|
2016-04-12 09:04:11 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-29 05:43:36 -07:00
|
|
|
ERR("Object %p key '%s' asked for %d but is %d'",
|
|
|
|
obj, key, d_type, node->d_type);
|
2016-04-12 09:04:11 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-12-25 06:13:41 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-07-07 02:41:23 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_key_generic_cb_del(void *data, const Efl_Event *event EINA_UNUSED)
|
2016-07-07 02:41:23 -07:00
|
|
|
{
|
|
|
|
Eo_Generic_Data_Node *node = data;
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Object_Data *pd = efl_data_scope_get(node->obj, EFL_OBJECT_CLASS);
|
2016-07-07 02:41:23 -07:00
|
|
|
_eo_key_generic_direct_del(pd, node, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
2016-04-19 02:25:15 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_data_set(Eo *obj, Efl_Object_Data *pd, const char *key, const void *data)
|
2016-04-19 02:25:15 -07:00
|
|
|
{
|
2016-07-07 02:41:23 -07:00
|
|
|
_key_generic_set(obj, pd, key, data, DATA_PTR, EINA_TRUE);
|
2016-04-29 05:43:36 -07:00
|
|
|
}
|
2016-04-19 02:25:15 -07:00
|
|
|
|
2016-04-29 05:43:36 -07:00
|
|
|
EOLIAN static void *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_data_get(Eo *obj, Efl_Object_Data *pd, const char *key)
|
2016-04-29 05:43:36 -07:00
|
|
|
{
|
|
|
|
return _key_generic_get(obj, pd, key, DATA_PTR);
|
|
|
|
}
|
2016-04-19 02:25:15 -07:00
|
|
|
|
2016-04-29 05:43:36 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_ref_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, const Eo *objdata)
|
2016-04-29 05:43:36 -07:00
|
|
|
{
|
2016-07-07 02:41:23 -07:00
|
|
|
Eo_Generic_Data_Node *node;
|
|
|
|
|
2016-09-07 01:53:33 -07:00
|
|
|
if (!_eo_id_domain_compatible(obj, objdata)) return;
|
2016-07-07 02:41:23 -07:00
|
|
|
node = _key_generic_set(obj, pd, key, objdata, DATA_OBJ, EINA_TRUE);
|
|
|
|
if (node)
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_ref(objdata);
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_add((Eo *)objdata, EFL_EVENT_DEL, _key_generic_cb_del, node);
|
2016-07-07 02:41:23 -07:00
|
|
|
}
|
2016-04-29 05:43:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_ref_get(Eo *obj, Efl_Object_Data *pd, const char *key)
|
2016-04-29 05:43:36 -07:00
|
|
|
{
|
|
|
|
return _key_generic_get(obj, pd, key, DATA_OBJ);
|
|
|
|
}
|
|
|
|
|
2016-07-07 02:41:23 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_wref_set(Eo *obj, Efl_Object_Data *pd, const char * key, const Efl_Object *objdata)
|
2016-07-07 02:41:23 -07:00
|
|
|
{
|
|
|
|
Eo_Generic_Data_Node *node;
|
|
|
|
|
2016-09-07 01:53:33 -07:00
|
|
|
if (!_eo_id_domain_compatible(obj, objdata)) return;
|
2016-07-07 02:41:23 -07:00
|
|
|
node = _key_generic_set(obj, pd, key, objdata, DATA_OBJ_WEAK, EINA_TRUE);
|
|
|
|
if (node)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_add((Eo *)objdata, EFL_EVENT_DEL, _key_generic_cb_del, node);
|
2016-07-07 02:41:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_wref_get(Eo *obj, Efl_Object_Data *pd, const char * key)
|
2016-07-07 02:41:23 -07:00
|
|
|
{
|
|
|
|
return _key_generic_get(obj, pd, key, DATA_OBJ_WEAK);
|
|
|
|
}
|
|
|
|
|
2016-04-29 05:43:36 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_value_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *key, Eina_Value *value)
|
2016-04-29 05:43:36 -07:00
|
|
|
{
|
2016-07-07 02:41:23 -07:00
|
|
|
_key_generic_set(obj, pd, key, value, DATA_VAL, EINA_TRUE);
|
2016-04-19 02:25:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Value *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_key_value_get(Eo *obj, Efl_Object_Data *pd, const char *key)
|
2016-04-19 02:25:15 -07:00
|
|
|
{
|
2016-04-29 05:43:36 -07:00
|
|
|
return _key_generic_get(obj, pd, key, DATA_VAL);
|
2016-04-19 02:25:15 -07:00
|
|
|
}
|
|
|
|
|
2016-04-19 00:34:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_name_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *name)
|
2016-04-19 00:34:53 -07:00
|
|
|
{
|
2016-05-17 08:00:13 -07:00
|
|
|
if ((name) && (!name[0])) name = NULL;
|
|
|
|
if (name)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_need(pd);
|
2016-05-17 08:00:13 -07:00
|
|
|
if (pd->ext) eina_stringshare_replace(&(pd->ext->name), name);
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!pd->ext) return;
|
2016-05-17 08:00:13 -07:00
|
|
|
if (pd->ext->name)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-05-17 08:00:13 -07:00
|
|
|
eina_stringshare_replace(&(pd->ext->name), name);
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_noneed(pd);
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
}
|
2016-04-19 00:34:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_name_get(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2016-04-19 00:34:53 -07:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!pd->ext) return NULL;
|
2016-05-17 08:00:13 -07:00
|
|
|
return pd->ext->name;
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
|
2016-04-20 02:26:35 -07:00
|
|
|
static inline Eina_Bool
|
2016-05-17 08:00:13 -07:00
|
|
|
_name_match(const char *match, Eina_Bool is_glob, const char *str)
|
2016-04-20 02:26:35 -07:00
|
|
|
{
|
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
if (is_glob)
|
|
|
|
{
|
|
|
|
// if match string is empty - then it matches - same as "*"
|
|
|
|
if (!match[0]) return EINA_TRUE;
|
|
|
|
// if match string is "*" special case it and match
|
|
|
|
if ((match[0] == '*') && (match[1] == 0)) return EINA_TRUE;
|
|
|
|
// actual compare
|
|
|
|
if (!fnmatch(match, str, 0)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if match string is empty - then it matches - same as "*"
|
|
|
|
if (!match[0]) return EINA_TRUE;
|
|
|
|
// if pointers are the same they must be the same
|
|
|
|
if (match == str) return EINA_TRUE;
|
|
|
|
// actual compare
|
|
|
|
if (!strcmp(match, str)) return EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_matchall(const char *match)
|
|
|
|
{
|
|
|
|
if ((match[0] == 0) || ((match[0] == '*') && (match[1] == 0)))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_hasglob(const char *match)
|
|
|
|
{
|
|
|
|
if (strpbrk(match, "*?[")) return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_ismultiglob(const char *match)
|
|
|
|
{
|
|
|
|
if ((match[0] == '*') && (match[1] == '*') && (match[2] == 0))
|
|
|
|
return EINA_TRUE;
|
|
|
|
if ((match[0] == '*') && (match[1] == '*') && (match[2] == '/'))
|
|
|
|
return EINA_TRUE;
|
|
|
|
if ((match[0] == '/') && (match[1] == '*') && (match[2] == '*') && (match[3] == 0))
|
|
|
|
return EINA_TRUE;
|
|
|
|
if ((match[0] == '/') && (match[1] == '*') && (match[2] == '*') && (match[3] == '/'))
|
|
|
|
return EINA_TRUE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
EOLIAN static Efl_Object *
|
|
|
|
_efl_object_name_find(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *search)
|
2016-04-20 02:26:35 -07:00
|
|
|
{
|
|
|
|
Eo *child;
|
2016-05-17 02:25:31 -07:00
|
|
|
_Eo_Object *child_eo;
|
2016-05-17 08:00:13 -07:00
|
|
|
const char *name, *p, *klass_name;
|
2016-04-20 02:26:35 -07:00
|
|
|
|
|
|
|
// notes:
|
|
|
|
// if search contains NO "/" char, then its just a name search.
|
|
|
|
// if there is one or more "/" chars, then these are explicitly object
|
|
|
|
// delimiters.
|
|
|
|
// a name of "**" means 0 or more objects in the heirachy chain
|
|
|
|
// if the string has no "/" char at the start, it implies "/**/"
|
|
|
|
// a name can be a name or the form "class:name" where the object must
|
|
|
|
// be of class named "class" and name "name". if "name" is empty like:
|
|
|
|
// "class:" then an object of any name will match like "class:*". an
|
|
|
|
// empty class like ":name" is the sanme as "*:name" which is the same
|
|
|
|
// as "name". class ane name of course can be basic globs but not **
|
|
|
|
|
|
|
|
// search string NULL or "" is invalid
|
|
|
|
if (!search) return NULL;
|
|
|
|
if (!search[0]) return NULL;
|
|
|
|
|
|
|
|
if (strchr(search, '/'))
|
|
|
|
{
|
|
|
|
ERR("Looking up object by path '%s' is not supported", search);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// if this is a multi glob - "**" then we don't have a name or
|
|
|
|
// class to match at all so just don't look
|
|
|
|
if (_ismultiglob(search)) return NULL;
|
|
|
|
// check if this is "class:name" or just "name"
|
|
|
|
if ((p = strchr(search, ':')))
|
|
|
|
{
|
|
|
|
// "class:name"
|
2016-05-16 09:41:59 -07:00
|
|
|
char *klass;
|
2016-05-17 08:00:13 -07:00
|
|
|
char *search_name;
|
2016-05-16 09:41:59 -07:00
|
|
|
size_t colon_location = p - search;
|
2016-04-20 02:26:35 -07:00
|
|
|
Eina_Bool klass_glob = EINA_FALSE;
|
|
|
|
Eina_Bool name_glob = EINA_FALSE;
|
|
|
|
|
|
|
|
// split class:name into 2 strings dropping :
|
2016-05-16 09:41:59 -07:00
|
|
|
klass = alloca(strlen(search) + 1);
|
|
|
|
strcpy(klass, search);
|
|
|
|
klass[colon_location] = '\0';
|
2016-05-17 08:00:13 -07:00
|
|
|
search_name = klass + colon_location + 1;
|
2016-04-20 02:26:35 -07:00
|
|
|
|
|
|
|
// figure out if class or name are globs
|
|
|
|
klass_glob = _hasglob(klass);
|
2016-05-17 08:00:13 -07:00
|
|
|
name_glob = _hasglob(search_name);
|
2016-05-17 02:25:31 -07:00
|
|
|
EINA_INLIST_FOREACH(pd->children, child_eo)
|
2016-04-20 02:26:35 -07:00
|
|
|
{
|
2016-05-17 02:29:14 -07:00
|
|
|
child = _eo_obj_id_get(child_eo);
|
2016-08-09 06:10:05 -07:00
|
|
|
name = efl_name_get(child);
|
2016-08-15 06:44:41 -07:00
|
|
|
klass_name = efl_class_name_get(efl_class_get(child));
|
2016-05-17 08:00:13 -07:00
|
|
|
if (_name_match(klass, klass_glob, klass_name) &&
|
|
|
|
(((!_matchall(klass)) && (!name) && (_matchall(search_name))) ||
|
|
|
|
((name) && _name_match(search_name, name_glob, name))))
|
2016-04-20 02:26:35 -07:00
|
|
|
return child;
|
2016-08-09 06:10:05 -07:00
|
|
|
child = efl_name_find(child, search);
|
2016-04-20 02:26:35 -07:00
|
|
|
if (child) return child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (_hasglob(search))
|
|
|
|
{
|
|
|
|
// we have a glob - fnmatch
|
2016-05-17 02:25:31 -07:00
|
|
|
EINA_INLIST_FOREACH(pd->children, child_eo)
|
2016-04-20 02:26:35 -07:00
|
|
|
{
|
2016-05-17 02:29:14 -07:00
|
|
|
child = _eo_obj_id_get(child_eo);
|
2016-08-09 06:10:05 -07:00
|
|
|
name = efl_name_get(child);
|
2016-05-17 08:00:13 -07:00
|
|
|
if ((name) && (_name_match(search, EINA_TRUE, name)))
|
2016-04-20 02:26:35 -07:00
|
|
|
return child;
|
2016-08-09 06:10:05 -07:00
|
|
|
child = efl_name_find(child, search);
|
2016-04-20 02:26:35 -07:00
|
|
|
if (child) return child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// fast path for simple "name"
|
2016-05-17 02:25:31 -07:00
|
|
|
EINA_INLIST_FOREACH(pd->children, child_eo)
|
2016-04-20 02:26:35 -07:00
|
|
|
{
|
2016-05-17 02:29:14 -07:00
|
|
|
child = _eo_obj_id_get(child_eo);
|
2016-08-09 06:10:05 -07:00
|
|
|
name = efl_name_get(child);
|
2016-05-17 08:00:13 -07:00
|
|
|
if ((name) && (_name_match(search, EINA_FALSE, name)))
|
2016-04-20 02:26:35 -07:00
|
|
|
return child;
|
2016-08-09 06:10:05 -07:00
|
|
|
child = efl_name_find(child, search);
|
2016-04-20 02:26:35 -07:00
|
|
|
if (child) return child;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-04-19 01:21:21 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_comment_set(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const char *comment)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
|
|
|
if ((comment) && (!comment[0])) comment = NULL;
|
|
|
|
if (comment)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_need(pd);
|
2016-04-23 22:38:02 -07:00
|
|
|
if (pd->ext) eina_stringshare_replace(&(pd->ext->comment), comment);
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!pd->ext) return;
|
|
|
|
if (pd->ext->comment)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
eina_stringshare_replace(&(pd->ext->comment), comment);
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_noneed(pd);
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_comment_get(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
if (!pd->ext) return NULL;
|
|
|
|
return pd->ext->comment;
|
2016-04-19 00:34:53 -07:00
|
|
|
}
|
|
|
|
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_del(const Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
if (efl_parent_get((Eo *) obj))
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_parent_set((Eo *) obj, NULL);
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_unref(obj);
|
Revert "Eo: Remove eo_del() and make eo_unref() the replacement."
This reverts commit 546ff7bbba788ec834c5608361c0834853f2d5d7.
It seems that eo_del() is useful and removing it was creating bugs.
The issue is that the way we defined parents in eo, both the parent and
the programmer share a reference to the object. When we eo_unref() that
reference as the programmer, eo has no way to know it's this specific
reference we are freeing, and not a general one, so in some
circumstances, for example:
eo_ref(child);
eo_unref(child); // trying to delete here
eo_unref(container); // container is deleted here
eo_unref(child); // child already has 0 refs before this point.
We would have an issue with references and objects being freed too soon
and in general, issue with the references.
Having eo_del() solves that, because this one explicitly unparents if
there is a parent, meaning the reference ownership is explicitly taken
by the programmer.
eo_del() is essentially a convenience function around "check if has
parent, and if so unparent, otherwise, unref". Which should be used when
you want to delete an object although it has a parent, and is equivalent
to eo_unref() when it doesn't have one.
2016-06-01 05:14:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-21 07:02:27 -07:00
|
|
|
void
|
|
|
|
_efl_object_parent_sink(Eo *obj)
|
|
|
|
{
|
|
|
|
Efl_Object_Data *pd = efl_data_scope_get(obj, EFL_OBJECT_CLASS);
|
|
|
|
pd->parent_sunk = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_parent_set(Eo *obj, Efl_Object_Data *pd, Eo *parent_id)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
2016-10-21 07:02:27 -07:00
|
|
|
Eo *prev_parent = pd->parent;
|
2016-09-28 23:29:34 -07:00
|
|
|
if ((pd->parent == parent_id) ||
|
|
|
|
((parent_id) && (!_eo_id_domain_compatible(parent_id, obj))))
|
2013-12-26 12:11:48 -08:00
|
|
|
return;
|
|
|
|
|
2016-05-17 02:25:31 -07:00
|
|
|
EO_OBJ_POINTER(obj, eo_obj);
|
2013-12-26 12:11:48 -08:00
|
|
|
if (pd->parent)
|
|
|
|
{
|
2016-09-28 23:29:34 -07:00
|
|
|
Efl_Object_Data *old_parent_pd = efl_data_scope_get(pd->parent,
|
|
|
|
EFL_OBJECT_CLASS);
|
2013-12-26 12:11:48 -08:00
|
|
|
|
|
|
|
if (old_parent_pd)
|
2016-09-28 23:29:34 -07:00
|
|
|
old_parent_pd->children = eina_inlist_remove(old_parent_pd->children,
|
|
|
|
EINA_INLIST_GET(eo_obj));
|
|
|
|
// this error is highly unlikely so move it out of the normal
|
|
|
|
// instruction path to avoid l1 cache pollution
|
|
|
|
else goto err_impossible;
|
2013-12-26 12:11:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Set new parent */
|
|
|
|
if (parent_id)
|
|
|
|
{
|
2016-09-28 23:29:34 -07:00
|
|
|
Efl_Object_Data *parent_pd = efl_data_scope_get(parent_id,
|
|
|
|
EFL_OBJECT_CLASS);
|
2013-12-26 12:11:48 -08:00
|
|
|
|
|
|
|
if (EINA_LIKELY(parent_pd != NULL))
|
|
|
|
{
|
|
|
|
pd->parent = parent_id;
|
2016-05-17 02:25:31 -07:00
|
|
|
parent_pd->children = eina_inlist_append(parent_pd->children,
|
2016-09-28 23:29:34 -07:00
|
|
|
EINA_INLIST_GET(eo_obj));
|
2016-10-21 07:02:27 -07:00
|
|
|
if (!prev_parent && pd->parent_sunk) efl_ref(obj);
|
|
|
|
pd->parent_sunk = EINA_TRUE;
|
2013-12-26 12:11:48 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pd->parent = NULL;
|
2016-10-21 07:02:27 -07:00
|
|
|
if (prev_parent) efl_unref(obj);
|
2016-09-28 23:29:34 -07:00
|
|
|
// unlikely this error happens, so move it out of execution path
|
|
|
|
// to improve l1 cache efficiency
|
|
|
|
goto err_parent;
|
2013-12-26 12:11:48 -08:00
|
|
|
}
|
|
|
|
}
|
2016-10-21 07:02:27 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
pd->parent = NULL;
|
|
|
|
if (prev_parent && !eo_obj->del_triggered) efl_unref(obj);
|
|
|
|
}
|
2016-09-28 23:29:34 -07:00
|
|
|
|
2016-09-27 21:25:26 -07:00
|
|
|
EO_OBJ_DONE(obj);
|
2016-09-28 23:29:34 -07:00
|
|
|
return;
|
2016-10-06 00:19:12 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
err_parent:
|
|
|
|
ERR("New parent %p for object %p is not a valid Eo object.",
|
|
|
|
parent_id, obj);
|
2016-10-06 00:19:12 -07:00
|
|
|
EO_OBJ_DONE(obj);
|
2016-09-28 23:29:34 -07:00
|
|
|
return;
|
2016-10-06 00:19:12 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
err_impossible:
|
|
|
|
ERR("CONTACT DEVS!!! SHOULD NEVER HAPPEN!!! Old parent %p for object %p is not a valid Eo object.",
|
|
|
|
pd->parent, obj);
|
2016-10-06 00:19:12 -07:00
|
|
|
EO_OBJ_DONE(obj);
|
2013-12-26 12:11:48 -08:00
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_parent_get(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
|
|
|
return pd->parent;
|
|
|
|
}
|
|
|
|
|
2014-08-29 01:55:02 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_finalized_get(Eo *obj_id, Efl_Object_Data *pd EINA_UNUSED)
|
2014-08-29 01:55:02 -07:00
|
|
|
{
|
2016-09-27 21:25:26 -07:00
|
|
|
Eina_Bool finalized;
|
2014-08-29 01:55:02 -07:00
|
|
|
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, EINA_FALSE);
|
2016-09-27 21:25:26 -07:00
|
|
|
finalized = obj->finalized;
|
2016-10-05 19:55:03 -07:00
|
|
|
EO_OBJ_DONE(obj_id);
|
2016-09-27 21:25:26 -07:00
|
|
|
return finalized;
|
2014-08-29 01:55:02 -07:00
|
|
|
}
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
EOLIAN static Efl_Object *
|
|
|
|
_efl_object_provider_find(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, const Efl_Object *klass)
|
2016-04-20 23:15:13 -07:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
if (pd->parent) return efl_provider_find(pd->parent, klass);
|
2016-04-20 23:15:13 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2016-05-04 01:08:00 -07:00
|
|
|
|
2013-12-26 12:11:48 -08:00
|
|
|
/* Children accessor */
|
|
|
|
typedef struct _Eo_Children_Iterator Eo_Children_Iterator;
|
|
|
|
struct _Eo_Children_Iterator
|
|
|
|
{
|
|
|
|
Eina_Iterator iterator;
|
2016-05-17 02:25:31 -07:00
|
|
|
Eina_Inlist *current;
|
2013-12-26 12:11:48 -08:00
|
|
|
_Eo_Object *obj;
|
|
|
|
Eo *obj_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_children_iterator_next(Eo_Children_Iterator *it, void **data)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
|
|
|
if (!it->current) return EINA_FALSE;
|
|
|
|
|
2016-05-17 02:25:31 -07:00
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
_Eo_Object *eo_obj = EINA_INLIST_CONTAINER_GET(it->current, _Eo_Object);
|
2016-05-17 02:29:14 -07:00
|
|
|
*data = _eo_obj_id_get(eo_obj);
|
2016-05-17 02:25:31 -07:00
|
|
|
}
|
|
|
|
it->current = it->current->next;
|
2013-12-26 12:11:48 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eo *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_children_iterator_container(Eo_Children_Iterator *it)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
|
|
|
return it->obj_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_children_iterator_free(Eo_Children_Iterator *it)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
_Efl_Class *klass;
|
2013-12-26 12:11:48 -08:00
|
|
|
_Eo_Object *obj;
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
klass = (_Efl_Class*) it->obj->klass;
|
2013-12-26 12:11:48 -08:00
|
|
|
obj = it->obj;
|
|
|
|
|
|
|
|
eina_spinlock_take(&klass->iterators.trash_lock);
|
|
|
|
if (klass->iterators.trash_count < 8)
|
|
|
|
{
|
|
|
|
klass->iterators.trash_count++;
|
|
|
|
eina_trash_push(&klass->iterators.trash, it);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free(it);
|
|
|
|
}
|
|
|
|
eina_spinlock_release(&klass->iterators.trash_lock);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
_efl_unref(obj);
|
2013-12-26 12:11:48 -08:00
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static Eina_Iterator *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_children_iterator_new(Eo *obj_id, Efl_Object_Data *pd)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
_Efl_Class *klass;
|
2016-09-28 23:29:34 -07:00
|
|
|
Eo_Children_Iterator *it = NULL;
|
2013-12-26 12:11:48 -08:00
|
|
|
|
|
|
|
EO_OBJ_POINTER_RETURN_VAL(obj_id, obj, NULL);
|
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
if (pd->children)
|
2013-12-26 12:11:48 -08:00
|
|
|
{
|
2016-09-28 23:29:34 -07:00
|
|
|
klass = (_Efl_Class *)obj->klass;
|
2013-12-26 12:11:48 -08:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
eina_spinlock_take(&klass->iterators.trash_lock);
|
|
|
|
it = eina_trash_pop(&klass->iterators.trash);
|
|
|
|
if (it)
|
|
|
|
{
|
|
|
|
klass->iterators.trash_count--;
|
|
|
|
memset(it, 0, sizeof (Eo_Children_Iterator));
|
|
|
|
}
|
|
|
|
else it = calloc(1, sizeof (Eo_Children_Iterator));
|
|
|
|
eina_spinlock_release(&klass->iterators.trash_lock);
|
|
|
|
// very unlikely to not allocate the iterator to move this error
|
|
|
|
// handling out of l1 instruction cache
|
|
|
|
if (!it) goto done;
|
|
|
|
|
|
|
|
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
|
|
|
|
it->current = pd->children;
|
|
|
|
it->obj = _efl_ref(obj);
|
|
|
|
it->obj_id = obj_id;
|
|
|
|
it->iterator.next = FUNC_ITERATOR_NEXT(_efl_children_iterator_next);
|
|
|
|
it->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(_efl_children_iterator_container);
|
|
|
|
it->iterator.free = FUNC_ITERATOR_FREE(_efl_children_iterator_free);
|
|
|
|
}
|
|
|
|
done:
|
2016-09-27 21:25:26 -07:00
|
|
|
EO_OBJ_DONE(obj_id);
|
2013-12-26 12:11:48 -08:00
|
|
|
return (Eina_Iterator *)it;
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_dbg_info_get(Eo *obj EINA_UNUSED, Efl_Object_Data *pd EINA_UNUSED, Efl_Dbg_Info *root_node EINA_UNUSED)
|
2013-12-25 06:13:41 -08:00
|
|
|
{ /* No info required in the meantime */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Weak reference. */
|
|
|
|
|
|
|
|
static inline size_t
|
2016-08-09 06:10:05 -07:00
|
|
|
_wref_count(Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
Eo ***itr;
|
2013-12-25 06:13:41 -08:00
|
|
|
size_t count = 0;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
if ((!ext) || (!ext->wrefs)) return 0;
|
|
|
|
for (itr = ext->wrefs; *itr; itr++) count++;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_wref_add(Eo *obj, Efl_Object_Data *pd, Eo **wref)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
size_t count;
|
2013-12-26 11:56:59 -08:00
|
|
|
Eo ***tmp;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
count = _wref_count(pd);
|
|
|
|
count += 1; /* New wref. */
|
|
|
|
|
2016-07-13 17:07:47 -07:00
|
|
|
ext = _efl_object_extension_need(pd);
|
2016-09-28 23:29:34 -07:00
|
|
|
if (ext)
|
|
|
|
{
|
|
|
|
tmp = realloc(ext->wrefs, sizeof(*ext->wrefs) * (count + 1));
|
|
|
|
if (tmp)
|
|
|
|
{
|
|
|
|
ext->wrefs = tmp;
|
|
|
|
ext->wrefs[count - 1] = wref;
|
|
|
|
ext->wrefs[count] = NULL;
|
|
|
|
*wref = obj;
|
|
|
|
}
|
|
|
|
}
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-01-12 22:19:07 -08:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_wref_del(Eo *obj, Efl_Object_Data *pd, Eo **wref)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
size_t count;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// very unlikely so improve l1 instr cache by using goto
|
|
|
|
if (*wref != obj) goto err_wref_not_obj;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// very unlikely so improve l1 instr cache by using goto
|
|
|
|
if ((!ext) || (!ext->wrefs)) goto err_wref_none;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
/* Move the last item in the array instead of the current wref. */
|
|
|
|
count = _wref_count(pd);
|
|
|
|
|
|
|
|
{
|
|
|
|
Eo ***itr;
|
2016-04-23 22:38:02 -07:00
|
|
|
for (itr = ext->wrefs; *itr; itr++)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
if (*itr == wref)
|
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
*itr = ext->wrefs[count - 1];
|
2013-12-25 06:13:41 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-09-28 23:29:34 -07:00
|
|
|
// very unlikely so improve l1 instr cache by using goto
|
|
|
|
if (!*itr) goto err_noiter;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count > 1)
|
|
|
|
{
|
2013-12-26 11:56:59 -08:00
|
|
|
Eo ***tmp;
|
2016-04-23 22:38:02 -07:00
|
|
|
// No count--; because of the NULL that is not included in the count
|
|
|
|
tmp = realloc(ext->wrefs, sizeof(*ext->wrefs) * count);
|
2013-12-26 11:56:59 -08:00
|
|
|
if (!tmp) return;
|
2016-04-23 22:38:02 -07:00
|
|
|
ext->wrefs = tmp;
|
|
|
|
ext->wrefs[count - 1] = NULL;
|
2016-09-28 23:29:34 -07:00
|
|
|
*wref = NULL;
|
|
|
|
return;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-04-23 22:38:02 -07:00
|
|
|
free(ext->wrefs);
|
|
|
|
ext->wrefs = NULL;
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_noneed(pd);
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
*wref = NULL;
|
2016-09-28 23:29:34 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
err_noiter:
|
|
|
|
ERR("Wref %p is not associated with object %p", wref, obj);
|
|
|
|
goto err_null;
|
|
|
|
err_wref_none:
|
|
|
|
ERR("There are no weak refs for object %p", obj);
|
|
|
|
err_null:
|
|
|
|
*wref = NULL;
|
|
|
|
return;
|
|
|
|
err_wref_not_obj:
|
|
|
|
ERR("Wref is a weak ref to %p, while this function was called on %p.",
|
|
|
|
*wref, obj);
|
|
|
|
return;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2016-08-09 06:10:05 -07:00
|
|
|
_wref_destruct(Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
Eo ***itr;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext = pd->ext;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
if ((!ext) || (!ext->wrefs)) return;
|
|
|
|
for (itr = ext->wrefs; *itr; itr++) **itr = NULL;
|
|
|
|
free(ext->wrefs);
|
|
|
|
ext->wrefs = NULL;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF Weak reference. */
|
|
|
|
|
|
|
|
/* Event callbacks */
|
|
|
|
|
|
|
|
/* Callbacks */
|
|
|
|
|
2014-05-19 07:17:08 -07:00
|
|
|
/* XXX: Legacy support, remove when legacy is dead. */
|
|
|
|
static Eina_Hash *_legacy_events_hash = NULL;
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
EAPI const Efl_Event_Description *
|
|
|
|
efl_object_legacy_only_event_description_get(const char *_event_name)
|
2014-05-19 07:17:08 -07:00
|
|
|
{
|
2016-03-04 06:17:55 -08:00
|
|
|
Eina_Stringshare *event_name = eina_stringshare_add(_event_name);
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Event_Description *event_desc = eina_hash_find(_legacy_events_hash, event_name);
|
2014-05-19 07:17:08 -07:00
|
|
|
if (!event_desc)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
event_desc = calloc(1, sizeof(Efl_Event_Description));
|
2014-05-19 07:17:08 -07:00
|
|
|
event_desc->name = event_name;
|
2015-10-16 03:42:37 -07:00
|
|
|
event_desc->legacy_is = EINA_TRUE;
|
2014-05-29 01:24:28 -07:00
|
|
|
eina_hash_add(_legacy_events_hash, event_name, event_desc);
|
2014-05-19 07:17:08 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eina_stringshare_del(event_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return event_desc;
|
|
|
|
}
|
|
|
|
|
2015-10-16 03:42:37 -07:00
|
|
|
static inline Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_legacy_event_desc_is(const Efl_Event_Description *desc)
|
2015-09-28 16:45:34 -07:00
|
|
|
{
|
2015-10-16 03:42:37 -07:00
|
|
|
return desc->legacy_is;
|
2015-09-28 16:45:34 -07:00
|
|
|
}
|
|
|
|
|
2014-05-19 07:17:08 -07:00
|
|
|
static void
|
|
|
|
_legacy_events_hash_free_cb(void *_desc)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Event_Description *desc = _desc;
|
2014-05-19 07:17:08 -07:00
|
|
|
eina_stringshare_del(desc->name);
|
|
|
|
free(desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF Legacy */
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
struct _Eo_Callback_Description
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Callback_Array_Item item;
|
|
|
|
const Efl_Callback_Array_Item *item_array;
|
2013-12-25 06:13:41 -08:00
|
|
|
} items;
|
|
|
|
|
|
|
|
void *func_data;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Callback_Priority priority;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
Eina_Bool delete_me : 1;
|
|
|
|
Eina_Bool func_array : 1;
|
|
|
|
};
|
|
|
|
|
2016-08-28 23:36:48 -07:00
|
|
|
static int _eo_callbacks = 0;
|
|
|
|
static Eina_Mempool *_eo_callback_mempool = NULL;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_eo_callback_free(Eo_Callback_Description *cb)
|
|
|
|
{
|
|
|
|
if (!cb) return;
|
|
|
|
eina_mempool_free(_eo_callback_mempool, cb);
|
|
|
|
_eo_callbacks--;
|
|
|
|
if (_eo_callbacks == 0)
|
|
|
|
{
|
|
|
|
eina_mempool_del(_eo_callback_mempool);
|
|
|
|
_eo_callback_mempool = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eo_Callback_Description *
|
|
|
|
_eo_callback_new(void)
|
|
|
|
{
|
|
|
|
Eo_Callback_Description *cb;
|
2016-09-28 23:29:34 -07:00
|
|
|
// very unlikely that the mempool isnt initted, so take all the init code
|
|
|
|
// and move it out of l1 instruction cache space so we dont pollute the
|
|
|
|
// l1 cache with unused code 99% of the time
|
|
|
|
if (!_eo_callback_mempool) goto init_mempool;
|
|
|
|
init_mempool_back:
|
|
|
|
|
2016-08-28 23:36:48 -07:00
|
|
|
cb = eina_mempool_calloc(_eo_callback_mempool,
|
|
|
|
sizeof(Eo_Callback_Description));
|
2016-09-28 23:29:34 -07:00
|
|
|
if (cb)
|
2016-08-28 23:36:48 -07:00
|
|
|
{
|
2016-09-28 23:29:34 -07:00
|
|
|
_eo_callbacks++;
|
|
|
|
return cb;
|
2016-08-28 23:36:48 -07:00
|
|
|
}
|
2016-09-28 23:29:34 -07:00
|
|
|
if (_eo_callbacks != 0) return NULL;
|
|
|
|
eina_mempool_del(_eo_callback_mempool);
|
|
|
|
_eo_callback_mempool = NULL;
|
|
|
|
return NULL;
|
|
|
|
init_mempool:
|
|
|
|
_eo_callback_mempool = eina_mempool_add
|
|
|
|
("chained_mempool", NULL, NULL, sizeof(Eo_Callback_Description), 256);
|
|
|
|
if (!_eo_callback_mempool) return NULL;
|
|
|
|
goto init_mempool_back;
|
2016-08-28 23:36:48 -07:00
|
|
|
}
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
/* Actually remove, doesn't care about walking list, or delete_me */
|
|
|
|
static void
|
2016-08-31 17:15:35 -07:00
|
|
|
_eo_callback_remove(Efl_Object_Data *pd, Eo_Callback_Description **cb)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
unsigned int length;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
_eo_callback_free(*cb);
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
length = pd->callbacks_count - (cb - pd->callbacks);
|
|
|
|
if (length > 1) memmove(cb, cb + 1, (length - 1) * sizeof (Eo_Callback_Description*));
|
|
|
|
pd->callbacks_count--;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Actually remove, doesn't care about walking list, or delete_me */
|
|
|
|
static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_eo_callback_remove_all(Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < pd->callbacks_count; i++)
|
|
|
|
_eo_callback_free(pd->callbacks[i]);
|
|
|
|
|
|
|
|
free(pd->callbacks);
|
2016-09-06 06:12:23 -07:00
|
|
|
pd->callbacks = NULL;
|
2016-08-31 17:15:35 -07:00
|
|
|
pd->callbacks_count = 0;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_eo_callbacks_clear(Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
unsigned int i = 0;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
/* If there are no deletions waiting. */
|
2016-08-28 23:36:48 -07:00
|
|
|
if (!pd->deletions_waiting) return;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
/* Abort if we are currently walking the list. */
|
2016-08-28 23:36:48 -07:00
|
|
|
if (pd->walking_list > 0) return;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
pd->deletions_waiting = EINA_FALSE;
|
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
while (i < pd->callbacks_count)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
Eo_Callback_Description **itr;
|
|
|
|
|
|
|
|
itr = pd->callbacks + i;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
if ((*itr)->delete_me) _eo_callback_remove(pd, itr);
|
|
|
|
else i++;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
static inline unsigned int
|
|
|
|
_eo_callback_search_sorted_near(const Efl_Object_Data *pd, const Eo_Callback_Description *look)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
unsigned int start, last, middle;
|
2016-09-28 23:29:34 -07:00
|
|
|
const Eo_Callback_Description *p;
|
|
|
|
int cmp;
|
2016-08-28 23:36:48 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
if (pd->callbacks_count == 0) return 0;
|
|
|
|
else if (pd->callbacks_count == 1) return 0;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
start = 0;
|
|
|
|
last = pd->callbacks_count - 1;
|
|
|
|
do
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
middle = start + (last - start) / 2;
|
|
|
|
p = pd->callbacks[middle];
|
|
|
|
|
|
|
|
cmp = p->priority - look->priority;
|
2016-09-28 23:29:34 -07:00
|
|
|
if (cmp == 0) return middle;
|
|
|
|
else if (cmp > 0) start = middle + 1;
|
|
|
|
else if (middle > 0) last = middle - 1;
|
|
|
|
else break;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
2016-08-31 17:15:35 -07:00
|
|
|
while (start <= last);
|
|
|
|
return middle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_eo_callbacks_sorted_insert(Efl_Object_Data *pd, Eo_Callback_Description *cb)
|
|
|
|
{
|
|
|
|
Eo_Callback_Description **itr;
|
|
|
|
unsigned int length, j;
|
|
|
|
|
|
|
|
// Do a dichotomic searh
|
|
|
|
j = _eo_callback_search_sorted_near(pd, cb);
|
|
|
|
|
|
|
|
// Adjust for both case of length == 0 and when priority is equal.
|
|
|
|
while (j < pd->callbacks_count &&
|
|
|
|
pd->callbacks[j]->priority >= cb->priority)
|
|
|
|
j++;
|
|
|
|
|
|
|
|
|
|
|
|
// Increase the callbacks storage by 16 entries at a time
|
|
|
|
if ((pd->callbacks_count & 0xF) == 0x0)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
Eo_Callback_Description **tmp;
|
2016-09-05 08:22:33 -07:00
|
|
|
unsigned int new_len = (pd->callbacks_count | 0xF) + 1;
|
2016-08-31 17:15:35 -07:00
|
|
|
|
2016-09-05 08:22:33 -07:00
|
|
|
tmp = realloc(pd->callbacks, new_len * sizeof (Eo_Callback_Description*));
|
2016-08-31 17:15:35 -07:00
|
|
|
if (!tmp) return ;
|
|
|
|
pd->callbacks = tmp;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
2016-08-31 17:15:35 -07:00
|
|
|
|
|
|
|
// FIXME: Potential improvement, merge single callback description of the same priority
|
|
|
|
// into an array when possible
|
|
|
|
|
|
|
|
itr = pd->callbacks + j;
|
|
|
|
length = pd->callbacks_count - j;
|
|
|
|
if (length > 0) memmove(itr + 1, itr, length * sizeof (Eo_Callback_Description*));
|
|
|
|
|
|
|
|
*itr = cb;
|
|
|
|
|
|
|
|
pd->callbacks_count++;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-01-27 11:42:48 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_priority_add(Eo *obj, Efl_Object_Data *pd,
|
2016-09-28 23:29:34 -07:00
|
|
|
const Efl_Event_Description *desc,
|
|
|
|
Efl_Callback_Priority priority,
|
|
|
|
Efl_Event_Cb func,
|
|
|
|
const void *user_data)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
|
2016-08-28 23:36:48 -07:00
|
|
|
Eo_Callback_Description *cb = _eo_callback_new();
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// very unlikely so improve l1 instr cache by using goto
|
|
|
|
if (!cb || !desc || !func) goto err;
|
2013-12-25 06:13:41 -08:00
|
|
|
cb->items.item.desc = desc;
|
|
|
|
cb->items.item.func = func;
|
|
|
|
cb->func_data = (void *) user_data;
|
|
|
|
cb->priority = priority;
|
|
|
|
_eo_callbacks_sorted_insert(pd, cb);
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_call(obj, EFL_EVENT_CALLBACK_ADD, (void *)arr);
|
2016-01-27 11:42:48 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2016-09-28 23:29:34 -07:00
|
|
|
|
|
|
|
err:
|
|
|
|
ERR("Tried adding callback with invalid values: cb: %p desc: %p func: %p\n", cb, desc, func);
|
|
|
|
_eo_callback_free(cb);
|
|
|
|
return EINA_FALSE;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-01-27 11:42:48 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_del(Eo *obj, Efl_Object_Data *pd,
|
|
|
|
const Efl_Event_Description *desc,
|
|
|
|
Efl_Event_Cb func,
|
2014-06-03 03:23:53 -07:00
|
|
|
const void *user_data)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
Eo_Callback_Description **cb;
|
|
|
|
unsigned int i;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
for (cb = pd->callbacks, i = 0;
|
|
|
|
i < pd->callbacks_count;
|
|
|
|
cb++, i++)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
if (!(*cb)->delete_me &&
|
|
|
|
((*cb)->items.item.desc == desc) &&
|
|
|
|
((*cb)->items.item.func == func) &&
|
|
|
|
((*cb)->func_data == user_data))
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Callback_Array_Item arr[] = { {desc, func}, {NULL, NULL}};
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
(*cb)->delete_me = EINA_TRUE;
|
2016-08-28 23:36:48 -07:00
|
|
|
if (pd->walking_list > 0)
|
|
|
|
pd->deletions_waiting = EINA_FALSE;
|
|
|
|
else
|
2016-08-31 17:15:35 -07:00
|
|
|
_eo_callback_remove(pd, cb);
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_call(obj, EFL_EVENT_CALLBACK_DEL, (void *)arr);
|
2016-01-27 11:42:48 -08:00
|
|
|
return EINA_TRUE;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG("Callback of object %p with function %p and data %p not found.", obj, func, user_data);
|
2016-01-27 11:42:48 -08:00
|
|
|
return EINA_FALSE;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-01-27 11:42:48 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Object_Data *pd,
|
2016-09-28 23:29:34 -07:00
|
|
|
const Efl_Callback_Array_Item *array,
|
|
|
|
Efl_Callback_Priority priority,
|
|
|
|
const void *user_data)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-28 23:36:48 -07:00
|
|
|
Eo_Callback_Description *cb = _eo_callback_new();
|
2016-08-31 14:12:02 -07:00
|
|
|
#ifdef EO_DEBUG
|
|
|
|
const Efl_Callback_Array_Item *it;
|
|
|
|
const Efl_Callback_Array_Item *prev;
|
|
|
|
#endif
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// very unlikely so improve l1 instr cache by using goto
|
|
|
|
if (!cb || !array) goto err;
|
2016-08-31 14:12:02 -07:00
|
|
|
#ifdef EO_DEBUG
|
|
|
|
prev = array;
|
|
|
|
for (it = prev + 1; prev->func && it->func; it++, prev++)
|
|
|
|
{
|
|
|
|
if (efl_callbacks_cmp(prev, it) > 0)
|
|
|
|
{
|
|
|
|
ERR("Trying to insert a non sorted array callbacks (%p).", array);
|
|
|
|
_eo_callback_free(cb);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
cb->func_data = (void *) user_data;
|
|
|
|
cb->priority = priority;
|
|
|
|
cb->items.item_array = array;
|
|
|
|
cb->func_array = EINA_TRUE;
|
|
|
|
_eo_callbacks_sorted_insert(pd, cb);
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_call(obj, EFL_EVENT_CALLBACK_ADD, (void *)array);
|
2016-01-27 11:42:48 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2016-09-28 23:29:34 -07:00
|
|
|
|
|
|
|
err:
|
|
|
|
ERR("Tried adding array of callbacks with invalid values: cb: %p array: %p.", cb, array);
|
|
|
|
_eo_callback_free(cb);
|
|
|
|
return EINA_FALSE;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-01-27 11:42:48 -08:00
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_array_del(Eo *obj, Efl_Object_Data *pd,
|
2016-09-28 23:29:34 -07:00
|
|
|
const Efl_Callback_Array_Item *array,
|
|
|
|
const void *user_data)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
Eo_Callback_Description **cb;
|
|
|
|
unsigned int i;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
for (cb = pd->callbacks, i = 0;
|
|
|
|
i < pd->callbacks_count;
|
|
|
|
cb++, i++)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
if (!(*cb)->delete_me &&
|
|
|
|
((*cb)->items.item_array == array) &&
|
|
|
|
((*cb)->func_data == user_data))
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
(*cb)->delete_me = EINA_TRUE;
|
2016-08-28 23:36:48 -07:00
|
|
|
if (pd->walking_list > 0)
|
|
|
|
pd->deletions_waiting = EINA_FALSE;
|
|
|
|
else
|
2016-08-31 17:15:35 -07:00
|
|
|
_eo_callback_remove(pd, cb);
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_call(obj, EFL_EVENT_CALLBACK_DEL, (void *)array);
|
2016-01-27 11:42:48 -08:00
|
|
|
return EINA_TRUE;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG("Callback of object %p with function array %p and data %p not found.", obj, array, user_data);
|
2016-01-27 11:42:48 -08:00
|
|
|
return EINA_FALSE;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2014-05-19 07:28:49 -07:00
|
|
|
static Eina_Bool
|
2016-08-22 15:40:39 -07:00
|
|
|
_cb_desc_match(const Efl_Event_Description *a, const Efl_Event_Description *b, Eina_Bool legacy_compare)
|
2014-05-19 07:28:49 -07:00
|
|
|
{
|
2015-10-15 04:04:05 -07:00
|
|
|
/* If one is legacy and the other is not, strcmp. Else, pointer compare. */
|
2016-09-28 23:29:34 -07:00
|
|
|
if (!EINA_UNLIKELY(legacy_compare && (_legacy_event_desc_is(a) != _legacy_event_desc_is(b))))
|
|
|
|
return (a == b);
|
|
|
|
return !strcmp(a->name, b->name);
|
2014-05-19 07:28:49 -07:00
|
|
|
}
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
static inline Eina_Bool
|
|
|
|
_event_callback_call(Eo *obj_id, Efl_Object_Data *pd,
|
2016-09-28 23:29:34 -07:00
|
|
|
const Efl_Event_Description *desc,
|
|
|
|
void *event_info,
|
|
|
|
Eina_Bool legacy_compare)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
Eo_Callback_Description **cb;
|
2016-04-20 15:50:46 -07:00
|
|
|
Eo_Current_Callback_Description *lookup = NULL;
|
|
|
|
Eo_Current_Callback_Description saved;
|
2016-08-30 05:34:10 -07:00
|
|
|
Efl_Event ev;
|
2016-08-31 17:15:35 -07:00
|
|
|
unsigned int idx;
|
|
|
|
Eina_Bool callback_already_stopped = pd->callback_stopped;
|
|
|
|
Eina_Bool ret = EINA_TRUE;
|
2016-04-20 15:50:46 -07:00
|
|
|
|
2016-05-18 08:17:36 -07:00
|
|
|
ev.object = obj_id;
|
2016-02-29 01:12:35 -08:00
|
|
|
ev.desc = desc;
|
2016-04-12 07:23:55 -07:00
|
|
|
ev.info = event_info;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
if (pd->callbacks_count == 0) return EINA_FALSE;
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
pd->walking_list++;
|
|
|
|
|
2016-04-20 15:50:46 -07:00
|
|
|
// Handle event that require to restart where we were in the nested list walking
|
2016-09-28 23:29:34 -07:00
|
|
|
// relatively unlikely so improve l1 instr cache by using goto
|
|
|
|
if (desc->restart) goto restart;
|
|
|
|
else idx = pd->callbacks_count;
|
|
|
|
restart_back:
|
2016-04-20 15:50:46 -07:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
for (; idx > 0; idx--)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
cb = pd->callbacks + idx - 1;
|
|
|
|
if (!(*cb)->delete_me)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
if ((*cb)->func_array)
|
2015-11-09 06:06:39 -08:00
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Callback_Array_Item *it;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-31 17:15:35 -07:00
|
|
|
for (it = (*cb)->items.item_array; it->func; it++)
|
2015-11-09 06:06:39 -08:00
|
|
|
{
|
2016-08-31 14:12:02 -07:00
|
|
|
// Array callbacks are sorted, break if we are getting to high.
|
|
|
|
if (!legacy_compare &&
|
|
|
|
((const unsigned char *) desc - (const unsigned char *) it->desc) < 0)
|
|
|
|
break;
|
2016-08-22 15:40:39 -07:00
|
|
|
if (!_cb_desc_match(it->desc, desc, legacy_compare))
|
2015-11-09 06:06:39 -08:00
|
|
|
continue;
|
|
|
|
if (!it->desc->unfreezable &&
|
|
|
|
(event_freeze_count || pd->event_freeze_count))
|
|
|
|
continue;
|
|
|
|
|
2016-04-20 15:50:46 -07:00
|
|
|
// Handle nested restart of walking list
|
2016-08-31 17:15:35 -07:00
|
|
|
if (lookup) lookup->current = idx - 1;
|
|
|
|
it->func((void *) (*cb)->func_data, &ev);
|
2015-11-09 06:06:39 -08:00
|
|
|
/* Abort callback calling if the func says so. */
|
2016-06-20 02:37:02 -07:00
|
|
|
if (pd->callback_stopped)
|
2015-11-09 06:06:39 -08:00
|
|
|
{
|
|
|
|
ret = EINA_FALSE;
|
|
|
|
goto end;
|
|
|
|
}
|
2016-04-20 15:50:46 -07:00
|
|
|
// We have actually walked this list during a nested call
|
|
|
|
if (lookup &&
|
2016-08-31 17:15:35 -07:00
|
|
|
lookup->current == 0)
|
2016-04-20 15:50:46 -07:00
|
|
|
goto end;
|
2015-11-09 06:06:39 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-31 17:15:35 -07:00
|
|
|
if (!_cb_desc_match((*cb)->items.item.desc, desc, legacy_compare))
|
2015-11-09 06:06:39 -08:00
|
|
|
continue;
|
2016-08-31 17:15:35 -07:00
|
|
|
if (!(*cb)->items.item.desc->unfreezable &&
|
2015-11-09 06:06:39 -08:00
|
|
|
(event_freeze_count || pd->event_freeze_count))
|
2013-12-25 06:13:41 -08:00
|
|
|
continue;
|
|
|
|
|
2016-04-20 15:50:46 -07:00
|
|
|
// Handle nested restart of walking list
|
2016-08-31 17:15:35 -07:00
|
|
|
if (lookup) lookup->current = idx - 1;
|
|
|
|
(*cb)->items.item.func((void *) (*cb)->func_data, &ev);
|
2013-12-25 06:13:41 -08:00
|
|
|
/* Abort callback calling if the func says so. */
|
2016-06-20 02:37:02 -07:00
|
|
|
if (pd->callback_stopped)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
ret = EINA_FALSE;
|
|
|
|
goto end;
|
|
|
|
}
|
2016-04-20 15:50:46 -07:00
|
|
|
// We have actually walked this list during a nested call
|
|
|
|
if (lookup &&
|
2016-08-31 17:15:35 -07:00
|
|
|
lookup->current == 0)
|
2016-04-20 15:50:46 -07:00
|
|
|
goto end;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
2016-04-20 15:50:46 -07:00
|
|
|
// Handling restarting list walking complete exit.
|
2016-08-31 17:15:35 -07:00
|
|
|
if (lookup) lookup->current = 0;
|
2016-04-20 15:50:46 -07:00
|
|
|
if (lookup == &saved)
|
|
|
|
{
|
|
|
|
pd->current = eina_inlist_remove(pd->current, EINA_INLIST_GET(lookup));
|
|
|
|
}
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
pd->walking_list--;
|
|
|
|
_eo_callbacks_clear(pd);
|
|
|
|
|
2016-06-20 02:37:02 -07:00
|
|
|
pd->callback_stopped = callback_already_stopped;
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
return ret;
|
2016-09-28 23:29:34 -07:00
|
|
|
restart:
|
|
|
|
EINA_INLIST_FOREACH(pd->current, lookup)
|
|
|
|
{
|
|
|
|
if (lookup->desc == desc) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This is the first event to trigger it, so register it here
|
|
|
|
if (!lookup)
|
|
|
|
{
|
|
|
|
// This following trick get us a zero allocation list
|
|
|
|
saved.desc = desc;
|
|
|
|
saved.current = 0;
|
|
|
|
lookup = &saved;
|
|
|
|
// Ideally there will most of the time be only one item in this list
|
|
|
|
// But just to speed up things, prepend so we find it fast at the end
|
|
|
|
// of this function
|
|
|
|
pd->current = eina_inlist_prepend(pd->current, EINA_INLIST_GET(lookup));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!lookup->current) lookup->current = pd->callbacks_count;
|
|
|
|
idx = lookup->current;
|
|
|
|
goto restart_back;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_object_event_callback_call(Eo *obj_id, Efl_Object_Data *pd,
|
|
|
|
const Efl_Event_Description *desc,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
return _event_callback_call(obj_id, pd, desc, event_info, EINA_FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_object_event_callback_legacy_call(Eo *obj_id, Efl_Object_Data *pd,
|
|
|
|
const Efl_Event_Description *desc,
|
|
|
|
void *event_info)
|
|
|
|
{
|
|
|
|
return _event_callback_call(obj_id, pd, desc, event_info, EINA_TRUE);
|
|
|
|
}
|
|
|
|
|
2016-06-20 02:37:02 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_stop(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2016-06-20 02:37:02 -07:00
|
|
|
{
|
|
|
|
pd->callback_stopped = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_efl_event_forwarder_callback(void *data, const Efl_Event *event)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
Eo *new_obj = (Eo *) data;
|
2013-07-25 17:34:46 -07:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
ret = efl_event_callback_call(new_obj, event->desc, event->info);
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-06-20 02:37:02 -07:00
|
|
|
if (!ret)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_stop(event->object);
|
2016-06-20 02:37:02 -07:00
|
|
|
}
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: Change default priority? Maybe call later? */
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_forwarder_add(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
|
|
|
|
const Efl_Event_Description *desc,
|
2013-12-25 06:13:41 -08:00
|
|
|
Eo *new_obj)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_add(obj, desc, _efl_event_forwarder_callback, new_obj);
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_callback_forwarder_del(Eo *obj, Efl_Object_Data *pd EINA_UNUSED,
|
|
|
|
const Efl_Event_Description *desc,
|
2013-12-25 06:13:41 -08:00
|
|
|
Eo *new_obj)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* FIXME: Add it EO_MAGIC_RETURN(new_obj, EO_EINA_MAGIC); */
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
efl_event_callback_del(obj, desc, _efl_event_forwarder_callback, new_obj);
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_freeze(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
pd->event_freeze_count++;
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_thaw(Eo *obj, Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
if (pd->event_freeze_count > 0)
|
|
|
|
{
|
|
|
|
pd->event_freeze_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Events for object %p have already been thawed.", obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static int
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_freeze_count_get(Eo *obj EINA_UNUSED, Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
return pd->event_freeze_count;
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_global_freeze(Eo *klass EINA_UNUSED, void *pd EINA_UNUSED)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
event_freeze_count++;
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_global_thaw(Eo *klass EINA_UNUSED, void *pd EINA_UNUSED)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
if (event_freeze_count > 0)
|
|
|
|
{
|
|
|
|
event_freeze_count--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("Global events have already been thawed.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-03 03:23:53 -07:00
|
|
|
EOLIAN static int
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_event_global_freeze_count_get(Eo *klass EINA_UNUSED, void *pd EINA_UNUSED)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
return event_freeze_count;
|
|
|
|
}
|
|
|
|
|
2014-10-21 04:37:00 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_composite_attach(Eo *parent_id, Efl_Object_Data *pd EINA_UNUSED, Eo *comp_obj_id)
|
2014-10-21 04:37:00 -07:00
|
|
|
{
|
2016-10-06 00:27:28 -07:00
|
|
|
Eo *emb_obj_id = NULL;
|
|
|
|
|
2014-10-21 04:37:00 -07:00
|
|
|
EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
|
2016-10-06 00:27:28 -07:00
|
|
|
EO_OBJ_POINTER_GOTO(parent_id, parent, err_parent);
|
|
|
|
|
|
|
|
/* FIXME: composite should fail if domains are different */
|
2016-09-28 23:29:34 -07:00
|
|
|
|
2016-05-05 08:08:08 -07:00
|
|
|
/* Don't composite if we already have a composite object of this type */
|
2014-10-21 04:37:00 -07:00
|
|
|
{
|
|
|
|
Eina_List *itr;
|
|
|
|
EINA_LIST_FOREACH(parent->composite_objects, itr, emb_obj_id)
|
|
|
|
{
|
2016-10-06 00:27:28 -07:00
|
|
|
EO_OBJ_POINTER_GOTO(emb_obj_id, emb_obj, err_klass);
|
|
|
|
if (EINA_UNLIKELY(emb_obj->klass == comp_obj->klass)) goto err_klass;
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
2016-10-06 00:27:28 -07:00
|
|
|
emb_obj_id = NULL;
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
Efl_Object_Data *comp_pd = efl_data_scope_get(comp_obj_id, EFL_OBJECT_CLASS);
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
if (efl_composite_part_is(comp_obj_id))
|
2016-09-27 21:25:26 -07:00
|
|
|
efl_composite_detach(comp_pd->ext->composite_parent, comp_obj_id);
|
2016-05-05 08:08:08 -07:00
|
|
|
|
|
|
|
/* Set the parent comp on the child. */
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_need(comp_pd);
|
2016-05-05 08:08:08 -07:00
|
|
|
comp_pd->ext->composite_parent = parent_id;
|
2014-10-21 04:37:00 -07:00
|
|
|
|
2016-05-05 08:08:08 -07:00
|
|
|
parent->composite_objects = eina_list_prepend(parent->composite_objects, comp_obj_id);
|
2014-10-21 04:37:00 -07:00
|
|
|
|
2016-10-06 00:27:28 -07:00
|
|
|
if (emb_obj_id) EO_OBJ_DONE(emb_obj_id);
|
2016-09-27 21:25:26 -07:00
|
|
|
EO_OBJ_DONE(parent_id);
|
|
|
|
EO_OBJ_DONE(comp_obj_id);
|
2014-10-21 04:37:00 -07:00
|
|
|
return EINA_TRUE;
|
2016-09-28 23:29:34 -07:00
|
|
|
|
|
|
|
err_klass:
|
2016-10-06 00:27:28 -07:00
|
|
|
if (emb_obj_id) EO_OBJ_DONE(emb_obj_id);
|
2016-09-28 23:29:34 -07:00
|
|
|
EO_OBJ_DONE(parent_id);
|
|
|
|
err_parent:
|
|
|
|
EO_OBJ_DONE(comp_obj_id);
|
|
|
|
return EINA_FALSE;
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_composite_detach(Eo *parent_id, Efl_Object_Data *pd EINA_UNUSED, Eo *comp_obj_id)
|
2014-10-21 04:37:00 -07:00
|
|
|
{
|
|
|
|
EO_OBJ_POINTER_RETURN_VAL(comp_obj_id, comp_obj, EINA_FALSE);
|
2016-10-06 00:27:28 -07:00
|
|
|
EO_OBJ_POINTER_GOTO(parent_id, parent, err_parent);
|
2014-10-21 04:37:00 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// unlikely so improve l1 instr cache by using goto
|
|
|
|
if (!efl_composite_part_is(comp_obj_id)) goto err_part;
|
2014-10-21 04:37:00 -07:00
|
|
|
|
|
|
|
parent->composite_objects = eina_list_remove(parent->composite_objects, comp_obj_id);
|
2016-05-05 08:08:08 -07:00
|
|
|
/* Clear the comp parent on the child. */
|
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Efl_Object_Data *comp_pd = efl_data_scope_get(comp_obj_id, EFL_OBJECT_CLASS);
|
2016-05-05 08:08:08 -07:00
|
|
|
comp_pd->ext->composite_parent = NULL;
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_extension_noneed(comp_pd);
|
2016-05-05 08:08:08 -07:00
|
|
|
}
|
2014-10-21 04:37:00 -07:00
|
|
|
|
2016-09-27 21:25:26 -07:00
|
|
|
EO_OBJ_DONE(parent_id);
|
|
|
|
EO_OBJ_DONE(comp_obj_id);
|
2014-10-21 04:37:00 -07:00
|
|
|
return EINA_TRUE;
|
2016-09-28 23:29:34 -07:00
|
|
|
|
|
|
|
err_part:
|
|
|
|
EO_OBJ_DONE(parent_id);
|
|
|
|
err_parent:
|
|
|
|
EO_OBJ_DONE(comp_obj_id);
|
|
|
|
return EINA_FALSE;
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_composite_part_is(Eo *comp_obj_id EINA_UNUSED, Efl_Object_Data *pd)
|
2014-10-21 04:37:00 -07:00
|
|
|
{
|
2016-05-05 08:08:08 -07:00
|
|
|
return pd->ext && pd->ext->composite_parent;
|
2014-10-21 04:37:00 -07:00
|
|
|
}
|
|
|
|
|
2013-12-25 06:13:41 -08:00
|
|
|
/* Eo_Dbg */
|
|
|
|
EAPI void
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_dbg_info_free(Efl_Dbg_Info *info)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
eina_value_flush(&(info->value));
|
|
|
|
free(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_eo_dbg_info_setup(const Eina_Value_Type *type, void *mem)
|
|
|
|
{
|
|
|
|
memset(mem, 0, type->value_size);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_eo_dbg_info_flush(const Eina_Value_Type *type EINA_UNUSED, void *_mem)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Dbg_Info *mem = *(Efl_Dbg_Info **) _mem;
|
2013-12-25 06:13:41 -08:00
|
|
|
eina_stringshare_del(mem->name);
|
|
|
|
eina_value_flush(&(mem->value));
|
|
|
|
free(mem);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_eo_dbg_info_copy(const Eina_Value_Type *type EINA_UNUSED, const void *_src, void *_dst)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Dbg_Info **src = (const Efl_Dbg_Info **) _src;
|
|
|
|
Efl_Dbg_Info **dst = _dst;
|
2013-12-26 11:56:59 -08:00
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
*dst = calloc(1, sizeof(Efl_Dbg_Info));
|
2013-12-26 11:56:59 -08:00
|
|
|
if (!*dst) return EINA_FALSE;
|
2013-12-25 06:13:41 -08:00
|
|
|
(*dst)->name = eina_stringshare_ref((*src)->name);
|
|
|
|
eina_value_copy(&((*src)->value), &((*dst)->value));
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_eo_dbg_info_convert_to(const Eina_Value_Type *type EINA_UNUSED, const Eina_Value_Type *convert, const void *type_mem, void *convert_mem)
|
|
|
|
{
|
|
|
|
/* FIXME: For the meanwhile, just use the inner type for the value. */
|
2016-08-09 06:10:05 -07:00
|
|
|
const Efl_Dbg_Info **src = (const Efl_Dbg_Info **) type_mem;
|
2013-12-25 06:13:41 -08:00
|
|
|
if (convert == EINA_VALUE_TYPE_STRINGSHARE ||
|
|
|
|
convert == EINA_VALUE_TYPE_STRING)
|
|
|
|
{
|
|
|
|
Eina_Bool ret;
|
|
|
|
const char *other_mem;
|
|
|
|
char *inner_val = eina_value_to_string(&(*src)->value);
|
|
|
|
other_mem = inner_val;
|
|
|
|
ret = eina_value_type_pset(convert, convert_mem, &other_mem);
|
|
|
|
free(inner_val);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_error_set(EINA_ERROR_VALUE_FAILED);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_eo_dbg_info_pset(const Eina_Value_Type *type EINA_UNUSED, void *_mem, const void *_ptr)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Dbg_Info **mem = _mem;
|
2013-12-25 06:13:41 -08:00
|
|
|
if (*mem)
|
|
|
|
free(*mem);
|
|
|
|
*mem = (void *) _ptr;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_eo_dbg_info_pget(const Eina_Value_Type *type EINA_UNUSED, const void *_mem, void *_ptr)
|
|
|
|
{
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Dbg_Info **ptr = _ptr;
|
2013-12-25 06:13:41 -08:00
|
|
|
*ptr = (void *) _mem;
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
static const Eina_Value_Type _EFL_DBG_INFO_TYPE = {
|
2013-12-25 06:13:41 -08:00
|
|
|
EINA_VALUE_TYPE_VERSION,
|
2016-08-09 06:10:05 -07:00
|
|
|
sizeof(Efl_Dbg_Info *),
|
|
|
|
"Efl_Dbg_Info_Ptr",
|
2013-12-25 06:13:41 -08:00
|
|
|
_eo_dbg_info_setup,
|
|
|
|
_eo_dbg_info_flush,
|
|
|
|
_eo_dbg_info_copy,
|
|
|
|
NULL,
|
|
|
|
_eo_dbg_info_convert_to,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
_eo_dbg_info_pset,
|
|
|
|
_eo_dbg_info_pget
|
|
|
|
};
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
EAPI const Eina_Value_Type *EFL_DBG_INFO_TYPE = &_EFL_DBG_INFO_TYPE;
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
/* EOF event callbacks */
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
/* EFL_OBJECT_CLASS stuff */
|
|
|
|
#define MY_CLASS EFL_OBJECT_CLASS
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2015-05-19 03:41:27 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_constructor(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
DBG("%p - %s.", obj, efl_class_name_get(obj));
|
2013-12-25 06:13:41 -08:00
|
|
|
|
|
|
|
_eo_condtor_done(obj);
|
2015-05-19 03:41:27 -07:00
|
|
|
|
|
|
|
return obj;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2014-07-24 07:01:36 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_destructor(Eo *obj, Efl_Object_Data *pd)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
2013-11-08 04:24:40 -08:00
|
|
|
Eo *child;
|
2016-08-09 06:10:05 -07:00
|
|
|
Efl_Object_Extension *ext;
|
2016-09-28 23:29:34 -07:00
|
|
|
_Eo_Object *obj_data2 = NULL;
|
2013-11-08 04:24:40 -08:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
DBG("%p - %s.", obj, efl_class_name_get(obj));
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2015-08-18 01:23:16 -07:00
|
|
|
// special removal - remove from children list by hand after getting
|
|
|
|
// child handle in case unparent method is overridden and does
|
|
|
|
// extra things like removes other children too later on in the list
|
2016-09-28 23:29:34 -07:00
|
|
|
// this is a goto because more often than not objects do not have children
|
|
|
|
// so it's unlikely they will need the child cleanup code to so to have
|
|
|
|
// better l1 cache instruction coherency, move this to the end
|
|
|
|
if (pd->children) goto children;
|
|
|
|
children_back:
|
2015-08-21 09:19:47 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// If we are a composite object, detach children. it is quite unlikely
|
|
|
|
// we are a composite object, so put the core of this handling
|
|
|
|
// at the end out of l1 cache prefetch
|
2016-05-05 08:08:08 -07:00
|
|
|
{
|
|
|
|
EO_OBJ_POINTER_RETURN(obj, obj_data);
|
2016-09-28 23:29:34 -07:00
|
|
|
obj_data2 = obj_data;
|
|
|
|
if (obj_data->composite_objects) goto composite_obj;
|
|
|
|
composite_obj_back:
|
2016-09-27 21:25:26 -07:00
|
|
|
EO_OBJ_DONE(obj);
|
2016-05-05 08:08:08 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pd->ext && pd->ext->composite_parent)
|
2016-09-28 23:29:34 -07:00
|
|
|
efl_composite_detach(pd->ext->composite_parent, obj);
|
2016-05-05 08:08:08 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
// parent still being here is unlikely, so move error handling out of the
|
|
|
|
// code execution path
|
|
|
|
if (pd->parent) goto err_parent;
|
|
|
|
err_parent_back:
|
2013-11-08 04:24:40 -08:00
|
|
|
|
2016-04-12 09:04:11 -07:00
|
|
|
_eo_generic_data_del_all(obj, pd);
|
2014-06-03 03:23:53 -07:00
|
|
|
_wref_destruct(pd);
|
|
|
|
_eo_callback_remove_all(pd);
|
2013-12-25 06:13:41 -08:00
|
|
|
|
2016-04-23 22:38:02 -07:00
|
|
|
ext = pd->ext;
|
2016-09-28 23:29:34 -07:00
|
|
|
// it is rather likely we dont have any extension section for most objects
|
|
|
|
// so return immediately here to avoid pulling in more instructions to
|
|
|
|
// the 1l cache if we can
|
|
|
|
if (!ext)
|
2016-04-19 01:21:21 -07:00
|
|
|
{
|
2016-09-28 23:29:34 -07:00
|
|
|
_eo_condtor_done(obj);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
eina_stringshare_del(ext->name);
|
|
|
|
ext->name = NULL;
|
|
|
|
eina_stringshare_del(ext->comment);
|
|
|
|
ext->comment = NULL;
|
|
|
|
while (pd->ext && ext->futures)
|
|
|
|
efl_future_cancel(eina_list_data_get(ext->futures));
|
|
|
|
_efl_object_extension_noneed(pd);
|
|
|
|
_eo_condtor_done(obj);
|
|
|
|
return;
|
2016-07-13 17:07:47 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
children:
|
|
|
|
while (pd->children)
|
|
|
|
{
|
|
|
|
child = _eo_obj_id_get(EINA_INLIST_CONTAINER_GET(pd->children, _Eo_Object));
|
|
|
|
efl_parent_set(child, NULL);
|
2016-04-19 01:21:21 -07:00
|
|
|
}
|
2016-09-28 23:29:34 -07:00
|
|
|
goto children_back;
|
2016-04-19 00:34:53 -07:00
|
|
|
|
2016-09-28 23:29:34 -07:00
|
|
|
composite_obj:
|
|
|
|
{
|
|
|
|
Eina_List *itr, *next;
|
|
|
|
Eo *emb_obj_id;
|
|
|
|
EINA_LIST_FOREACH_SAFE(obj_data2->composite_objects, itr, next, emb_obj_id)
|
|
|
|
{
|
|
|
|
efl_composite_detach(obj, emb_obj_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
goto composite_obj_back;
|
|
|
|
|
|
|
|
err_parent:
|
|
|
|
ERR("Object '%p' still has a parent at the time of destruction.", obj);
|
|
|
|
efl_parent_set(obj, NULL);
|
|
|
|
goto err_parent_back;
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2014-07-24 07:01:36 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_finalize(Eo *obj, Efl_Object_Data *pd EINA_UNUSED)
|
2014-05-30 03:17:36 -07:00
|
|
|
{
|
2015-05-20 06:56:45 -07:00
|
|
|
return obj;
|
2014-05-30 03:17:36 -07:00
|
|
|
}
|
|
|
|
|
2014-07-24 07:01:36 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_class_constructor(Efl_Class *klass EINA_UNUSED)
|
2013-12-25 06:13:41 -08:00
|
|
|
{
|
|
|
|
event_freeze_count = 0;
|
2014-05-19 07:17:08 -07:00
|
|
|
_legacy_events_hash = eina_hash_stringshared_new(_legacy_events_hash_free_cb);
|
|
|
|
}
|
|
|
|
|
2014-07-24 07:01:36 -07:00
|
|
|
EOLIAN static void
|
2016-08-09 06:10:05 -07:00
|
|
|
_efl_object_class_destructor(Efl_Class *klass EINA_UNUSED)
|
2014-05-19 07:17:08 -07:00
|
|
|
{
|
|
|
|
eina_hash_free(_legacy_events_hash);
|
2013-12-25 06:13:41 -08:00
|
|
|
}
|
|
|
|
|
2016-07-13 17:07:47 -07:00
|
|
|
static void
|
|
|
|
_efl_object_future_link_tracking_end(void *data, const Efl_Event *ev)
|
|
|
|
{
|
|
|
|
Efl_Future *link = ev->object;
|
|
|
|
Eo *obj = data;
|
|
|
|
Efl_Object_Data *pd = efl_data_scope_get(obj, EFL_OBJECT_CLASS);
|
|
|
|
Efl_Object_Extension *ext = _efl_object_extension_need(pd);
|
|
|
|
|
|
|
|
ext->futures = eina_list_remove(ext->futures, link);
|
|
|
|
_efl_object_extension_noneed(pd);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_object_future_link(Eo *obj EINA_UNUSED, Efl_Object_Data *pd, Efl_Future *link)
|
|
|
|
{
|
|
|
|
Efl_Object_Extension *ext = _efl_object_extension_need(pd);
|
|
|
|
|
|
|
|
ext->futures = eina_list_append(ext->futures, link);
|
|
|
|
return !!efl_future_then(link, _efl_object_future_link_tracking_end, _efl_object_future_link_tracking_end, NULL, obj);
|
|
|
|
}
|
|
|
|
|
2016-08-09 06:10:05 -07:00
|
|
|
#include "efl_object.eo.c"
|