Enlightenment CVS committal Author : sebastid Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_apps.c e_apps.h e_dnd.c e_dnd.h Log Message: Icon dragging in the ibar. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -3 -r1.38 -r1.39 --- e_apps.c 3 May 2005 13:44:42 -0000 1.38 +++ e_apps.c 3 May 2005 17:27:40 -0000 1.39 @@ -40,6 +40,7 @@ static void _e_app_subdir_rescan (E_App *app); static int _e_app_is_eapp (const char *path); static E_App *_e_app_copy (E_App *app); +static void _e_app_save_order (E_App *app); /* local subsystem globals */ static Evas_Hash *_e_apps = NULL; @@ -281,6 +282,7 @@ before->parent->subapps = evas_list_prepend_relative(before->parent->subapps, add, before); + _e_app_save_order(before->parent); _e_app_change(add, E_APP_ADD); _e_app_change(before->parent, E_APP_ORDER); } @@ -290,14 +292,18 @@ { parent->subapps = evas_list_append(parent->subapps, add); + _e_app_save_order(parent); _e_app_change(add, E_APP_ADD); } void -e_app_remove(E_App *remove, E_App *parent) +e_app_remove(E_App *remove) { - parent->subapps = evas_list_remove(parent->subapps, remove); + if (!remove->parent) return; + remove->parent->subapps = evas_list_remove(remove->parent->subapps, remove); + + _e_app_save_order(remove->parent); _e_app_change(remove, E_APP_DEL); } @@ -1026,3 +1032,26 @@ return a2; } + +static void +_e_app_save_order(E_App *app) +{ + FILE *f; + char buf[PATH_MAX]; + Evas_List *l; + + if (!app) return; + + snprintf(buf, sizeof(buf), "%s/.order", app->path); + f = fopen(buf, "wb"); + if (!f) return; + + for (l = app->subapps; l; l = l->next) + { + E_App *a; + + a = l->data; + fprintf(f, "%s\n", ecore_file_get_file(a->path)); + } + fclose(f); +} =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- e_apps.h 3 May 2005 13:44:43 -0000 1.11 +++ e_apps.h 3 May 2005 17:27:40 -0000 1.12 @@ -67,7 +67,7 @@ EAPI int e_app_running_get(E_App *a); EAPI void e_app_prepend_relative(E_App *add, E_App *before); EAPI void e_app_append(E_App *add, E_App *parent); -EAPI void e_app_remove(E_App *remove, E_App *parent); +EAPI void e_app_remove(E_App *remove); EAPI void e_app_change_callback_add(void (*func) (void *data, E_App *a, E_App_Change ch), void *data); EAPI void e_app_change_callback_del(void (*func) (void *data, E_App *a, E_App_Change ch), void *data); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_dnd.c 1 May 2005 18:34:56 -0000 1.14 +++ e_dnd.c 3 May 2005 17:27:41 -0000 1.15 @@ -155,7 +155,9 @@ e_drag_update(int x, int y) { Evas_List *l; - E_Move_Event *ev; + E_Enter_Event *enter_ev; + E_Move_Event *move_ev; + E_Leave_Event *leave_ev; int w, h; if (!drag_ee) return; @@ -171,10 +173,17 @@ 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; + enter_ev = E_NEW(E_Enter_Event, 1); + enter_ev->x = x; + enter_ev->y = y; + + move_ev = E_NEW(E_Move_Event, 1); + move_ev->x = x; + move_ev->y = y; + + leave_ev = E_NEW(E_Leave_Event, 1); + leave_ev->x = x; + leave_ev->y = y; for (l = drop_handlers; l; l = l->next) { @@ -185,16 +194,31 @@ if (!h->active) continue; - if ((h->cb.move) - && E_INSIDE(x, y, h->x, h->y, h->w, h->h)) + if (E_INSIDE(x, y, h->x, h->y, h->w, h->h)) + { + if (!h->entered) + { + if (h->cb.enter) + h->cb.enter(h->data, drag_type, enter_ev); + h->entered = 1; + } + if (h->cb.move) + h->cb.move(h->data, drag_type, move_ev); + } + else { - h->cb.move(h->data, drag_type, ev); + if (h->entered) + { + if (h->cb.leave) + h->cb.leave(h->data, drag_type, leave_ev); + h->entered = 0; + } } } - free(ev); -end: - return; + free(enter_ev); + free(move_ev); + free(leave_ev); } void @@ -252,8 +276,10 @@ E_Drop_Handler * e_drop_handler_add(void *data, - void (*drop_cb)(void *data, const char *type, void *event), + void (*enter_cb)(void *data, const char *type, void *event), void (*move_cb)(void *data, const char *type, void *event), + void (*leave_cb)(void *data, const char *type, void *event), + void (*drop_cb)(void *data, const char *type, void *event), const char *type, int x, int y, int w, int h) { E_Drop_Handler *handler; @@ -262,8 +288,10 @@ if (!handler) return NULL; handler->data = data; - handler->cb.drop = drop_cb; + handler->cb.enter = enter_cb; handler->cb.move = move_cb; + handler->cb.leave = leave_cb; + handler->cb.drop = drop_cb; handler->type = strdup(type); handler->x = x; handler->y = y; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- e_dnd.h 1 May 2005 18:28:20 -0000 1.9 +++ e_dnd.h 3 May 2005 17:27:41 -0000 1.10 @@ -5,8 +5,10 @@ #ifdef E_TYPEDEFS typedef struct _E_Drop_Handler E_Drop_Handler; -typedef struct _E_Drop_Event E_Drop_Event; +typedef struct _E_Enter_Event E_Enter_Event; typedef struct _E_Move_Event E_Move_Event; +typedef struct _E_Leave_Event E_Leave_Event; +typedef struct _E_Drop_Event E_Drop_Event; #else #ifndef E_DND_H @@ -16,17 +18,19 @@ { void *data; struct { - void (*drop)(void *data, const char *type, void *event); + void (*enter)(void *data, const char *type, void *event); void (*move)(void *data, const char *type, void *event); + void (*leave)(void *data, const char *type, void *event); + void (*drop)(void *data, const char *type, void *event); } cb; char *type; int x, y, w, h; unsigned char active : 1; + unsigned char entered : 1; }; -struct _E_Drop_Event +struct _E_Enter_Event { - void *data; int x, y; }; @@ -35,6 +39,17 @@ int x, y; }; +struct _E_Leave_Event +{ + int x, y; +}; + +struct _E_Drop_Event +{ + void *data; + int x, y; +}; + EAPI int e_dnd_init(void); EAPI int e_dnd_shutdown(void); @@ -46,8 +61,10 @@ EAPI void e_drag_end(int x, int y); EAPI E_Drop_Handler *e_drop_handler_add(void *data, - void (*drop_cb)(void *data, const char *type, void *event), + void (*enter_cb)(void *data, const char *type, void *event), void (*move_cb)(void *data, const char *type, void *event), + void (*leave_cb)(void *data, const char *type, void *event), + void (*drop_cb)(void *data, const char *type, void *event), const char *type, int x, int y, int w, int h); EAPI void e_drop_handler_del(E_Drop_Handler *handler); ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs