summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2015-06-09 09:13:06 +0900
committerThiep Ha <thiepha@gmail.com>2015-06-09 09:13:06 +0900
commit47bd0fa971721a0ba6d538643222c16661c4f780 (patch)
tree5dfdd2aa3df013c76411bd22261668fcd0250229
parent2923ae8582a8b86a00cdc09191931a1057049ebc (diff)
Dnd/X11: add dnd support for image, uri type
This patch adds dnd support for image and uri type. @fix
-rw-r--r--src/lib/elm_cnp.c70
1 files changed, 68 insertions, 2 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 221f80b3c..ac896a819 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1218,7 +1218,35 @@ _x11_notify_handler_uri(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *
1218 } 1218 }
1219 else 1219 else
1220 { 1220 {
1221 if (sel->datacb) 1221 if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
1222 {
1223 Dropable *dropable;
1224 Eina_List *l;
1225
1226 EINA_LIST_FOREACH(drops, l, dropable)
1227 {
1228 if (dropable->obj == sel->requestwidget) break;
1229 dropable = NULL;
1230 }
1231 if (dropable)
1232 {
1233 Dropable_Cbs *cbs;
1234 Eina_Inlist *itr;
1235 Elm_Selection_Data ddata;
1236
1237 dropable = eina_list_data_get(l);
1238 ddata.x = savedtypes.x;
1239 ddata.y = savedtypes.y;
1240 ddata.format = ELM_SEL_FORMAT_IMAGE;
1241 ddata.data = stripstr;
1242 ddata.len = strlen(stripstr);
1243 ddata.action = sel->action;
1244 EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
1245 if ((cbs->types & dropable->last.format) && cbs->dropcb)
1246 cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
1247 }
1248 }
1249 else if (sel->datacb)
1222 { 1250 {
1223 Elm_Selection_Data ddata; 1251 Elm_Selection_Data ddata;
1224 ddata.x = ddata.y = 0; 1252 ddata.x = ddata.y = 0;
@@ -1300,7 +1328,45 @@ _x11_notify_handler_image(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify
1300 data = notify->data; 1328 data = notify->data;
1301 1329
1302 cnp_debug("Size if %d\n", data->length); 1330 cnp_debug("Size if %d\n", data->length);
1303 if (sel->datacb) 1331 if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
1332 {
1333 Tmp_Info *tmp;
1334 Eina_List *l;
1335 Dropable *dropable;
1336
1337 tmp = _tempfile_new(data->length);
1338 if (!tmp)
1339 {
1340 ecore_x_dnd_send_finished();
1341 return 0;
1342 }
1343 memcpy(tmp->map, data->data, data->length);
1344 munmap(tmp->map, data->length);
1345 EINA_LIST_FOREACH(drops, l, dropable)
1346 {
1347 if (dropable->obj == sel->requestwidget) break;
1348 dropable = NULL;
1349 }
1350 if (dropable)
1351 {
1352 Dropable_Cbs *cbs;
1353 Eina_Inlist *itr;
1354 Elm_Selection_Data ddata;
1355
1356 ddata.x = savedtypes.x;
1357 ddata.y = savedtypes.y;
1358 ddata.format = ELM_SEL_FORMAT_IMAGE;
1359 ddata.data = tmp->filename;
1360 ddata.len = strlen(tmp->filename);
1361 ddata.action = sel->action;
1362 EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
1363 if ((cbs->types & dropable->last.format) && cbs->dropcb)
1364 cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
1365 }
1366 _tmpinfo_free(tmp);
1367 ecore_x_dnd_send_finished();
1368 }
1369 else if (sel->datacb)
1304 { 1370 {
1305 Elm_Selection_Data ddata; 1371 Elm_Selection_Data ddata;
1306 1372