From 42aae70082e283578bd2c3b6a259310ddb18e204 Mon Sep 17 00:00:00 2001 From: sebastid Date: Mon, 25 Apr 2005 18:02:26 +0000 Subject: [PATCH] DND work. SVN revision: 14357 --- src/bin/e_border.c | 3 +-- src/bin/e_dnd.c | 9 ++++++++- src/bin/e_dnd.h | 9 ++++++++- src/modules/pager/e_mod_main.c | 16 ++++++++++++++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/bin/e_border.c b/src/bin/e_border.c index b4fbe3a15..176b71301 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -1964,6 +1964,7 @@ _e_border_cb_signal_drag(void *data, Evas_Object *obj, const char *emission, con { e_drag_start(bd->zone, "enlightenment/border", bd, a->path, "icon"); + e_util_container_fake_mouse_up_later(bd->zone->container, 1); } } } @@ -2744,10 +2745,8 @@ _e_border_eval(E_Border *bd) _e_border_cb_signal_resize_stop, bd); edje_object_signal_callback_add(o, "action", "*", _e_border_cb_signal_action, bd); -#if 0 edje_object_signal_callback_add(o, "drag", "*", _e_border_cb_signal_drag, bd); -#endif if (bd->focused) edje_object_signal_emit(bd->bg_object, "active", ""); evas_object_move(o, 0, 0); diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index a35717753..f4f63aa16 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -132,6 +132,7 @@ void e_drag_end(int x, int y) { Evas_List *l; + E_Drop_Event *e; printf("drag_end\n"); @@ -146,6 +147,11 @@ e_drag_end(int x, int y) ecore_x_keyboard_ungrab(); ecore_x_window_del(drag_win); + e = E_NEW(E_Drop_Event, 1); + e->data = drag_data; + e->x = x; + e->y = y; + for (l = drop_handlers; l; l = l->next) { E_Drop_Handler *h; @@ -155,10 +161,11 @@ e_drag_end(int x, int y) if ((x >= h->x) && (x < h->x + h->w) && (y >= h->y) && (y < h->y + h->h) && (!strcmp(h->type, drag_type))) { - h->func(h->data, drag_type, drag_data); + h->func(h->data, drag_type, e); } } + free(e); free(drag_type); drag_type = NULL; drag_data = NULL; diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h index 6c521d183..86ec651ad 100644 --- a/src/bin/e_dnd.h +++ b/src/bin/e_dnd.h @@ -5,6 +5,7 @@ #ifdef E_TYPEDEFS typedef struct _E_Drop_Handler E_Drop_Handler; +typedef struct _E_Drop_Event E_Drop_Event; #else #ifndef E_DND_H @@ -18,6 +19,12 @@ struct _E_Drop_Handler int x, y, w, h; }; +struct _E_Drop_Event +{ + void *data; + int x, y; +}; + EAPI int e_dnd_init(void); EAPI int e_dnd_shutdown(void); @@ -25,7 +32,7 @@ EAPI void e_drag_start(E_Zone *zone, const char *type, void *data, const char *i EAPI void e_drag_update(int x, int y); EAPI void e_drag_end(int x, int y); -EAPI E_Drop_Handler *e_drop_handler_add(void *data, void (*func)(void *data, const char *type, void *drop), const char *type, int x, int y, int w, int h); +EAPI E_Drop_Handler *e_drop_handler_add(void *data, void (*func)(void *data, const char *type, void *event_info), const char *type, int x, int y, int w, int h); EAPI void e_drop_handler_del(E_Drop_Handler *handler); #endif diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 0e764725d..18b3c1288 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -1363,7 +1363,19 @@ _pager_desk_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_C } static void -_pager_drop_cb(void *data, const char *type, void *drop) +_pager_drop_cb(void *data, const char *type, void *event_info) { - printf("We have a drop!\n"); + E_Drop_Event *e; + Pager_Face *face; + int x, y, w, h; + + e = event_info; + face = data; + + x = e->x - face->fx; + y = e->y - face->fy; + w = x / face->xnum; + h = y / face->ynum; + + printf("We have a drop! %d %d\n", w, h); }