summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2015-06-09 16:51:13 +0900
committerThiep Ha <thiepha@gmail.com>2015-06-09 16:51:13 +0900
commit0ad02006ea209712a3ba761058c3a9a8ac9f6ccc (patch)
tree308c9baa03a4d064f66417732466f29be3c76ab9
parent52c85b3e1b51c0bc1ba95e10c11a038367aa98aa (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 2916a6f55..fa6409ea8 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1131,8 +1131,39 @@ _x11_notify_handler_uri(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *
1131 } 1131 }
1132 else 1132 else
1133 { 1133 {
1134 if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
1135 {
1136 Dropable *dropable;
1137 Eina_List *l;
1138
1139 EINA_LIST_FOREACH(drops, l, dropable)
1140 {
1141 if (dropable->obj == sel->requestwidget) break;
1142 dropable = NULL;
1143 }
1144 if (dropable)
1145 {
1146 Dropable_Cbs *cbs;
1147 Eina_Inlist *itr;
1148 Elm_Selection_Data ddata;
1149
1150 dropable = eina_list_data_get(l);
1151 ddata.x = savedtypes.x;
1152 ddata.y = savedtypes.y;
1153 ddata.format = ELM_SEL_FORMAT_IMAGE;
1154 ddata.data = stripstr;
1155 ddata.len = strlen(stripstr);
1156 ddata.action = sel->action;
1157 EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
1158 if ((cbs->types & dropable->last.format) && cbs->dropcb)
1159 cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
1160 }
1161 }
1162 else
1163 {
1164 _pasteimage_append(p, sel->requestwidget);
1165 }
1134 savedtypes.imgfile = NULL; 1166 savedtypes.imgfile = NULL;
1135 _pasteimage_append(p, sel->requestwidget);
1136 free(stripstr); 1167 free(stripstr);
1137 } 1168 }
1138 return 0; 1169 return 0;
@@ -1204,7 +1235,45 @@ _x11_notify_handler_image(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify
1204 data = notify->data; 1235 data = notify->data;
1205 1236
1206 cnp_debug("Size if %d\n", data->length); 1237 cnp_debug("Size if %d\n", data->length);
1207 if (sel->datacb) 1238 if (sel == (_x11_selections + ELM_SEL_TYPE_XDND))
1239 {
1240 Eina_List *l;
1241 Dropable *dropable;
1242
1243 tmp = _tempfile_new(data->length);
1244 if (!tmp)
1245 {
1246 ecore_x_dnd_send_finished();
1247 return 0;
1248 }
1249 memcpy(tmp->map, data->data, data->length);
1250 munmap(tmp->map, data->length);
1251 EINA_LIST_FOREACH(drops, l, dropable)
1252 {
1253 if (dropable->obj == sel->requestwidget) break;
1254 dropable = NULL;
1255 }
1256 if (dropable)
1257 {
1258 Dropable_Cbs *cbs;
1259 Eina_Inlist *itr;
1260 Elm_Selection_Data ddata;
1261
1262 ddata.x = savedtypes.x;
1263 ddata.y = savedtypes.y;
1264 ddata.format = ELM_SEL_FORMAT_IMAGE;
1265 ddata.data = tmp->filename;
1266 ddata.len = strlen(tmp->filename);
1267 ddata.action = sel->action;
1268 EINA_INLIST_FOREACH_SAFE(dropable->cbs_list, itr, cbs)
1269 if ((cbs->types & dropable->last.format) && cbs->dropcb)
1270 cbs->dropcb(cbs->dropdata, dropable->obj, &ddata);
1271 }
1272 _tmpinfo_free(tmp);
1273 ecore_x_dnd_send_finished();
1274 return 0;
1275 }
1276 else if (sel->datacb)
1208 { 1277 {
1209 Elm_Selection_Data ddata; 1278 Elm_Selection_Data ddata;
1210 1279