[DnD] Fix bug of hard-coded type when drag

Summary:
When we start dragging, the type is always set to "text/uri-list" no matter the format type set by application.
This patch fixs this hard-coded type issue. It will set types corresponding to the format type set by application.
For example, if application set format as ELM_SEL_FORMAT_TEXT, it will set types UTF8_STRING, STRING, COMPOUND_TEXT, TEXT,
text/plain, text/plain;charset=utf-8.

Reviewers: JackDanielZ, raster

Reviewed By: raster

CC: woohyun, seoz

Differential Revision: https://phab.enlightenment.org/D546
This commit is contained in:
Thiep Ha 2014-02-18 15:47:07 +09:00 committed by Carsten Haitzler (Rasterman)
parent 68a8e25672
commit ae8c65f968
1 changed files with 19 additions and 1 deletions

View File

@ -2024,6 +2024,7 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
Evas_Object *icon = NULL;
int w = 0, h = 0;
Ecore_X_Atom actx;
int i;
_x11_elm_cnp_init();
@ -2035,7 +2036,24 @@ _x11_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
return EINA_FALSE;
}
ecore_x_dnd_type_set(xwin, "text/uri-list", EINA_TRUE);
ecore_x_dnd_types_set(xwin, NULL, 0);
for (i = 0; i < CNP_N_ATOMS; i++)
{
if (_x11_atoms[i].formats == ELM_SEL_FORMAT_TARGETS)
{
if (format == ELM_SEL_FORMAT_TARGETS)
{
ecore_x_dnd_type_set(xwin, _x11_atoms[i].name, EINA_TRUE);
cnp_debug("set dnd type: %s\n", _x11_atoms[i].name);
}
}
else if (_x11_atoms[i].formats & format)
{
ecore_x_dnd_type_set(xwin, _x11_atoms[i].name, EINA_TRUE);
cnp_debug("set dnd type: %s\n", _x11_atoms[i].name);
}
}
sel = _x11_selections + ELM_SEL_TYPE_XDND;
sel->active = EINA_TRUE;
sel->widget = obj;