lok's xdnd work

SVN revision: 31378
This commit is contained in:
Carsten Haitzler 2007-08-18 10:37:16 +00:00
parent 549fc86562
commit 8128302bd5
10 changed files with 283 additions and 278 deletions

View File

@ -1,34 +1,7 @@
images { images {
image: "e17_logo_small.png" COMP; image: "e17_tl_corner_logo.png" COMP;
image: "e17_logo_small_p1.png" COMP; image: "e17_tl_corner_logo_shadow.png" LOSSY 90;
image: "e17_logo_small_p2.png" COMP; image: "e17_whitev.png" COMP;
image: "e17_logo_small_p3.png" COMP;
image: "e17_logo_small_p4.png" COMP;
image: "e17_logo_small_p5.png" COMP;
image: "e17_logo_small_p6.png" COMP;
image: "e17_logo_small_p7.png" COMP;
image: "e17_logo_small_p8.png" COMP;
image: "e17_logo_small_p9.png" COMP;
image: "e17_logo_small_p21.png" COMP;
image: "e17_logo_small_p22.png" COMP;
image: "e17_logo_small_p23.png" COMP;
image: "e17_logo_small_p24.png" COMP;
image: "e17_logo_small_p25.png" COMP;
image: "e17_logo_small_p26.png" COMP;
image: "e17_logo_small_p27.png" COMP;
image: "e17_logo_small_p28.png" COMP;
image: "e17_logo_small_p29.png" COMP;
}
styles
{
style {
name: "wizard_style";
base: "font=Edje-Vera-Bold font_size=16 text_class=tb_large align=center color=#fff style=soft_shadow shadow_color=#0002 wrap=word";
tag: "br" "\n";
tag: "hilight" "+ font=Edje-Vera-Bold text_class=tb_large_light style=glow color=#fff glow2_color=#fe87 glow_color=#fa14";
}
} }
group { group {
@ -37,10 +10,11 @@ group {
part { part {
name: "base"; name: "base";
mouse_events: 0; mouse_events: 0;
type: RECT;
description { description {
state: "default" 0.0; state: "default" 0.0;
color: 255 255 255 255; image {
normal: "e17_whitev.png";
}
} }
} }
} }
@ -52,63 +26,54 @@ group {
part { part {
name: "base"; name: "base";
mouse_events: 0; mouse_events: 0;
type: RECT;
description { description {
state: "default" 0.0; state: "default" 0.0;
color: 255 255 255 255; image {
} normal: "e17_whitev.png";
}
/*
part {
name: "e.textblock.message";
type: TEXTBLOCK;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to_y: "logo";
relative: 0.0 1.0;
offset: 8 8;
}
rel2 {
offset: -9 -9;
}
text {
style: "sys_style";
min: 1 1;
} }
} }
} }
*/
part { part {
name: "e.title"; name: "e.title";
type: TEXT; type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0; mouse_events: 0;
description { description {
state: "default" 0.0; state: "default" 0.0;
rel1 { rel1 {
to: "logo"; relative: 0.0 0.0;
relative: 1.0 0.0;
offset: 8 8; offset: 8 8;
} }
rel2 { rel2 {
to_y: "logo"; relative: 1.0 0.0;
relative: 1.0 1.0; offset: -9 8;
offset: -9 -9;
} }
color: 255 255 255 255; color: 0 0 0 255;
color3: 0 0 0 32;
text { text {
text: "Welcome to Enlightenment"; text: "Welcome to Enlightenment";
font: "Edje Vera Bold"; font: "Edje Vera Bold";
size: 16; size: 20;
min: 0 1; min: 0 1;
align: 0.5 0.5; align: 0.5 0.0;
text_class: "wizard_title"; text_class: "wizard_title";
} }
} }
} }
part {
name: "logo_shadow";
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
to: "logo";
}
rel2 {
to: "logo";
}
image {
normal: "e17_tl_corner_logo_shadow.png";
}
}
}
part { part {
name: "logo"; name: "logo";
mouse_events: 0; mouse_events: 0;
@ -116,145 +81,13 @@ group {
state: "default" 0.0; state: "default" 0.0;
aspect: 1.0 1.0; aspect: 1.0 1.0;
aspect_preference: BOTH; aspect_preference: BOTH;
min: 64 64; min: 20 20;
max: 128 128; max: 100 100;
align: 0.0 0.0; align: 0.0 0.0;
rel1 {
relative: 0.0 0.0;
offset: 8 8;
}
rel2 {
relative: 1.0 0.0;
offset: -9 8;
}
image { image {
normal: "e17_logo_small.png"; normal: "e17_tl_corner_logo.png";
} }
} }
} }
#define PT(_name, _p1, _p2, _p3, _p4) \
part { \
name: _name; \
mouse_events: 0; \
description { \
state: "default" 0.0; \
visible: 0; \
rel1 { \
to: "logo"; \
relative: _p1 _p2; \
} \
rel2 { \
to: "logo"; \
relative: _p3 _p4; \
} \
image { \
normal: "e17_logo_small_"_name".png"; \
} \
color: 255 255 255 0; \
} \
description { \
state: "active" 0.0; \
inherit: "default" 0.0; \
rel1 { \
to: "logo"; \
relative: _p1 _p2; \
} \
rel2 { \
to: "logo"; \
relative: _p3 _p4; \
} \
visible: 1; \
color: 255 255 255 255; \
} \
}
PT("p1", 0.1328125, 0.1640625, 0.3359375, 0.3593750);
PT("p2", 0.1953125, 0.1093750, 0.3906250, 0.3125000);
PT("p3", 0.2656250, 0.0625000, 0.4531250, 0.2734375);
PT("p4", 0.3359375, 0.0312500, 0.5234375, 0.2500000);
PT("p5", 0.4062500, 0.0234375, 0.5937500, 0.2421875);
PT("p6", 0.4765625, 0.0312500, 0.6640625, 0.2500000);
PT("p7", 0.5468750, 0.0625000, 0.7343750, 0.2734375);
PT("p8", 0.6093750, 0.1093750, 0.8046875, 0.3125000);
PT("p9", 0.6640625, 0.1640625, 0.8671875, 0.3593750);
PT("p21", 0.1328125, 0.6406250, 0.3359375, 0.8359375);
PT("p22", 0.1953125, 0.6875000, 0.3906250, 0.8906250);
PT("p23", 0.2656250, 0.7265625, 0.4531250, 0.9375000);
PT("p24", 0.3359375, 0.7500000, 0.5234375, 0.9687500);
PT("p25", 0.4062500, 0.7578125, 0.5937500, 0.9765625);
PT("p26", 0.4765625, 0.7500000, 0.6640625, 0.9687500);
PT("p27", 0.5468750, 0.7265625, 0.7343750, 0.9375000);
PT("p28", 0.6093750, 0.6875000, 0.8046875, 0.8906250);
PT("p29", 0.6640625, 0.6406250, 0.8671875, 0.8359375);
}
programs {
program {
name: "init";
signal: "show";
source: "";
after: "go_active_pre";
}
program {
name: "go_active_pre";
action: STATE_SET "default" 0.0;
target: "logo";
after: "go_active1";
after: "go_active2";
after: "go_active3";
after: "go_active4";
after: "go_active5";
after: "go_active6";
after: "go_active7";
after: "go_active8";
after: "go_active9";
after: "go_active21";
after: "go_active22";
after: "go_active23";
after: "go_active24";
after: "go_active25";
after: "go_active26";
after: "go_active27";
after: "go_active28";
after: "go_active29";
}
#define PR(_name, _delay, _part) \
program { \
name: "go_active"_name; \
in: _delay 0.0; \
after: "go_activeb"_name; \
} \
program { \
name: "go_activeb"_name; \
action: STATE_SET "active" 0.0; \
target: _part; \
transition: LINEAR 0.5; \
after: "go_activec"_name; \
} \
program { \
name: "go_activec"_name; \
action: STATE_SET "default" 0.0; \
target: _part; \
transition: LINEAR 1.2; \
after: "go_activeb"_name; \
}
PR("1", 0.0, "p1");
PR("2", 0.2, "p2");
PR("3", 0.4, "p3");
PR("4", 0.6, "p4");
PR("5", 0.8, "p5");
PR("6", 1.0, "p6");
PR("7", 1.2, "p7");
PR("8", 1.4, "p8");
PR("9", 1.6, "p9");
PR("21", 1.6, "p21");
PR("22", 1.4, "p22");
PR("23", 1.2, "p23");
PR("24", 1.0, "p24");
PR("25", 0.8, "p25");
PR("26", 0.6, "p26");
PR("27", 0.4, "p27");
PR("28", 0.2, "p28");
PR("29", 0.0, "p29");
} }
} }

View File

@ -551,4 +551,7 @@ x-office-calendar.png \
x-office-document.png \ x-office-document.png \
x-office-presentation.png \ x-office-presentation.png \
x-office-spreadsheet.png \ x-office-spreadsheet.png \
e17_icon_fileman_desktop.png e17_icon_fileman_desktop.png \
e17_tl_corner_logo.png \
e17_tl_corner_logo_shadow.png \
e17_whitev.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -5736,23 +5736,12 @@ _e_border_eval(E_Border *bd)
bd->bg_object = o; bd->bg_object = o;
shape_option = edje_object_data_get(o, "shaped"); shape_option = edje_object_data_get(o, "shaped");
if (shape_option) if (shape_option && !strcmp(shape_option, "1"))
{ {
if (!strcmp(shape_option, "1")) if (!bd->shaped)
{ {
if (!bd->shaped) bd->shaped = 1;
{ ecore_evas_shaped_set(bd->bg_ecore_evas, bd->shaped);
bd->shaped = 1;
ecore_evas_shaped_set(bd->bg_ecore_evas, bd->shaped);
}
}
else
{
if (bd->shaped)
{
bd->shaped = 0;
ecore_evas_shaped_set(bd->bg_ecore_evas, bd->shaped);
}
} }
} }
else else

