DND work.

SVN revision: 14357
This commit is contained in:
sebastid 2005-04-25 18:02:26 +00:00 committed by sebastid
parent 3b74220a06
commit 42aae70082
4 changed files with 31 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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);
}