summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2015-06-09 16:51:13 +0900
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2015-06-12 11:45:00 +0300
commit562a334fc0e52538df37155d33b354d1c582dd12 (patch)
tree705993ae0e385aea39186c9939406ef00fb0d093
parent01be46a784115daa6235170ef9d33d4a6b8da0b1 (diff)
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
-rw-r--r--src/lib/elm_cnp.c73
1 files changed, 71 insertions, 2 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 31f7d1421..8ccbe09bc 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 *
1139 } 1139 }
1140 else 1140 else
1141 { 1141 {
1142 if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
1143 {
1144 Dropable *dropable;
1145 Eina_List *l;
1146
1147 EINA_LIST_FOREACH(drops, l, dropable)
1148 {
1149 if (dropable->obj == sel->requestwidget) break;
1150 dropable = NULL;
1151 }
1152 if (dropable)
1153 {
1154 Dropable_Cbs *cbs;
1155 Eina_Inlist *itr;
1156 Elm_Selection_Data ddata;
1157
1158 dropable = eina_list_data_get(l);
1159 ddata.x = savedtypes.x;
1160 ddata.y = savedtypes.y;
1161 ddata.format = ELM_SEL_FORMAT_IMAGE;
1162 ddata.data = stripstr;
1163 ddata.len = strlen(stripstr);
1164 ddata.action = sel->action;
1165 EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
1166 if ((cbs->types & dropable->last.format) && cbs->dropcb)
1167 cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
1168 }
1169 }
1170 else
1171 {
1172 _pasteimage_append(p, sel->requestwidget);
1173 }
1142 savedtypes.imgfile = NULL; 1174 savedtypes.imgfile = NULL;
1143 _pasteimage_append(p, sel->requestwidget);
1144 free(stripstr); 1175 free(stripstr);
1145 } 1176 }
1146 return 0; 1177 return 0;
@@ -1212,7 +1243,45 @@ _x11_notify_handler_image(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify
1212 data = notify->data; 1243 data = notify->data;
1213 1244
1214 cnp_debug("Size if %d\n", data->length); 1245 cnp_debug("Size if %d\n", data->length);
1215 if (sel->datacb) 1246 if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
1247 {
1248 Eina_List *l;
1249 Dropable *dropable;
1250
1251 tmp = _tempfile_new(data->length);
1252 if (!tmp)
1253 {
1254 ecore_x_dnd_send_finished();
1255 return 0;
1256 }
1257 memcpy(tmp->map, data->data, data->length);
1258 munmap(tmp->map, data->length);
1259 EINA_LIST_FOREACH(drops, l, dropable)
1260 {
1261 if (dropable->obj == sel->requestwidget) break;
1262 dropable = NULL;
1263 }
1264 if (dropable)
1265 {
1266 Dropable_Cbs *cbs;
1267 Eina_Inlist *itr;
1268 Elm_Selection_Data ddata;
1269
1270 ddata.x = savedtypes.x;
1271 ddata.y = savedtypes.y;
1272 ddata.format = ELM_SEL_FORMAT_IMAGE;
1273 ddata.data = tmp->filename;
1274 ddata.len = strlen(tmp->filename);
1275 ddata.action = sel->action;
1276 EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
1277 if ((cbs->types & dropable->last.format) && cbs->dropcb)
1278 cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
1279 }
1280 _tmpinfo_free(tmp);
1281 ecore_x_dnd_send_finished();
1282 return 0;
1283 }
1284 else if (sel->datacb)
1216 { 1285 {
1217 Elm_Selection_Data ddata; 1286 Elm_Selection_Data ddata;
1218 1287