View File

@ -919,10 +919,10 @@ e_config_init(void)
E_BINDING_MODIFIER_CTRL | E_BINDING_MODIFIER_ALT, 0, E_BINDING_MODIFIER_CTRL | E_BINDING_MODIFIER_ALT, 0,
"window_maximized_toggle", NULL); "window_maximized_toggle", NULL);
CFG_KEYBIND(E_BINDING_CONTEXT_ANY, "F10", CFG_KEYBIND(E_BINDING_CONTEXT_ANY, "F10",
E_BINDING_MODIFIER_ALT, 0, E_BINDING_MODIFIER_SHIFT, 0,
"window_maximized_toggle", "default vertical"); "window_maximized_toggle", "default vertical");
CFG_KEYBIND(E_BINDING_CONTEXT_ANY, "F10", CFG_KEYBIND(E_BINDING_CONTEXT_ANY, "F10",
E_BINDING_MODIFIER_SHIFT, 0, E_BINDING_MODIFIER_SHIFT | E_BINDING_MODIFIER_ALT, 0,
"window_maximized_toggle", "default horizontal"); "window_maximized_toggle", "default horizontal");
CFG_KEYBIND(E_BINDING_CONTEXT_ANY, "r", CFG_KEYBIND(E_BINDING_CONTEXT_ANY, "r",
E_BINDING_MODIFIER_CTRL | E_BINDING_MODIFIER_ALT, 0, E_BINDING_MODIFIER_CTRL | E_BINDING_MODIFIER_ALT, 0,

View File

@ -59,7 +59,7 @@ static Ecore_X_Window _drag_win = 0;
static Evas_List *_drag_list = NULL; static Evas_List *_drag_list = NULL;
static E_Drag *_drag_current = NULL; static E_Drag *_drag_current = NULL;
static XDnd *_xdnd; static XDnd *_xdnd = NULL;
/* externally accessible functions */ /* externally accessible functions */
@ -290,10 +290,15 @@ e_drag_start(E_Drag *drag, int x, int y)
EAPI int EAPI int
e_drag_xdnd_start(E_Drag *drag, int x, int y) e_drag_xdnd_start(E_Drag *drag, int x, int y)
{ {
Ecore_X_Atom actions[] = {ECORE_X_DND_ACTION_MOVE, ECORE_X_DND_ACTION_PRIVATE,
ECORE_X_DND_ACTION_COPY, ECORE_X_DND_ACTION_ASK,
ECORE_X_DND_ACTION_LINK};
if (_drag_win) return 0; if (_drag_win) return 0;
_drag_win = ecore_x_window_input_new(drag->container->win, _drag_win = ecore_x_window_input_new(drag->container->win,
drag->container->x, drag->container->y, drag->container->x, drag->container->y,
drag->container->w, drag->container->h); drag->container->w, drag->container->h);
ecore_x_window_show(_drag_win); ecore_x_window_show(_drag_win);
if (!e_grabinput_get(_drag_win, 1, _drag_win)) if (!e_grabinput_get(_drag_win, 1, _drag_win))
{ {
@ -308,6 +313,7 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y)
ecore_x_dnd_aware_set(_drag_win, 1); ecore_x_dnd_aware_set(_drag_win, 1);
ecore_x_dnd_types_set(_drag_win, drag->types, drag->num_types); ecore_x_dnd_types_set(_drag_win, drag->types, drag->num_types);
ecore_x_dnd_actions_set(_drag_win, actions, 5);
ecore_x_dnd_begin(_drag_win, drag->data, drag->data_size); ecore_x_dnd_begin(_drag_win, drag->data, drag->data_size);
_drag_current = drag; _drag_current = drag;
@ -347,6 +353,7 @@ e_drop_handler_add(E_Object *obj,
handler->h = h; handler->h = h;
handler->obj = obj; handler->obj = obj;
handler->entered = 0;
_drop_handlers = evas_list_append(_drop_handlers, handler); _drop_handlers = evas_list_append(_drop_handlers, handler);
@ -676,8 +683,7 @@ _e_drag_update(int x, int y)
move_ev.y = y - dy; move_ev.y = y - dy;
leave_ev.x = x - dx; leave_ev.x = x - dx;
leave_ev.y = y - dy; leave_ev.y = y - dy;
if ((_e_drag_win_matches(h, win)) && if (E_INSIDE(x, y, dx, dy, dw, dh))
(E_INSIDE(x, y, dx, dy, dw, dh)))
{ {
if (!h->entered) if (!h->entered)
{ {
@ -725,8 +731,7 @@ _e_drag_update(int x, int y)
move_ev.y = y - dy; move_ev.y = y - dy;
leave_ev.x = x - dx; leave_ev.x = x - dx;
leave_ev.y = y - dy; leave_ev.y = y - dy;
if ((_e_drag_win_matches(h, win)) && if (E_INSIDE(x, y, dx, dy, dw, dh))
(E_INSIDE(x, y, dx, dy, dw, dh)))
{ {
if (!h->entered) if (!h->entered)
{ {
@ -773,13 +778,22 @@ _e_drag_end(int x, int y)
e_grabinput_release(_drag_win, _drag_win); e_grabinput_release(_drag_win, _drag_win);
if (_drag_current->type == E_DRAG_XDND) if (_drag_current->type == E_DRAG_XDND)
{ {
e_object_del(E_OBJECT(_drag_current)); int dropped;
_drag_current = NULL;
if (!ecore_x_dnd_drop()) if (!(dropped = ecore_x_dnd_drop()))
{ {
ecore_x_window_del(_drag_win); ecore_x_window_del(_drag_win);
_drag_win = 0; _drag_win = 0;
} }
if (_drag_current->cb.finished)
_drag_current->cb.finished(_drag_current, dropped);
if (_drag_current && !_xdnd)
{
e_object_del(E_OBJECT(_drag_current));
_drag_current = NULL;
}
return; return;
} }
@ -883,9 +897,8 @@ _e_drag_xdnd_end(int x, int y)
_e_drag_coords_update(h, &dx, &dy, &dw, &dh); _e_drag_coords_update(h, &dx, &dy, &dw, &dh);
ev.x = x - dx; ev.x = x - dx;
ev.y = y - dy; ev.y = y - dy;
if ((_e_drag_win_matches(h, win)) && if (_e_drag_win_matches(h, win) && h->cb.drop
((h->cb.drop) && && E_INSIDE(x, y, dx, dy, dw, dh))
(E_INSIDE(x, y, dx, dy, dw, dh))))
{ {
h->cb.drop(h->cb.data, h->active_type, &ev); h->cb.drop(h->cb.data, h->active_type, &ev);
dropped = 1; dropped = 1;
@ -993,7 +1006,6 @@ _e_dnd_cb_event_dnd_enter(void *data, int type, void *event)
int i, j; int i, j;
ev = event; ev = event;
if (ev->source == _drag_win) return 1;
id = e_util_winid_str_get(ev->win); id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1; if (!evas_hash_find(_drop_win_hash, id)) return 1;
for (l = _drop_handlers; l; l = l->next) for (l = _drop_handlers; l; l = l->next)
@ -1066,7 +1078,6 @@ _e_dnd_cb_event_dnd_leave(void *data, int type, void *event)
ev = event; ev = event;
if (ev->source == _drag_win) return 1;
id = e_util_winid_str_get(ev->win); id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1; if (!evas_hash_find(_drop_win_hash, id)) return 1;
printf("Xdnd leave\n"); printf("Xdnd leave\n");
@ -1114,7 +1125,6 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event)
int active; int active;
ev = event; ev = event;
if (ev->source == _drag_win) return 1;
id = e_util_winid_str_get(ev->win); id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1; if (!evas_hash_find(_drop_win_hash, id)) return 1;
@ -1160,21 +1170,22 @@ _e_dnd_cb_event_dnd_finished(void *data, int type, void *event)
{ {
Ecore_X_Event_Xdnd_Finished *ev; Ecore_X_Event_Xdnd_Finished *ev;
/*
* TODO:
* - Check action
* - Do something if not completed
*/
ev = event; ev = event;
if (ev->win != _drag_win) return 1;
printf("Xdnd finished\n"); printf("Xdnd finished\n");
if (!ev->completed) if (!ev->completed)
printf("FIXME: XDnd not completed, need to delay deleting _drag_win!!\n"); return 1;
if (_drag_current)
{
e_object_del(E_OBJECT(_drag_current));
_drag_current = NULL;
}
e_grabinput_release(_drag_win, _drag_win);
ecore_x_window_del(_drag_win); ecore_x_window_del(_drag_win);
_drag_win = 0; _drag_win = 0;
return 1; return 1;
} }
@ -1185,7 +1196,6 @@ _e_dnd_cb_event_dnd_drop(void *data, int type, void *event)
const char *id; const char *id;
ev = event; ev = event;
if (ev->source == _drag_win) return 1;
id = e_util_winid_str_get(ev->win); id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1; if (!evas_hash_find(_drop_win_hash, id)) return 1;
printf("Xdnd drop\n"); printf("Xdnd drop\n");
@ -1194,6 +1204,7 @@ _e_dnd_cb_event_dnd_drop(void *data, int type, void *event)
_xdnd->x = ev->position.x; _xdnd->x = ev->position.x;
_xdnd->y = ev->position.y; _xdnd->y = ev->position.y;
return 1; return 1;
} }

View File

@ -28,6 +28,7 @@ typedef struct _E_Fm2_Finfo E_Fm2_Finfo;
typedef struct _E_Fm2_Action E_Fm2_Action; typedef struct _E_Fm2_Action E_Fm2_Action;
typedef struct _E_Fm2_Client E_Fm2_Client; typedef struct _E_Fm2_Client E_Fm2_Client;
typedef struct _E_Fm2_Mount E_Fm2_Mount; typedef struct _E_Fm2_Mount E_Fm2_Mount;
typedef struct _E_Fm2_Uri E_Fm2_Uri;
struct _E_Fm2_Smart_Data struct _E_Fm2_Smart_Data
{ {
@ -190,6 +191,12 @@ struct _E_Fm2_Mount
unsigned char delete_me : 1; unsigned char delete_me : 1;
}; };
struct _E_Fm2_Uri
{
const char *hostname;
const char *path;
};
static E_Fm2_Mount *_e_fm2_mount(E_Volume *v, void (*mount_ok) (void *data), void (*mount_fail) (void *data), void (*unmount_ok) (void *data), void (*unmount_fail) (void *data), void *data); static E_Fm2_Mount *_e_fm2_mount(E_Volume *v, void (*mount_ok) (void *data), void (*mount_fail) (void *data), void (*unmount_ok) (void *data), void (*unmount_fail) (void *data), void *data);
static void _e_fm2_unmount(E_Fm2_Mount *m); static void _e_fm2_unmount(E_Fm2_Mount *m);
static E_Volume *e_volume_find(const char *udi); static E_Volume *e_volume_find(const char *udi);
@ -3448,6 +3455,116 @@ _e_fm2_icon_find(Evas_Object *obj, const char *file)
return NULL; return NULL;
} }
/* Escape illegal caracters within an uri and return an evas_stringshare */
static const char *
_e_fm2_uri_escape(const char *path)
{
char dest[PATH_MAX * 3 + 7];
const char *p;
int i;
if (!path) return NULL;
memset(dest, 0, PATH_MAX * 3 + 7);
snprintf(dest, 8, "file://");
/* Most app doesn't handle the hostname in the uri so it's put to NULL */
for (i = 7, p = path; *p != '\0'; p++, i++)
{
if (isalnum(*p) || strchr("/$-_.+!*'()", *p))
dest[i] = *p;
else
{
char escaped[3];
snprintf(&(dest[i]), 4, "%%%02X", *p);
i += 2;
}
}
return evas_stringshare_add(dest);
}
/* Parse a single uri and return an E_Fm2_Uri struct.
* If the parsing have failed it return NULL.
* The E_Fm2_Uri may have hostname parameter and always a path.
* If there's no hostname in the uri then the hostname parameter is NULL
*/
static E_Fm2_Uri *
_e_fm2_uri_parse(const char *val)
{
E_Fm2_Uri *uri;
const char *p;
char hostname[HOST_NAME_MAX], path[PATH_MAX];
int i = 0;
/* The shortest possible path is file:///
* anything smaller than that can't be a valid uri
*/
if (strlen(val) <= 7 && strncmp(val, "file://", 7)) return NULL;
memset(path, 0, PATH_MAX);
/* An uri should be in a form file://<hostname>/<path> */
p = val + 7;
if (*p != '/')
{
for (i = 0; *p != '/' && *p != '\0' && i < HOST_NAME_MAX; p++, i++)
hostname[i] = *p;
}
hostname[i] = '\0';
/* See http://www.faqs.org/rfcs/rfc1738.html for the escaped chars */
for (p, i = 0; *p != '\0' && i < PATH_MAX; i++, p++)
{
if (*p == '%')
{
path[i] = *(++p);
path[i+1] = *(++p);
path[i] = (char)strtol(&(path[i]), NULL, 16);
path[i+1] = '\0';
}
else
path[i] = *p;
}
uri = E_NEW(E_Fm2_Uri, 1);
if (strlen(hostname) > 0) uri->hostname = evas_stringshare_add(hostname);
else uri->hostname = NULL;
uri->path = evas_stringshare_add(path);
return uri;
}
/* Takes an Evas_List of uri and return an Evas_List of real paths */
static Evas_List *
_e_fm2_uri_path_list_get(Evas_List *uri_list)
{
E_Fm2_Uri *uri;
Evas_List *l, *path_list = NULL;
char current_hostname[HOST_NAME_MAX];
if (gethostname(current_hostname, HOST_NAME_MAX) == -1)
current_hostname[0] = '\0';
for (l = uri_list; l; l = l->next)
{
if (!(uri = _e_fm2_uri_parse(l->data)))
continue;
if (!uri->hostname || !strcmp(uri->hostname, "localhost")
|| !strcmp(uri->hostname, current_hostname))
{
path_list = evas_list_append(path_list, uri->path);
}
else
evas_stringshare_del(uri->path);
if (uri->hostname) evas_stringshare_del(uri->hostname);
E_FREE(uri);
}
return path_list;
}
static Evas_List * static Evas_List *
_e_fm2_uri_icon_list_get(Evas_List *uri) _e_fm2_uri_icon_list_get(Evas_List *uri)
{ {
@ -3456,21 +3573,18 @@ _e_fm2_uri_icon_list_get(Evas_List *uri)
for (l = uri; l; l = l->next) for (l = uri; l; l = l->next)
{ {
const char *u, *path, *file; const char *path, *file;
Evas_Object *fm; Evas_Object *fm;
E_Fm2_Icon *ic; E_Fm2_Icon *ic;
u = l->data; path = l->data;
ic = NULL; ic = NULL;
if (strlen(u) > 7)
fm = _e_fm2_file_fm2_find(path);
if (fm)
{ {
path = u + 7; file = ecore_file_file_get(path);
fm = _e_fm2_file_fm2_find(path); ic = _e_fm2_icon_find(fm, file);
if (fm)
{
file = ecore_file_file_get(path);
ic = _e_fm2_icon_find(fm, file);
}
} }
icons = evas_list_append(icons, ic); icons = evas_list_append(icons, ic);
} }
@ -4738,7 +4852,7 @@ _e_fm2_cb_dnd_move(void *data, const char *type, void *event)
(!ic->sd->config->view.no_subdir_drop)) (!ic->sd->config->view.no_subdir_drop))
_e_fm2_dnd_drop_show(ic, -1); _e_fm2_dnd_drop_show(ic, -1);
else else
_e_fm2_dnd_drop_hide(sd->obj); _e_fm2_dnd_drop_all_show(sd->obj);
} }
return; return;
} }
@ -4807,8 +4921,9 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
if (!type) return; if (!type) return;
if (strcmp(type, "text/uri-list")) return; if (strcmp(type, "text/uri-list")) return;
ev = (E_Event_Dnd_Drop *)event; ev = (E_Event_Dnd_Drop *)event;
fsel = ev->data;
printf("DROP: %i %i\n", ev->x, ev->y); printf("DROP: %i %i\n", ev->x, ev->y);
fsel = _e_fm2_uri_path_list_get(ev->data);
isel = _e_fm2_uri_icon_list_get(fsel); isel = _e_fm2_uri_icon_list_get(fsel);
if (!isel) return; if (!isel) return;
for (l = fsel; l; l = l->next) for (l = fsel; l; l = l->next)
@ -4821,7 +4936,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (l = isel; l; l = l->next) for (l = isel; l; l = l->next)
{ {
ic = l->data; ic = l->data;
if (ic->drag.src) if (ic && ic->drag.src)
{ {
ox = ic->x; ox = ic->x;
oy = ic->y; oy = ic->y;
@ -4835,6 +4950,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
break; break;
} }
} }
/* note - logic. /* note - logic.
* if drop file prefix path matches extra_file_source then it can be * if drop file prefix path matches extra_file_source then it can be
* and indirect link - dont MOVE the file just add filename to list. * and indirect link - dont MOVE the file just add filename to list.
@ -4849,7 +4965,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next) for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{ {
ic = il->data; ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data); fp = ll->data;
if (!fp) continue; if (!fp) continue;
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
sd->realpath, ecore_file_file_get(fp)); sd->realpath, ecore_file_file_get(fp));
@ -4906,7 +5022,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next) for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{ {
ic = il->data; ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data); fp = ll->data;
if (!fp) continue; if (!fp) continue;
/* move the file into the subdir */ /* move the file into the subdir */
snprintf(buf, sizeof(buf), "%s/%s/%s", snprintf(buf, sizeof(buf), "%s/%s/%s",
@ -4927,7 +5043,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next) for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{ {
ic = il->data; ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data); fp = ll->data;
if (!fp) continue; if (!fp) continue;
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
sd->realpath, ecore_file_file_get(fp)); sd->realpath, ecore_file_file_get(fp));
@ -4949,7 +5065,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next) for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{ {
ic = il->data; ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data); fp = ll->data;
if (!fp) continue; if (!fp) continue;
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
sd->realpath, ecore_file_file_get(fp)); sd->realpath, ecore_file_file_get(fp));
@ -4972,7 +5088,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next) for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{ {
ic = il->data; ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data); fp = ll->data;
if (!fp) continue; if (!fp) continue;
/* move the file into the subdir */ /* move the file into the subdir */
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
@ -4988,7 +5104,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next) for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{ {
ic = il->data; ic = il->data;
fp = _e_fm2_icon_desktop_url_eval(ll->data); fp = ll->data;
if (!fp) continue; if (!fp) continue;
/* move the file into the subdir */ /* move the file into the subdir */
snprintf(buf, sizeof(buf), "%s/%s", snprintf(buf, sizeof(buf), "%s/%s",
@ -5000,6 +5116,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
} }
} }
} }
_e_fm2_dnd_drop_hide(sd->obj); _e_fm2_dnd_drop_hide(sd->obj);
_e_fm2_dnd_drop_all_hide(sd->obj); _e_fm2_dnd_drop_all_hide(sd->obj);
_e_fm2_list_walking++; _e_fm2_list_walking++;
@ -5018,6 +5135,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
_e_fm2_list_remove = evas_list_remove_list(_e_fm2_list_remove, _e_fm2_list_remove); _e_fm2_list_remove = evas_list_remove_list(_e_fm2_list_remove, _e_fm2_list_remove);
} }
} }
evas_list_free(fsel);
evas_list_free(isel); evas_list_free(isel);
} }
@ -5222,16 +5340,44 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
static void static void
_e_fm2_cb_drag_finished(E_Drag *drag, int dropped) _e_fm2_cb_drag_finished(E_Drag *drag, int dropped)
{ {
Evas_List *fsel; E_Fm2_Uri *uri;
char *f; const char *p;
char buf[PATH_MAX * 3 + 7];
Evas_Object *fm;
int i;
fsel = drag->data; memset(buf, 0, sizeof(buf));
while (fsel) for (p = drag->data, i = 0; p && *p != '\0'; p++, i++)
{ {
f = fsel->data; if (*p == '\r')
free(f); {
fsel = evas_list_remove_list(fsel, fsel); p++;
i = -1;
uri = _e_fm2_uri_parse(buf);
memset(buf, 0, sizeof(buf));
if (!uri) continue;
fm = _e_fm2_file_fm2_find(uri->path);
if (fm)
{
const char *file;
E_Fm2_Icon *ic;
file = ecore_file_file_get(uri->path);
ic = _e_fm2_icon_find(fm, file);
ic->drag.dnd = 0;
if (ic->obj) evas_object_show(ic->obj);
if (ic->obj_icon) evas_object_show(ic->obj_icon);
}
if (uri->hostname) evas_stringshare_del(uri->hostname);
evas_stringshare_del(uri->path);
E_FREE(uri);
}
else
buf[i] = *p;
} }
free(drag->data);
} }
static void static void
@ -5256,10 +5402,10 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
Evas_Object *o, *o2; Evas_Object *o, *o2;
Evas_Coord x, y, w, h; Evas_Coord x, y, w, h;
const char *drag_types[] = { "text/uri-list" }, *realpath; const char *drag_types[] = { "text/uri-list" }, *realpath;
char buf[4096]; char buf[PATH_MAX + 8], *sel = NULL;
E_Container *con = NULL; E_Container *con = NULL;
Evas_List *l, *sl, *fsel = NULL; Evas_List *l, *sl, *fsel = NULL;
int i; int i, sel_length = 0;
switch (ic->sd->eobj->type) switch (ic->sd->eobj->type)
{ {
@ -5293,21 +5439,39 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
sl = e_fm2_selected_list_get(ic->sd->obj); sl = e_fm2_selected_list_get(ic->sd->obj);
for (l = sl, i = 0; l; l = l->next, i++) for (l = sl, i = 0; l; l = l->next, i++)
{ {
const char *s;
ici = l->data; ici = l->data;
/* file:///path is correct: file://<host>/<path> with null <host> */ snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
if (!strcmp(realpath, "/"))
snprintf(buf, sizeof(buf), "file:///%s", ici->file); s = _e_fm2_uri_escape(buf);
if (!s) continue;
if (sel_length == 0)
{
sel_length = strlen(s) + 2;
sel = malloc(sel_length + 1);
if (!sel) break;
sel[0] = '\0';
}
else else
snprintf(buf, sizeof(buf), "file://%s/%s", realpath, ici->file); {
fsel = evas_list_append(fsel, strdup(buf)); sel_length += strlen(s) + 2;
sel = realloc(sel, sel_length+1);
if (!sel) break;
}
sel = strcat(sel, s);
sel = strcat(sel, "\r\n");
evas_stringshare_del(s);
ici->ic->drag.dnd = 1; ici->ic->drag.dnd = 1;
if (ici->ic->obj) evas_object_hide(ici->ic->obj); if (ici->ic->obj) evas_object_hide(ici->ic->obj);
if (ici->ic->obj_icon) evas_object_hide(ici->ic->obj_icon); if (ici->ic->obj_icon) evas_object_hide(ici->ic->obj_icon);
} }
evas_list_free(sl); evas_list_free(sl);
if (!sel) return;
d = e_drag_new(con, d = e_drag_new(con,
x, y, drag_types, 1, x, y, drag_types, 1,
fsel, -1, NULL, _e_fm2_cb_drag_finished); sel, strlen(sel), NULL, _e_fm2_cb_drag_finished);
o = edje_object_add(e_drag_evas_get(d)); o = edje_object_add(e_drag_evas_get(d));
if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST) if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
{ {
@ -5353,9 +5517,10 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf
edje_object_signal_emit(o2, "e,state,selected", "e"); edje_object_signal_emit(o2, "e,state,selected", "e");
e_drag_object_set(d, o); e_drag_object_set(d, o);
e_drag_resize(d, w, h); e_drag_resize(d, w, h);
e_drag_start(d,
ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x, e_drag_xdnd_start(d,
ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y); ic->drag.x + ic->x + ic->sd->x - ic->sd->pos.x,
ic->drag.y + ic->y + ic->sd->y - ic->sd->pos.y);
e_util_evas_fake_mouse_up_later(evas_object_evas_get(ic->sd->obj), e_util_evas_fake_mouse_up_later(evas_object_evas_get(ic->sd->obj),
1); 1);
} }

View File

@ -178,6 +178,8 @@ e_fwin_zone_new(E_Zone *zone, const char *dev, const char *path)
evas_object_show(o); evas_object_show(o);
o = e_scrollframe_add(zone->container->bg_evas); o = e_scrollframe_add(zone->container->bg_evas);
ecore_x_icccm_state_set(zone->container->bg_win, ECORE_X_WINDOW_STATE_HINT_NORMAL);
e_drop_xdnd_register_set(zone->container->bg_win, 1);
e_scrollframe_custom_theme_set(o, "base/theme/fileman", e_scrollframe_custom_theme_set(o, "base/theme/fileman",
"e/fileman/desktop/scrollframe"); "e/fileman/desktop/scrollframe");
/* FIXME: this theme object will have more versions and options later /* FIXME: this theme object will have more versions and options later
@ -392,6 +394,8 @@ _e_fwin_new(E_Container *con, const char *dev, const char *path)
e_win_size_min_set(fwin->win, 24, 24); e_win_size_min_set(fwin->win, 24, 24);
e_win_resize(fwin->win, 280, 200); e_win_resize(fwin->win, 280, 200);
e_win_show(fwin->win); e_win_show(fwin->win);
if (fwin->win->evas_win)
e_drop_xdnd_register_set(fwin->win->evas_win, 1);
if (fwin->win->border) if (fwin->win->border)
{ {
if (fwin->win->border->internal_icon) if (fwin->win->border->internal_icon)