diff --git a/src/modules/everything/e_mod_main.h b/src/modules/everything/e_mod_main.h index c1721c279..331ce2d63 100644 --- a/src/modules/everything/e_mod_main.h +++ b/src/modules/everything/e_mod_main.h @@ -37,7 +37,8 @@ struct _Evry_Window int level; - int down_out; + int mouse_out; + int mouse_button; }; struct _Evry_Selector diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 31b03a655..46be2eed5 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -801,6 +801,12 @@ _evry_window_new(E_Zone *zone) return win; } +static void +_evry_cb_drag_finished(E_Drag *drag, int dropped) +{ + E_FREE(drag->data); +} + static int _evry_cb_mouse(void *data, int type, void *event) { @@ -815,6 +821,44 @@ _evry_cb_mouse(void *data, int type, void *event) if (type == ECORE_EVENT_MOUSE_MOVE) { Ecore_Event_Mouse_Move *ev = event; + Evry_State *s; + + if ((win->mouse_button == 3) && + (s = win->selector->state) && (s->cur_item) && + (CHECK_TYPE(s->cur_item, EVRY_TYPE_FILE)) && + (!E_INSIDE(ev->x, ev->y, pop->x + pop->zone->x, + pop->y + pop->zone->y, pop->w, pop->h))) + { + const char *drag_types[] = { "text/uri-list" }; + E_Drag *d; + Evas_Object *o; + const char *uri; + int s_len, sel_length = 0; + char *tmp, *sel = NULL; + + GET_FILE(file, s->cur_item); + + if (!(uri = evry_file_url_get(file))) + return 1; + + s_len = strlen(uri); + if (!(tmp = realloc(sel, sel_length + s_len + 2 + 1))) + return 1; + sel = tmp; + memcpy(sel + sel_length, uri, s_len); + memcpy(sel + sel_length + s_len, "\r\n", 2); + sel_length += s_len + 2; + + d = e_drag_new(e_container_current_get(e_manager_current_get()), + ev->x, ev->y, drag_types, 1, sel, sel_length, NULL, _evry_cb_drag_finished); + e_drag_resize(d, 128, 128); + o = evry_util_icon_get(s->cur_item, e_drag_evas_get(d)); + e_drag_object_set(d, o); + e_drag_xdnd_start(d, ev->x, ev->y); + + evry_hide(0); + return 1; + } evas_event_feed_mouse_move (pop->evas, @@ -824,16 +868,18 @@ _evry_cb_mouse(void *data, int type, void *event) } else if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN) { - win->down_out = 0; + win->mouse_out = 0; /* XXX shift triple click in flags when needed */ if (!E_INSIDE(ev->x, ev->y, pop->x + pop->zone->x, pop->y + pop->zone->y, pop->w, pop->h)) { - win->down_out = 1; + win->mouse_out = 1; return 1; } + win->mouse_button = ev->buttons; + evas_event_feed_mouse_down (pop->evas, ev->buttons, ev->double_click, @@ -841,7 +887,9 @@ _evry_cb_mouse(void *data, int type, void *event) } else if (type == ECORE_EVENT_MOUSE_BUTTON_UP) { - if (win->down_out && + win->mouse_button = 0; + + if (win->mouse_out && !E_INSIDE(ev->x, ev->y, pop->x + pop->zone->x, pop->y + pop->zone->y, pop->w, pop->h)) { @@ -1091,7 +1139,7 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) { Evas_Coord w, h; char *suffix = NULL; - + if (sel->do_thumb) e_thumb_icon_end(sel->o_thumb); @@ -1108,7 +1156,7 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) if (!(evry_file_path_get(file))) return 0; - + if ((!strncmp(file->mime, "image/", 6)) || ((suffix = strrchr(file->path, '.')) && (!strncmp(suffix, ".edj", 4)))) { @@ -1126,7 +1174,7 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) sel->do_thumb = EINA_TRUE; return 1; } - + return 0; } diff --git a/src/modules/everything/evry_plug_view_thumb.c b/src/modules/everything/evry_plug_view_thumb.c index f6b29cf46..805fd1d3c 100644 --- a/src/modules/everything/evry_plug_view_thumb.c +++ b/src/modules/everything/evry_plug_view_thumb.c @@ -60,6 +60,7 @@ struct _Smart_Data int mouse_act; int mouse_x; int mouse_y; + int mouse_button; Item *it_down; }; @@ -113,7 +114,7 @@ static int _check_item(const Evry_Item *it) { char *suffix; - + GET_FILE(file, it); if (!evry_file_path_get(file) || !file->mime) return 0; @@ -135,7 +136,7 @@ _thumb_idler(void *data) Eina_List *l, *ll; Item *it; char *suffix; - + if (!sd || sd->clearing) return 1; @@ -197,24 +198,22 @@ _item_down(void *data, Evas *e, Evas_Object *obj, void *event_info) sd->mouse_act = 1; sd->it_down = it; + sd->mouse_button = ev->button; - if (ev->button == 1) + if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)) { - if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - { - evry_item_select(sd->view->state, it->item); - _pan_item_select(it->obj, it, 0); + evry_item_select(sd->view->state, it->item); + _pan_item_select(it->obj, it, 0); - evry_plugin_action(1); - } - else - { - sd->mouse_x = ev->canvas.x; - sd->mouse_y = ev->canvas.y; + evry_plugin_action(1); + } + else + { + sd->mouse_x = ev->canvas.x; + sd->mouse_y = ev->canvas.y; - if (sd->selector && evas_object_visible_get(sd->selector)) - evas_object_hide(sd->selector); - } + if (sd->selector && evas_object_visible_get(sd->selector)) + evas_object_hide(sd->selector); } } @@ -1555,14 +1554,14 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) if (diff_y > (diff_x + 10) * 2) goto end; - if ((sd->cur_item != sd->it_down) && - (diff_x > 10)) + if ((sd->cur_item != sd->it_down) && (diff_x > 10)) { evry_item_select(sd->view->state, sd->it_down->item); _pan_item_select(obj, sd->it_down, 0); } - if (sd->cur_item == sd->it_down) + if ((sd->mouse_button == 1) && + (sd->cur_item == sd->it_down)) { if (ev->cur.canvas.x - sd->mouse_x > 150) { @@ -1578,7 +1577,7 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info) sd->mouse_y = 0; evry_browse_item(NULL); } - } + } return; end: