if (dropable)
{
Dropable_Cbs *cbs;
+ Eina_Inlist *itr;
ddata.x = savedtypes.x;
ddata.y = savedtypes.y;
ddata.format = ELM_SEL_FORMAT_TEXT;
ddata.data = data->data;
ddata.len = data->length;
ddata.action = sel->action;
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->dropcb)
- cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
+ cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
goto end;
}
}
if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
{
Dropable_Cbs *cbs;
+ Eina_Inlist *itr;
Elm_Selection_Data ddata;
cnp_debug("drag & drop\n");
ddata.data = data->data;
ddata.len = data->length;
ddata.action = sel->action;
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->dropcb)
- cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
+ cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
ecore_x_dnd_send_finished();
}
else if (sel->datacb)
{
Dropable *dropable_last = NULL;
Dropable_Cbs *cbs;
+ Eina_Inlist *itr;
if (dropable->last.in)
dropable_last = _x11_dropable_geom_find
if ((have_obj) && (dropable_last == dropable)) // same
{
cnp_debug("same obj dropable %p\n", dropable);
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->poscb)
- cbs->poscb(cbs->posdata, dropable->obj, x, y, action);
+ cbs->poscb(cbs->posdata, dropable->obj, x, y, action);
}
else if ((have_obj) && (!dropable_last)) // enter new obj
{
cnp_debug("enter %p\n", dropable->obj);
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->entercb)
- cbs->entercb(cbs->enterdata, dropable->obj);
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ cbs->entercb(cbs->enterdata, dropable->obj);
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->poscb)
- cbs->poscb(cbs->posdata, dropable->obj, x, y, action);
+ cbs->poscb(cbs->posdata, dropable->obj, x, y, action);
}
else if ((!have_obj) && (dropable_last)) // leave last obj
{
cnp_debug("leave %p\n", dropable_last->obj);
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->leavecb)
- cbs->leavecb(cbs->leavedata, dropable->obj);
+ cbs->leavecb(cbs->leavedata, dropable->obj);
}
else if (have_obj) // leave last obj and enter new one
{
cnp_debug("enter %p\n", dropable->obj);
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->entercb)
- cbs->entercb(cbs->enterdata, dropable->obj);
+ cbs->entercb(cbs->enterdata, dropable->obj);
if (dropable_last)
{
dropable = dropable_last;
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
if (cbs->leavecb)
- cbs->leavecb(cbs->leavedata, dropable->obj);
+ cbs->leavecb(cbs->leavedata, dropable->obj);
cnp_debug("leave %p\n", dropable->obj);
}
}
ddata.action = act;
Dropable_Cbs *cbs;
- EINA_INLIST_FOREACH(dropable->cbs_list, cbs)
+ Eina_Inlist *itr;
+ EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
{
/* If it's markup that also supports images */
if ((cbs->types & ELM_SEL_FORMAT_MARKUP) &&
- (cbs->types & ELM_SEL_FORMAT_IMAGE))
+ (cbs->types & ELM_SEL_FORMAT_IMAGE))
{
int len;
ddata.format = ELM_SEL_FORMAT_MARKUP;
snprintf(entrytag, len + 1, tagstring, savedtypes.imgfile);
ddata.data = entrytag;
cnp_debug("Insert %s\n", (char *)ddata.data);
- if (cbs->dropcb) cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
+ if (cbs->dropcb)
+ cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
}
else if (cbs->types & ELM_SEL_FORMAT_IMAGE)
{
cnp_debug("Doing image insert (%s)\n", savedtypes.imgfile);
ddata.format = ELM_SEL_FORMAT_IMAGE;
ddata.data = (char *)savedtypes.imgfile;
- if (cbs->dropcb) cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
+ if (cbs->dropcb)
+ cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
}
else
{
sel->active = EINA_TRUE;
sel->widget = obj;
sel->xwin = xwin;
- sel->set(xwin, &selection, sizeof(Elm_Sel_Type));
+ if (sel->set) sel->set(xwin, &selection, sizeof(Elm_Sel_Type));
sel->format = format;
sel->loss_cb = NULL;
sel->loss_data = NULL;
_x11_elm_cnp_init();
- /* TODO: check if obj is already a drop target. Do not add twice! */
-
/* Is this the first? */
EINA_LIST_FOREACH(drops, l, dropable)
{
if (!savedtypes.imgfile) return;
Dropable_Cbs *cbs;
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ Eina_Inlist *itr;
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
{
/* If it's markup that also supports images */
if ((cbs->types & ELM_SEL_FORMAT_MARKUP) &&
{
Dropable *last = NULL;
Dropable_Cbs *cbs;
+ Eina_Inlist *itr;
if (drop->last.in)
if ((have_obj) && (last == drop))
{
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
if (cbs->poscb)
cbs->poscb(cbs->posdata, drop->obj, x, y, dragaction);
}
else if ((have_obj) && (!last))
{
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
if (cbs->entercb)
cbs->entercb(cbs->enterdata, drop->obj);
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
if (cbs->poscb)
cbs->poscb(cbs->posdata, drop->obj, x, y, dragaction);
}
else if ((!have_obj) && (last))
{
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
if (cbs->leavecb)
cbs->leavecb(cbs->leavedata, drop->obj);
}
else if (have_obj)
{
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
if (cbs->entercb)
cbs->entercb(cbs->enterdata, drop->obj);
if (last)
{
drop = last;
- EINA_INLIST_FOREACH(drop->cbs_list, cbs)
+ EINA_INLIST_FOREACH_SAFE(drop->cbs_list, itr, cbs)
if (cbs->leavecb)
cbs->leavecb(cbs->leavedata, drop->obj);
}
if (elm_drop_item_container_del_internal(obj, EINA_FALSE))
{ /* Updating info of existing obj */
st = eina_list_search_unsorted(cont_drop_tg, _drop_item_container_cmp, obj);
+ if (!st) return EINA_FALSE;
}
else
{
st = calloc(1, sizeof(*st));
+ if (!st) return EINA_FALSE;
+
st->obj = obj;
cont_drop_tg = eina_list_append(cont_drop_tg, st);
}
if (elm_drag_item_container_del_internal(obj, EINA_FALSE))
{ /* Updating info of existing obj */
st = eina_list_search_unsorted(cont_drag_tg, _drag_item_container_cmp, obj);
+ if (!st) return EINA_FALSE;
}
else
{
st = calloc(1, sizeof(*st));
+ if (!st) return EINA_FALSE;
+
st->obj = obj;
cont_drag_tg = eina_list_append(cont_drag_tg, st);