#define PUBLIC __attribute__((visibility("default")))
-void _elm_access_object_hilight(Evas_Object *obj);
-
struct image_option {
int orient;
int aspect;
Evas_Object *parent;
Eina_List *obj_list;
- Eina_List *access_chain;
};
struct child {
char *id;
Eina_List *children;
Evas_Object *parent;
+ int delete_me;
};
static struct {
static void activate_cb(void *data, Evas_Object *part_obj, Elm_Object_Item *item)
{
- Evas_Object *ao;
- Evas_Object *edje;
Evas *e;
int x;
int y;
int h;
double timestamp;
- ao = evas_object_data_get(part_obj, "ao");
- if (!ao) {
- return;
- }
-
- edje = evas_object_data_get(ao, "edje");
- if (!edje) {
- return;
- }
-
e = evas_object_evas_get(part_obj);
evas_object_geometry_get(part_obj, &x, &y, &w, &h);
x += w / 2;
evas_event_feed_mouse_up(e, 1, EVAS_BUTTON_NONE, (timestamp + 0.03f) * 1000, NULL);
}
-static void access_del_cb(void *_info, Evas *e, Evas_Object *ao, void *event_info)
-{
- struct info *handle = _info;
- Evas_Object *edje_part;
-
- edje_part = evas_object_data_del(ao, "edje,part");
-
- /*!
- * \note
- * (void)evas_object_data_del(ao, "edje");
- * edje_part will delete the "ao" tag when it is deleted.
- * (void)evas_object_data_del(edje_part, "ao");
- */
-
- handle->access_chain = eina_list_remove(handle->access_chain, edje_part);
- DbgPrint("AO(%p) is removed from local access chain\n", ao);
-}
-
static void update_focus_chain(struct info *handle, Evas_Object *ao)
{
const Eina_List *list;
goto out;
}
- if (!handle->access_chain && s_info.access_on) {
- _elm_access_object_hilight(edje);
- }
-
- handle->access_chain = eina_list_append(handle->access_chain, edje_part);
evas_object_data_set(edje_part, "ao", ao);
- evas_object_data_set(ao, "edje", edje);
- evas_object_data_set(ao, "edje,part", edje_part);
elm_access_activate_cb_set(ao, activate_cb, NULL);
elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
- evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
DbgPrint("[%s] Register access info: (%s) to, %p\n", part, text, handle->parent);
}
} else {
elm_access_info_set(ao, ELM_ACCESS_INFO, text);
- if (!handle->access_chain && s_info.access_on) {
- _elm_access_object_hilight(edje);
- }
-
- handle->access_chain = eina_list_append(handle->access_chain, edje_part);
evas_object_data_set(edje_part, "ao", ao);
- evas_object_data_set(ao, "edje", edje);
- evas_object_data_set(ao, "edje,part", edje_part);
elm_object_focus_custom_chain_append(handle->parent, ao, NULL);
elm_access_activate_cb_set(ao, activate_cb, NULL);
- evas_object_event_callback_add(ao, EVAS_CALLBACK_DEL, access_del_cb, handle);
DbgPrint("[%s] Register access info: (%s) to, %p (%p)\n", part, text, handle->parent, ao);
}
}
Evas_Object *img;
Evas_Coord w, h;
struct obj_info *obj_info;
- struct child *child;
struct image_option img_opt = {
.aspect = 0,
.orient = 0,
img = elm_object_part_content_unset(edje, part);
if (img) {
- Eina_List *l;
- Eina_List *n;
-
- EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
- if (child->obj != img) {
- continue;
- }
-
- obj_info->children = eina_list_remove(obj_info->children, child);
- free(child->part);
- free(child);
- break;
- }
-
DbgPrint("delete object %s %p\n", part, img);
evas_object_del(img);
}
return LB_STATUS_SUCCESS;
}
- child = malloc(sizeof(*child));
- if (!child) {
- ErrPrint("Heap: %s\n", strerror(errno));
- return LB_STATUS_ERROR_MEMORY;
- }
-
- child->part = strdup(part);
- if (!child->part) {
- ErrPrint("Heap: %s\n", strerror(errno));
- free(child);
- return LB_STATUS_ERROR_MEMORY;
- }
-
img = evas_object_image_add(e);
if (!img) {
ErrPrint("Failed to add an image object\n");
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
if (err != EVAS_LOAD_ERROR_NONE) {
ErrPrint("Load error: %s\n", evas_load_error_str(err));
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_IO;
}
if (!part_w || !part_h || !w || !h) {
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_INVALID;
}
if (!ee) {
ErrPrint("Failed to create a EE\n");
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
if (!e) {
ErrPrint("Unable to get Evas\n");
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
if (!src_img) {
ErrPrint("Unable to add an image\n");
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_FAULT;
}
ErrPrint("Load error: %s\n", evas_load_error_str(err));
evas_object_del(src_img);
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_IO;
}
evas_object_image_size_get(src_img, &rw, &rh);
ErrPrint("Unable to get pixels\n");
evas_object_del(src_img);
ecore_evas_free(ee);
-
evas_object_del(img);
- free(child->part);
- free(child);
return LB_STATUS_ERROR_IO;
}
if (!img) {
evas_object_del(src_img);
ecore_evas_free(ee);
-
- free(child->part);
- free(child);
return LB_STATUS_ERROR_MEMORY;
}
* object will be shown by below statement automatically
*/
DbgPrint("%s part swallow image %p (%dx%d)\n", part, img, w, h);
- child->obj = img;
elm_object_part_content_set(edje, part, img);
- obj_info->children = eina_list_append(obj_info->children, child);
/*!
* \note
handle->obj_list = eina_list_remove(handle->obj_list, obj);
- obj_info = evas_object_data_del(obj, "obj_info");
+ obj_info = evas_object_data_get(obj, "obj_info");
if (!obj_info) {
ErrPrint("Object info is not valid\n");
return;
}
+ elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
+
DbgPrint("delete object %s %p\n", obj_info->id, obj);
- parent_obj_info = evas_object_data_get(obj_info->parent, "obj_info");
- if (parent_obj_info) {
+ if (obj_info->parent == obj) {
+ DbgPrint("Parent EDJE\n");
+ } else if (obj_info->parent) {
Eina_List *l;
Eina_List *n;
- EINA_LIST_FOREACH_SAFE(parent_obj_info->children, l, n, child) {
- if (child->obj != obj) {
- continue;
+ parent_obj_info = evas_object_data_get(obj_info->parent, "obj_info");
+ if (parent_obj_info) {
+ EINA_LIST_FOREACH_SAFE(parent_obj_info->children, l, n, child) {
+ if (child->obj != obj) {
+ continue;
+ }
+
+ /*!
+ * \note
+ * If this code is executed,
+ * The parent is not deleted by desc, this object is deleted by itself.
+ * It is not possible, but we care it.
+ */
+ DbgPrint("Children is updated: %s (%s)\n", child->part, parent_obj_info->id);
+ parent_obj_info->children = eina_list_remove(parent_obj_info->children, child);
+ free(child->part);
+ free(child);
+ break;
}
- /*!
- * \note
- * If this code is executed,
- * The parent is not deleted by desc, this object is deleted by itself.
- * It is not possible, but we care it.
- */
- DbgPrint("Parent's children is updated: %s\n", child->part);
- parent_obj_info->children = eina_list_remove(parent_obj_info->children, child);
- free(child->part);
- free(child);
- break;
+ if (!parent_obj_info->children && parent_obj_info->delete_me == 1) {
+ DbgPrint("Children is cleared: %s (by a child)\n", parent_obj_info->id);
+ evas_object_data_del(obj_info->parent, "obj_info");
+ free(parent_obj_info->id);
+ free(parent_obj_info);
+ }
}
} else {
- DbgPrint("Parent EDJE\n");
+ DbgPrint("obj_info->parent is NULL (skipped)\n");
}
- elm_object_signal_callback_del(obj, "*", "*", script_signal_cb);
-
- EINA_LIST_FREE(obj_info->children, child) {
- DbgPrint("delete object %s %p\n", child->part, child->obj);
- if (child->obj) {
- evas_object_del(child->obj);
- }
- free(child->part);
- free(child);
+ if (!obj_info->children) {
+ DbgPrint("Children is cleared: %s\n", obj_info->id);
+ evas_object_data_del(obj, "obj_info");
+ free(obj_info->id);
+ free(obj_info);
+ } else {
+ DbgPrint("Children is remained: %s\n", obj_info->id);
+ obj_info->delete_me = 1;
}
-
- free(obj_info->id);
- free(obj_info);
}
static inline Evas_Object *get_highlighted_object(Evas_Object *obj)
obj = elm_object_part_content_unset(edje, part);
if (obj) {
- Eina_List *l;
- Eina_List *n;
-
- EINA_LIST_FOREACH_SAFE(obj_info->children, l, n, child) {
- if (child->obj != obj) {
- continue;
- }
-
- obj_info->children = eina_list_remove(obj_info->children, child);
-
- free(child->part);
- free(child);
- break;
- }
-
DbgPrint("delete object %s %p\n", part, obj);
/*!
* \note
evas_object_del(edje);
}
+ DbgPrint("Release handle\n");
free(handle->category);
free(handle->file);
free(handle->group);
PUBLIC int script_unload(void *_handle, Evas *e)
{
struct info *handle;
- Evas_Object *edje;
- Evas_Object *parent = NULL;
handle = _handle;
- edje = eina_list_nth(handle->obj_list, 0);
- if (edje) {
- struct obj_info *obj_info;
-
- obj_info = evas_object_data_get(edje, "obj_info");
- if (obj_info) {
- parent = obj_info->parent;
- }
- evas_object_del(edje);
+ if (handle->e != e) {
+ DbgPrint("Ooops, handle->e(%p) is not matched with e(%p)\n", handle->e, e);
}
- if (parent) {
+ if (handle->parent) {
DbgPrint("Delete parent box\n");
- evas_object_del(parent);
+ evas_object_del(handle->parent);
}
handle->e = NULL;