aaah - oops - yeah.. no iw as trying to remove the extraneous \r\n at the

end.. i forgot to append to the right spot in the string.. i've simplified
it now :)


SVN revision: 5758
This commit is contained in:
Carsten Haitzler 2001-12-09 01:24:44 +00:00
parent 2663676042
commit a429866d9b
2 changed files with 15 additions and 37 deletions

View File

@ -383,10 +383,6 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
ic->view->drag.y = y; ic->view->drag.y = y;
ic->view->drag.update = 1; ic->view->drag.update = 1;
ic->view->changed = 1; ic->view->changed = 1;
if(e->mods & ECORE_EVENT_KEY_MODIFIER_SHIFT)
ic->view->drag.drop_mode = E_DND_COPY;
else
ic->view->drag.drop_mode = E_DND_MOVE;
/* Handle dnd motion - dragging==1 */ /* Handle dnd motion - dragging==1 */
ecore_pointer_xy_get(&x, &y); ecore_pointer_xy_get(&x, &y);

View File

@ -2600,19 +2600,16 @@ e_dnd_data_request(Ecore_Event * ev)
E_View *v; E_View *v;
Evas_List ll; Evas_List ll;
char *data = NULL; char *data = NULL;
int size = 3;
int idx = 0;
/* Me, my null, and an extra for the end '/r/n'... */ /* Me, my null, and an extra for the end '/r/n'... */
data = NEW(char, size); e_strdup(data, "");
*data = 0;
v = l->data; v = l->data;
if (e->win == v->win.base) if (e->win == v->win.base)
{ {
if (e->uri_list) if (e->uri_list)
{ {
/* int first = 1;*/ int first = 1;
for (ll = v->icons; ll; ll = ll->next) for (ll = v->icons; ll; ll = ll->next)
{ {
@ -2621,33 +2618,21 @@ e_dnd_data_request(Ecore_Event * ev)
ic = ll->data; ic = ll->data;
if (ic->state.selected) if (ic->state.selected)
{ {
int ic_size; char buf[PATH_MAX];
ic_size = 5 + strlen(v->dir) + 1 + strlen(ic->file) + 2;
size += ic_size;
REALLOC(data, char, size);
/*
* What's this for? It ends up double terminating
* the second and further files, plus the length
* needs to be adjusted for both cases...
* (And the wrong length breaks multi-file drops.)
if (first) if (first)
{ {
*/ sprintf(buf, "file:%s/%s", v->dir, ic->file);
sprintf(data + idx, "file:%s/%s\r\n", v->dir, ic->file);
#if 0
first = 0; first = 0;
} }
else else
sprintf(data + idx, "\r\nfile:%s/%s\r\n", v->dir, ic->file); sprintf(buf, "\r\nfile:%s/%s", v->dir, ic->file);
#endif REALLOC(data, char, strlen(data) + strlen(buf) + 1);
idx += ic_size; strcat(data, buf);
} }
} }
ecore_dnd_send_data(e->source_win, e->win, ecore_dnd_send_data(e->source_win, e->win,
data, strlen(data), data, strlen(data) + 1,
e->destination_atom, e->destination_atom,
DND_TYPE_URI_LIST); DND_TYPE_URI_LIST);
} }
@ -2663,23 +2648,21 @@ e_dnd_data_request(Ecore_Event * ev)
if (ic->state.selected) if (ic->state.selected)
{ {
int ic_size; int ic_size;
char buf[PATH_MAX];
ic_size = strlen(v->dir) + 1 + strlen(ic->file) + 1;
size += ic_size;
REALLOC(data, char, size);
if (first) if (first)
{ {
sprintf(data + idx, "%s/%s", v->dir, ic->file); sprintf(buf, "%s/%s\n", v->dir, ic->file);
first = 0; first = 0;
} }
else else
sprintf(data + idx, "\n%s/%s", v->dir, ic->file); sprintf(buf, "\n%s/%s", v->dir, ic->file);
idx += ic_size; REALLOC(data, char, strlen(data) + strlen(buf) + 1);
strcat(data, buf);
} }
} }
ecore_dnd_send_data(e->source_win, e->win, ecore_dnd_send_data(e->source_win, e->win,
data, strlen(data), data, strlen(data) + 1,
e->destination_atom, e->destination_atom,
DND_TYPE_PLAIN_TEXT); DND_TYPE_PLAIN_TEXT);
} }
@ -2699,14 +2682,13 @@ e_dnd_data_request(Ecore_Event * ev)
sprintf(buf, "file:%s/%s", v->dir, ic->file); sprintf(buf, "file:%s/%s", v->dir, ic->file);
data = strdup(buf); data = strdup(buf);
size = strlen(data);
break; break;
} }
} }
if (data) if (data)
{ {
ecore_dnd_send_data(e->source_win, e->win, ecore_dnd_send_data(e->source_win, e->win,
data, size, data, strlen(data) + 1,
e->destination_atom, e->destination_atom,
DND_TYPE_NETSCAPE_URL); DND_TYPE_NETSCAPE_URL);
} }