aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
authorsebastid <sebastid>2005-10-07 18:36:54 +0000
committersebastid <sebastid@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2005-10-07 18:36:54 +0000
commite85dd8ade40a485e788948a79671519e0547ceae (patch)
treeee3d2708cbba69e85dab82c7463899cd200c57f5 /src/bin
parent56fa60810beea1e4fe47e1ff5ca7c64411eda6f4 (diff)
downloadenlightenment-e85dd8ade40a485e788948a79671519e0547ceae.tar.gz
enlightenment-e85dd8ade40a485e788948a79671519e0547ceae.tar.xz
enlightenment-e85dd8ade40a485e788948a79671519e0547ceae.zip
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
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/e_border.c3
-rw-r--r--src/bin/e_dnd.c28
-rw-r--r--src/bin/e_dnd.h10
3 files changed, 29 insertions, 12 deletions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index 6ca719e7b..ae3a67d97 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -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))
{
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index f65ad484b..40b62e601 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -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);
}
diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h
index 30056c71d..232ae553f 100644
--- a/src/bin/e_dnd.h
+++ b/src/bin/e_dnd.h
@@ -21,8 +21,10 @@ struct _E_Drag
{
E_Object e_obj_inherit;
- char *type;
- void *data;
+ 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);