forked from enlightenment/enlightenment
Possible with more types for a drag. Doesn't make sense for internal dnd,
since we don't have a conversion function. Prepare for xdnd. Declare variables. SVN revision: 17276
This commit is contained in:
parent
56fa60810b
commit
e85dd8ade4
|
@ -4093,11 +4093,12 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
|
|||
Evas_Object *o = NULL;
|
||||
Evas_Coord x, y, w, h;
|
||||
const char *file = NULL, *part = NULL;
|
||||
const char *drag_types[] = { "enlightenment/border" };
|
||||
|
||||
evas_object_geometry_get(bd->icon_object,
|
||||
&x, &y, &w, &h);
|
||||
drag = e_drag_new(bd->zone->container, bd->x + x, bd->y + y,
|
||||
"enlightenment/border", bd, NULL);
|
||||
drag_types, 1, bd, -1, NULL);
|
||||
edje_object_file_get(bd->icon_object, &file, &part);
|
||||
if ((file) && (part))
|
||||
{
|
||||
|
|
|
@ -136,11 +136,15 @@ e_dnd_shutdown(void)
|
|||
|
||||
E_Drag*
|
||||
e_drag_new(E_Container *container, int x, int y,
|
||||
const char *type, void *data,
|
||||
const char **types, unsigned int num_types,
|
||||
void *data, int size,
|
||||
void (*finished_cb)(E_Drag *drag, int dropped))
|
||||
{
|
||||
E_Drag *drag;
|
||||
int i;
|
||||
|
||||
/* No need to create a drag object without type */
|
||||
if (!num_types) return NULL;
|
||||
drag = E_OBJECT_ALLOC(E_Drag, E_DRAG_TYPE, _e_drag_free);
|
||||
if (!drag) return NULL;
|
||||
|
||||
|
@ -175,8 +179,12 @@ e_drag_new(E_Container *container, int x, int y,
|
|||
evas_object_resize(drag->object, drag->w, drag->h);
|
||||
ecore_evas_resize(drag->ecore_evas, drag->w, drag->h);
|
||||
|
||||
drag->type = strdup(type);
|
||||
drag->types = malloc(num_types * sizeof(char *));
|
||||
for (i = 0; i < num_types; i++)
|
||||
drag->types[i] = strdup(types[i]);
|
||||
drag->num_types = num_types;
|
||||
drag->data = data;
|
||||
drag->data_size = size;
|
||||
drag->cb.finished = finished_cb;
|
||||
|
||||
_drag_list = evas_list_append(_drag_list, drag);
|
||||
|
@ -274,7 +282,7 @@ e_drag_start(E_Drag *drag, int x, int y)
|
|||
h->active = 0;
|
||||
for (i = 0; i < h->num_types; i++)
|
||||
{
|
||||
if (!strcmp(h->types[i], drag->type))
|
||||
if (!strcmp(h->types[i], drag->types[0]))
|
||||
h->active = 1;
|
||||
}
|
||||
h->entered = 0;
|
||||
|
@ -323,18 +331,18 @@ e_drag_update(int x, int y)
|
|||
if (!h->entered)
|
||||
{
|
||||
if (h->cb.enter)
|
||||
h->cb.enter(h->cb.data, _drag_current->type, enter_ev);
|
||||
h->cb.enter(h->cb.data, _drag_current->types[0], enter_ev);
|
||||
h->entered = 1;
|
||||
}
|
||||
if (h->cb.move)
|
||||
h->cb.move(h->cb.data, _drag_current->type, move_ev);
|
||||
h->cb.move(h->cb.data, _drag_current->types[0], move_ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (h->entered)
|
||||
{
|
||||
if (h->cb.leave)
|
||||
h->cb.leave(h->cb.data, _drag_current->type, leave_ev);
|
||||
h->cb.leave(h->cb.data, _drag_current->types[0], leave_ev);
|
||||
h->entered = 0;
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +374,7 @@ e_drag_end(int x, int y)
|
|||
if (_drag_current)
|
||||
{
|
||||
ev->data = _drag_current->data;
|
||||
type = _drag_current->type;
|
||||
type = _drag_current->types[0];
|
||||
}
|
||||
else if (_xdnd)
|
||||
{
|
||||
|
@ -565,6 +573,8 @@ e_drag_idler_before(void)
|
|||
static void
|
||||
_e_drag_free(E_Drag *drag)
|
||||
{
|
||||
int i;
|
||||
|
||||
_drag_list = evas_list_remove(_drag_list, drag);
|
||||
|
||||
E_FREE(drag->shape_rects);
|
||||
|
@ -575,7 +585,9 @@ _e_drag_free(E_Drag *drag)
|
|||
evas_object_del(drag->object);
|
||||
e_canvas_del(drag->ecore_evas);
|
||||
ecore_evas_free(drag->ecore_evas);
|
||||
free(drag->type);
|
||||
for (i = 0; i < drag->num_types; i++)
|
||||
free(drag->types[i]);
|
||||
free(drag->types);
|
||||
free(drag);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,10 @@ struct _E_Drag
|
|||
{
|
||||
E_Object e_obj_inherit;
|
||||
|
||||
char *type;
|
||||
char **types;
|
||||
unsigned int num_types;
|
||||
void *data;
|
||||
int data_size;
|
||||
|
||||
struct {
|
||||
void (*finished)(E_Drag *drag, int dropped);
|
||||
|
@ -91,7 +93,9 @@ EAPI int e_dnd_shutdown(void);
|
|||
EAPI int e_dnd_active(void);
|
||||
|
||||
/* x and y are the top left coords of the object that is to be dragged */
|
||||
EAPI E_Drag *e_drag_new(E_Container *container, int x, int y, const char *type, void *data,
|
||||
EAPI E_Drag *e_drag_new(E_Container *container, int x, int y,
|
||||
const char **types, unsigned int num_types,
|
||||
void *data, int size,
|
||||
void (*finished_cb)(E_Drag *drag, int dropped));
|
||||
EAPI Evas *e_drag_evas_get(E_Drag *drag);
|
||||
EAPI void e_drag_object_set(E_Drag *drag, Evas_Object *object);
|
||||
|
|
|
@ -1345,14 +1345,15 @@ _ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info
|
|||
E_Drag *d;
|
||||
Evas_Object *o;
|
||||
Evas_Coord x, y, w, h;
|
||||
const char *drag_types[] = { "enlightenment/eapp" };
|
||||
|
||||
drag = 1;
|
||||
drag_start = 0;
|
||||
|
||||
evas_object_geometry_get(ic->icon_object,
|
||||
&x, &y, &w, &h);
|
||||
d = e_drag_new(ic->ibb->con, x, y, "enlightenment/eapp",
|
||||
ic->app, _ibar_bar_cb_finished);
|
||||
d = e_drag_new(ic->ibb->con, x, y, drag_types, 1,
|
||||
ic->app, -1, _ibar_bar_cb_finished);
|
||||
o = edje_object_add(e_drag_evas_get(d));
|
||||
edje_object_file_set(o, ic->app->path, "icon");
|
||||
e_drag_object_set(d, o);
|
||||
|
|
|
@ -2005,14 +2005,14 @@ _pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_i
|
|||
Evas_Object *o, *oo;
|
||||
Evas_Coord x, y, w, h;
|
||||
const char *file, *part;
|
||||
const char *drag_types[] = { "enlightenment/pager_win" };
|
||||
|
||||
evas_object_geometry_get(pw->window_object,
|
||||
&x, &y, &w, &h);
|
||||
|
||||
drag = e_drag_new(pw->desk->face->zone->container,
|
||||
x,
|
||||
y, "enlightenment/pager_win",
|
||||
pw, _pager_window_cb_drag_finished);
|
||||
drag = e_drag_new(pw->desk->face->zone->container, x, y,
|
||||
drag_types, 1, pw, -1,
|
||||
_pager_window_cb_drag_finished);
|
||||
|
||||
o = edje_object_add(drag->evas);
|
||||
edje_object_file_get(pw->window_object, &file, &part);
|
||||
|
|
Loading…
Reference in New Issue