jackdanielz pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=562a334fc0e52538df37155d33b354d1c582dd12
commit 562a334fc0e52538df37155d33b354d1c582dd12 Author: Thiep Ha <[email protected]> Date: Tue Jun 9 16:51:13 2015 +0900 Dnd/X11: add dnd support for image, uri types There is no dnd callbacks for image, uri types. This patch adds dnd callbacks for those types. @fix --- src/lib/elm_cnp.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 71 insertions(+), 2 deletions(-) diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c index 31f7d14..8ccbe09 100644 --- a/src/lib/elm_cnp.c +++ b/src/lib/elm_cnp.c @@ -1139,8 +1139,39 @@ _x11_notify_handler_uri(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify * } else { + if (sel == (_x11_selections + ELM_SEL_TYPE_XDND)) + { + Dropable *dropable; + Eina_List *l; + + EINA_LIST_FOREACH(drops, l, dropable) + { + if (dropable->obj == sel->requestwidget) break; + dropable = NULL; + } + if (dropable) + { + Dropable_Cbs *cbs; + Eina_Inlist *itr; + Elm_Selection_Data ddata; + + dropable = eina_list_data_get(l); + ddata.x = savedtypes.x; + ddata.y = savedtypes.y; + ddata.format = ELM_SEL_FORMAT_IMAGE; + ddata.data = stripstr; + ddata.len = strlen(stripstr); + ddata.action = sel->action; + EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs) + if ((cbs->types & dropable->last.format) && cbs->dropcb) + cbs->dropcb(cbs->dropdata, dropable->obj, &ddata); + } + } + else + { + _pasteimage_append(p, sel->requestwidget); + } savedtypes.imgfile = NULL; - _pasteimage_append(p, sel->requestwidget); free(stripstr); } return 0; @@ -1212,7 +1243,45 @@ _x11_notify_handler_image(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify data = notify->data; cnp_debug("Size if %d\n", data->length); - if (sel->datacb) + if (sel == (_x11_selections + ELM_SEL_TYPE_XDND)) + { + Eina_List *l; + Dropable *dropable; + + tmp = _tempfile_new(data->length); + if (!tmp) + { + ecore_x_dnd_send_finished(); + return 0; + } + memcpy(tmp->map, data->data, data->length); + munmap(tmp->map, data->length); + EINA_LIST_FOREACH(drops, l, dropable) + { + if (dropable->obj == sel->requestwidget) break; + dropable = NULL; + } + if (dropable) + { + Dropable_Cbs *cbs; + Eina_Inlist *itr; + Elm_Selection_Data ddata; + + ddata.x = savedtypes.x; + ddata.y = savedtypes.y; + ddata.format = ELM_SEL_FORMAT_IMAGE; + ddata.data = tmp->filename; + ddata.len = strlen(tmp->filename); + ddata.action = sel->action; + EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs) + if ((cbs->types & dropable->last.format) && cbs->dropcb) + cbs->dropcb(cbs->dropdata, dropable->obj, &ddata); + } + _tmpinfo_free(tmp); + ecore_x_dnd_send_finished(); + return 0; + } + else if (sel->datacb) { Elm_Selection_Data ddata; --
