diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 8b9fed1d3..c3cbbec54 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -500,6 +500,18 @@ e_fm2_underlay_hide(Evas_Object *obj) evas_object_hide(sd->underlay); } +EAPI void +e_fm2_all_unsel(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + _e_fm2_icon_desel_any(obj); +} + EAPI void e_fm2_custom_theme_set(Evas_Object *obj, const char *path) { @@ -3723,7 +3735,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) Evas_List *fsel, *l, *ll, *il, *isel; char buf[4096], *fl; const char *fp; - Evas_Coord dx, dy; + Evas_Coord dx, dy, ox, oy, x, y; int adjust_icons = 0; sd = data; @@ -3740,14 +3752,21 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) printf(" %s\n", fl); } dx = 0; dy = 0; + ox = 0; oy = 0; for (l = isel; l; l = l->next) { ic = l->data; if (ic->drag.src) { - dx = ev->x - ic->drag.x - ic->x + ic->sd->pos.x; - dy = ev->y - ic->drag.y - ic->y + ic->sd->pos.y; - printf("DND offset %i %i\n", dx, dy); + ox = ic->x; + oy = ic->y; + dx = (ic->drag.x + ic->x - ic->sd->pos.x); + dy = (ic->drag.y + ic->y - ic->sd->pos.y); + printf("DND offset %i %i | %i %i | %i %i | %i %i\n", + dx, dy, + ic->drag.x, ic->drag.y, + ic->x, ic->y, + ic->sd->pos.x, ic->sd->pos.y); break; } } @@ -3775,17 +3794,23 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) /* dnd doesnt tell me all the co-ords of the icons being dragged so i can't place them accurately. * need to fix this. ev->data probably needs to become more compelx than a list of url's */ - _e_fm2_client_file_move(sd->id, fp, buf, "", 0, ic->x + dx, ic->y + dy); + x = ev->x + (ic->x - ox) - ic->drag.x + sd->pos.x; + y = ev->y + (ic->y - oy) - ic->drag.y + sd->pos.y;//ic->y - oy - dy + ev->y + sd->pos.y; + if (x < 0) x = 0; + if (y < 0) y = 0; + _e_fm2_client_file_move(sd->id, fp, buf, "", 0, x, y); if (ic->sd == sd) { - ic->x += dx; - ic->y += dy; + ic->x = x; + ic->y = y; ic->saved_pos = 1; adjust_icons = 1; } } else - _e_fm2_client_file_move(sd->id, fp, buf, "", 0, -9999, -9999); + { + _e_fm2_client_file_move(sd->id, fp, buf, "", 0, -9999, -9999); + } evas_stringshare_del(fp); } if (adjust_icons) @@ -3899,15 +3924,7 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event) snprintf(buf, sizeof(buf), "%s/%s", sd->realpath, ecore_file_get_file(fp)); printf("mv %s %s\n", (char *)fp, buf); - if ((ic) && (sd->config->view.mode == E_FM2_VIEW_MODE_CUSTOM_ICONS)) - { - /* dnd doesnt tell me all the co-ords of the icons being dragged so i can't place them accurately. - * need to fix this. ev->data probably needs to become more compelx than a list of url's - */ - _e_fm2_client_file_move(sd->id, fp, buf, "", 0, ic->x + dx, ic->y + dy); - } - else - _e_fm2_client_file_move(sd->id, fp, buf, "", 0, ev->x, ev->y); + _e_fm2_client_file_move(sd->id, fp, buf, "", 0, -9999, -9999); evas_stringshare_del(fp); } } diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index 27f6cf054..5af004611 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -136,6 +136,7 @@ EAPI void e_fm2_path_set(Evas_Object *obj, const char *dev, con EAPI void e_fm2_custom_theme_set(Evas_Object *obj, const char *path); EAPI void e_fm2_underlay_show(Evas_Object *obj); EAPI void e_fm2_underlay_hide(Evas_Object *obj); +EAPI void e_fm2_all_unsel(Evas_Object *obj); EAPI void e_fm2_path_get(Evas_Object *obj, const char **dev, const char **path); EAPI void e_fm2_refresh(Evas_Object *obj); EAPI const char *e_fm2_real_path_get(Evas_Object *obj); diff --git a/src/bin/e_fwin.c b/src/bin/e_fwin.c index 686ac7573..e8605cf04 100644 --- a/src/bin/e_fwin.c +++ b/src/bin/e_fwin.c @@ -31,6 +31,7 @@ static void _e_fwin_deleted(void *data, Evas_Object *obj, void *event_info); static const char *_e_fwin_custom_file_path_eval(E_Fwin *fwin, Efreet_Desktop *ef, const char *prev_path, const char *key); static void _e_fwin_changed(void *data, Evas_Object *obj, void *event_info); static void _e_fwin_selected(void *data, Evas_Object *obj, void *event_info); +static void _e_fwin_selection_change(void *data, Evas_Object *obj, void *event_info); static void _e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info); static void _e_fwin_parent(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_fwin_cb_menu_extend_start(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info); @@ -145,6 +146,8 @@ e_fwin_new(E_Container *con, const char *dev, const char *path) _e_fwin_deleted, fwin); evas_object_smart_callback_add(o, "selected", _e_fwin_selected, fwin); + evas_object_smart_callback_add(o, "selection_change", + _e_fwin_selection_change, fwin); e_fm2_icon_menu_start_extend_callback_set(o, _e_fwin_cb_menu_extend_start, fwin); e_fm2_icon_menu_end_extend_callback_set(o, _e_fwin_menu_extend, fwin); evas_object_show(o); @@ -267,6 +270,8 @@ e_fwin_zone_new(E_Zone *zone, const char *dev, const char *path) _e_fwin_deleted, fwin); evas_object_smart_callback_add(o, "selected", _e_fwin_selected, fwin); + evas_object_smart_callback_add(o, "selection_change", + _e_fwin_selection_change, fwin); e_fm2_icon_menu_start_extend_callback_set(o, _e_fwin_cb_menu_extend_start, fwin); e_fm2_icon_menu_end_extend_callback_set(o, _e_fwin_menu_extend, fwin); e_fm2_underlay_hide(o); @@ -338,6 +343,14 @@ e_fwin_zone_new(E_Zone *zone, const char *dev, const char *path) return fwin; } +EAPI void +e_fwin_all_unsel(E_Fwin *fwin) +{ + E_OBJECT_CHECK(fwin); + E_OBJECT_TYPE_CHECK(fwin, E_FWIN_TYPE); + e_fm2_all_unsel(fwin->fm_obj); +} + /* local subsystem functions */ static void _e_fwin_free(E_Fwin *fwin) @@ -489,6 +502,20 @@ _e_fwin_selected(void *data, Evas_Object *obj, void *event_info) evas_list_free(selected); } +static void +_e_fwin_selection_change(void *data, Evas_Object *obj, void *event_info) +{ + Evas_List *l; + E_Fwin *fwin; + + fwin = data; + for (l = fwins; l; l = l->next) + { + if (l->data != fwin) + e_fwin_all_unsel(l->data); + } +} + static void _e_fwin_menu_extend(void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info) { diff --git a/src/bin/e_fwin.h b/src/bin/e_fwin.h index f28237989..914fd103e 100644 --- a/src/bin/e_fwin.h +++ b/src/bin/e_fwin.h @@ -47,6 +47,7 @@ EAPI int e_fwin_init (void); EAPI int e_fwin_shutdown (void); EAPI E_Fwin *e_fwin_new (E_Container *con, const char *dev, const char *path); EAPI E_Fwin *e_fwin_zone_new (E_Zone *zone, const char *dev, const char *path); - +EAPI void e_fwin_all_unsel (E_Fwin *fwin); + #endif #endif diff --git a/src/bin/e_zone.c b/src/bin/e_zone.c index 936e4319c..ceb5be7a8 100644 --- a/src/bin/e_zone.c +++ b/src/bin/e_zone.c @@ -672,6 +672,8 @@ _e_zone_cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_i zone = data; if (e_menu_grab_window_get()) return; + if (zone->bg_fwin) e_fwin_all_unsel(zone->bg_fwin); + if (!zone->cur_mouse_action) { if (ecore_event_current_type_get() == ECORE_X_EVENT_MOUSE_BUTTON_DOWN)