forked from enlightenment/enlightenment
allow files to be dragged out of everything. bound to right button atm.
SVN revision: 48972
This commit is contained in:
parent
8b9b020c21
commit
7c2df0efc6
|
@ -37,7 +37,8 @@ struct _Evry_Window
|
|||
|
||||
int level;
|
||||
|
||||
int down_out;
|
||||
int mouse_out;
|
||||
int mouse_button;
|
||||
};
|
||||
|
||||
struct _Evry_Selector
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ struct _Smart_Data
|
|||
int mouse_act;
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_button;
|
||||
Item *it_down;
|
||||
};
|
||||
|
||||
|
@ -197,10 +198,9 @@ _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->flags & EVAS_BUTTON_DOUBLE_CLICK)
|
||||
if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK))
|
||||
{
|
||||
evry_item_select(sd->view->state, it->item);
|
||||
_pan_item_select(it->obj, it, 0);
|
||||
|
@ -215,7 +215,6 @@ _item_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
if (sd->selector && evas_object_visible_get(sd->selector))
|
||||
evas_object_hide(sd->selector);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue