From 2d9bdc762d9601a348109fa33f66ca7c82da6316 Mon Sep 17 00:00:00 2001 From: sebastid Date: Sun, 1 May 2005 18:34:56 +0000 Subject: [PATCH] Add move callback SVN revision: 14533 --- src/bin/e.h | 1 + src/bin/e_dnd.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/bin/e.h b/src/bin/e.h index 62dbbff93..5c0fa7d56 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -61,6 +61,7 @@ typedef struct _E_Rect E_Rect; /* convenience macro to compress code and avoid typos */ #define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; } #define E_INTERSECTS(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy))) +#define E_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy))) #define E_SPANS_COMMON(x1, w1, x2, w2) (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) #define E_REALLOC(p, s, n) p = realloc(p, sizeof(s) * n) #define E_NEW(s, n) calloc(n, sizeof(s)) diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index ba18f0db4..18d5a841c 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -154,6 +154,8 @@ e_drag_start(E_Container *con, const char *type, void *data, void e_drag_update(int x, int y) { + Evas_List *l; + E_Move_Event *ev; int w, h; if (!drag_ee) return; @@ -168,6 +170,31 @@ e_drag_update(int x, int y) evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h); ecore_evas_move(drag_ee, x - (w / 2), y - (h / 2)); + + ev = E_NEW(E_Move_Event, 1); + if (!ev) goto end; + ev->x = x; + ev->y = y; + + for (l = drop_handlers; l; l = l->next) + { + E_Drop_Handler *h; + + h = l->data; + + if (!h->active) + continue; + + if ((h->cb.move) + && E_INSIDE(x, y, h->x, h->y, h->w, h->h)) + { + h->cb.move(h->data, drag_type, ev); + } + } + + free(ev); +end: + return; } void