From a9757fa04b6726a98540999221ef1a301f69b7c4 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 18 Sep 2006 03:49:45 +0000 Subject: [PATCH] i'm cleaning up dnd. fixed leaks. made dnd more convenient - less work to do (it returns x,y coords relative to the drop target geom, not the screen, start putting in all the necessary stuff in fm2 - can dnd 2 file now (drop has no effect though)... SVN revision: 25950 --- src/bin/e_border.c | 7 +- src/bin/e_dnd.c | 119 +-- src/bin/e_fm.c | 1129 ++++++++++++++--------- src/bin/e_fm.h | 3 +- src/bin/e_gadcon.c | 12 +- src/bin/e_int_config_wallpaper_import.c | 1 + src/bin/e_shelf.c | 6 +- src/bin/e_utils.c | 31 +- src/bin/e_utils.h | 1 + src/bin/e_widget_fsel.c | 11 + src/bin/e_widget_fsel.h | 5 +- src/modules/battery/e_mod_main.c | 6 +- src/modules/cpufreq/e_mod_main.c | 6 +- src/modules/ibar/e_mod_main.c | 40 +- src/modules/ibox/e_mod_main.c | 39 +- src/modules/pager/e_mod_main.c | 30 +- src/modules/start/e_mod_main.c | 6 +- src/modules/temperature/e_mod_main.c | 6 +- 18 files changed, 860 insertions(+), 598 deletions(-) diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 4e35faf7f..a0502e0a1 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -4719,9 +4719,10 @@ _e_border_cb_mouse_move(void *data, int type, void *event) e_drag_resize(drag, w, h); e_drag_start(drag, bd->drag.x, bd->drag.y); - evas_event_feed_mouse_up(bd->bg_evas, 1, - EVAS_BUTTON_NONE, ev->time, - NULL); + e_util_evas_fake_mouse_up_later(bd->bg_evas, 1); +// evas_event_feed_mouse_up(bd->bg_evas, 1, +// EVAS_BUTTON_NONE, ev->time, +// NULL); } bd->drag.start = 0; } diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index 7d941d4cc..b28f3087e 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -509,30 +509,14 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh) case E_WIN_TYPE: px = ((E_Win *)(h->obj))->x; py = ((E_Win *)(h->obj))->y; - if ((((E_Win *)(h->obj))->border) && - (((E_Win *)(h->obj))->border->zone)) - { - px -= ((E_Win *)(h->obj))->border->zone->x; - py -= ((E_Win *)(h->obj))->border->zone->y; - } break; case E_BORDER_TYPE: px = ((E_Border *)(h->obj))->x + ((E_Border *)(h->obj))->fx.x; py = ((E_Border *)(h->obj))->y + ((E_Border *)(h->obj))->fx.y; - if (((E_Border *)(h->obj))->zone) - { - px -= ((E_Border *)(h->obj))->zone->x; - py -= ((E_Border *)(h->obj))->zone->y; - } break; case E_POPUP_TYPE: px = ((E_Popup *)(h->obj))->x; py = ((E_Popup *)(h->obj))->y; - if (((E_Popup *)(h->obj))->zone) - { - px -= ((E_Popup *)(h->obj))->zone->x; - py -= ((E_Popup *)(h->obj))->zone->y; - } break; /* FIXME: add mroe types as needed */ default: @@ -577,9 +561,9 @@ static void _e_drag_update(int x, int y) { Evas_List *l; - E_Event_Dnd_Enter *enter_ev; - E_Event_Dnd_Move *move_ev; - E_Event_Dnd_Leave *leave_ev; + E_Event_Dnd_Enter enter_ev; + E_Event_Dnd_Move move_ev; + E_Event_Dnd_Leave leave_ev; int dx, dy, dw, dh; Ecore_X_Window win, ignore_win[2]; @@ -588,7 +572,7 @@ _e_drag_update(int x, int y) ignore_win[0] = _drag_current->evas_win; ignore_win[1] = _drag_win; /* this is nasty - but necessary to get the window stacking */ - win = ecore_x_window_at_xy_with_skip_get(x, y, &ignore_win, 2); + win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); } else win = ecore_x_window_at_xy_with_skip_get(x, y, NULL, 0); @@ -599,18 +583,6 @@ _e_drag_update(int x, int y) _e_drag_move(_drag_current, x, y); } - enter_ev = E_NEW(E_Event_Dnd_Enter, 1); - enter_ev->x = x; - enter_ev->y = y; - - move_ev = E_NEW(E_Event_Dnd_Move, 1); - move_ev->x = x; - move_ev->y = y; - - leave_ev = E_NEW(E_Event_Dnd_Leave, 1); - leave_ev->x = x; - leave_ev->y = y; - if ((_drag_current) && (_drag_current->types)) { for (l = _drop_handlers; l; l = l->next) @@ -620,24 +592,30 @@ _e_drag_update(int x, int y) h = l->data; if (!h->active) continue; _e_drag_coords_update(h, &dx, &dy, &dw, &dh); + enter_ev.x = x - dx; + enter_ev.y = y - dy; + move_ev.x = x - dx; + move_ev.y = y - dy; + leave_ev.x = x - dx; + leave_ev.y = y - dy; if ((_e_drag_win_matches(h, win)) && (E_INSIDE(x, y, dx, dy, dw, dh))) { if (!h->entered) { if (h->cb.enter) - h->cb.enter(h->cb.data, _drag_current->types[0], 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->types[0], 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->types[0], leave_ev); + h->cb.leave(h->cb.data, _drag_current->types[0], &leave_ev); h->entered = 0; } } @@ -652,32 +630,35 @@ _e_drag_update(int x, int y) h = l->data; if (!h->active) continue; _e_drag_coords_update(h, &dx, &dy, &dw, &dh); + enter_ev.x = x - dx; + enter_ev.y = y - dy; + move_ev.x = x - dx; + move_ev.y = y - dy; + leave_ev.x = x - dx; + leave_ev.y = y - dy; if ((_e_drag_win_matches(h, win)) && (E_INSIDE(x, y, dx, dy, dw, dh))) { if (!h->entered) { if (h->cb.enter) - h->cb.enter(h->cb.data, _xdnd->type, enter_ev); + h->cb.enter(h->cb.data, _xdnd->type, &enter_ev); h->entered = 1; } if (h->cb.move) - h->cb.move(h->cb.data, _xdnd->type, move_ev); + h->cb.move(h->cb.data, _xdnd->type, &move_ev); } else { if (h->entered) { if (h->cb.leave) - h->cb.leave(h->cb.data, _xdnd->type, leave_ev); + h->cb.leave(h->cb.data, _xdnd->type, &leave_ev); h->entered = 0; } } } } - free(enter_ev); - free(move_ev); - free(leave_ev); } static void @@ -685,7 +666,7 @@ _e_drag_end(int x, int y) { E_Zone *zone; Evas_List *l; - E_Event_Dnd_Drop *ev; + E_Event_Dnd_Drop ev; const char *type = NULL; int dx, dy, dw, dh; Ecore_X_Window win, ignore_win[2]; @@ -694,7 +675,7 @@ _e_drag_end(int x, int y) ignore_win[0] = _drag_current->evas_win; ignore_win[1] = _drag_win; /* this is nasty - but necessary to get the window stacking */ - win = ecore_x_window_at_xy_with_skip_get(x, y, &ignore_win, 2); + win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); zone = e_container_zone_at_point_get(_drag_current->container, x, y); /* Pass -1, -1, so that it is possible to drop at the edge. */ if (zone) e_zone_flip_coords_handle(zone, -1, -1); @@ -717,13 +698,9 @@ _e_drag_end(int x, int y) ecore_x_window_del(_drag_win); _drag_win = 0; - ev = E_NEW(E_Event_Dnd_Drop, 1); - ev->data = _drag_current->data; + ev.data = _drag_current->data; type = _drag_current->types[0]; - ev->x = x; - ev->y = y; - - if (ev->data) + if (ev.data) { int dropped; @@ -735,11 +712,13 @@ _e_drag_end(int x, int y) h = l->data; if (!h->active) continue; _e_drag_coords_update(h, &dx, &dy, &dw, &dh); + ev.x = x - dx; + ev.y = y - dy; if ((_e_drag_win_matches(h, win)) && ((h->cb.drop) && (E_INSIDE(x, y, dx, dy, dw, dh)))) { - h->cb.drop(h->cb.data, type, ev); + h->cb.drop(h->cb.data, type, &ev); dropped = 1; } } @@ -751,12 +730,11 @@ _e_drag_end(int x, int y) else { /* Just leave */ - E_Event_Dnd_Leave *leave_ev; + E_Event_Dnd_Leave leave_ev; - leave_ev = E_NEW(E_Event_Dnd_Leave, 1); /* FIXME: We don't need x and y in leave */ - leave_ev->x = 0; - leave_ev->y = 0; + leave_ev.x = 0; + leave_ev.y = 0; for (l = _drop_handlers; l; l = l->next) { @@ -770,20 +748,18 @@ _e_drag_end(int x, int y) if (h->entered) { if (h->cb.leave) - h->cb.leave(h->cb.data, type, leave_ev); + h->cb.leave(h->cb.data, type, &leave_ev); h->entered = 0; } } } - - free(ev); } static void _e_drag_xdnd_end(int x, int y) { Evas_List *l; - E_Event_Dnd_Drop *ev; + E_Event_Dnd_Drop ev; const char *type = NULL; int dx, dy, dw, dh; Ecore_X_Window win, ignore_win[2]; @@ -794,18 +770,15 @@ _e_drag_xdnd_end(int x, int y) ignore_win[0] = _drag_current->evas_win; ignore_win[1] = _drag_win; /* this is nasty - but necessary to get the window stacking */ - win = ecore_x_window_at_xy_with_skip_get(x, y, &ignore_win, 2); + win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); } else win = ecore_x_window_at_xy_with_skip_get(x, y, NULL, 0); - ev = E_NEW(E_Event_Dnd_Drop, 1); - ev->data = _xdnd->data; + ev.data = _xdnd->data; type = _xdnd->type; - ev->x = x; - ev->y = y; - if (ev->data) + if (ev.data) { int dropped; @@ -817,11 +790,13 @@ _e_drag_xdnd_end(int x, int y) h = l->data; if (!h->active) continue; _e_drag_coords_update(h, &dx, &dy, &dw, &dh); + ev.x = x - dx; + ev.y = y - dy; if ((_e_drag_win_matches(h, win)) && ((h->cb.drop) && (E_INSIDE(x, y, dx, dy, dw, dh)))) { - h->cb.drop(h->cb.data, type, ev); + h->cb.drop(h->cb.data, type, &ev); dropped = 1; } } @@ -829,12 +804,11 @@ _e_drag_xdnd_end(int x, int y) else { /* Just leave */ - E_Event_Dnd_Leave *leave_ev; + E_Event_Dnd_Leave leave_ev; - leave_ev = E_NEW(E_Event_Dnd_Leave, 1); /* FIXME: We don't need x and y in leave */ - leave_ev->x = 0; - leave_ev->y = 0; + leave_ev.x = 0; + leave_ev.y = 0; for (l = _drop_handlers; l; l = l->next) { @@ -848,13 +822,11 @@ _e_drag_xdnd_end(int x, int y) if (h->entered) { if (h->cb.leave) - h->cb.leave(h->cb.data, type, leave_ev); + h->cb.leave(h->cb.data, type, &leave_ev); h->entered = 0; } } } - - free(ev); } static void @@ -872,8 +844,7 @@ _e_drag_free(E_Drag *drag) evas_object_del(drag->object); e_canvas_del(drag->ecore_evas); ecore_evas_free(drag->ecore_evas); - for (i = 0; i < drag->num_types; i++) - free(drag->types[i]); + for (i = 0; i < drag->num_types; i++) free(drag->types[i]); free(drag->types); free(drag); } diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c index 243d63629..0e39820e5 100644 --- a/src/bin/e_fm.c +++ b/src/bin/e_fm.c @@ -71,8 +71,11 @@ struct _E_Fm2_Smart_Data struct { char *buf; } typebuf; + + E_Object *eobj; + E_Drop_Handler *drop_handler; }; - + struct _E_Fm2_Region { E_Fm2_Smart_Data *sd; @@ -95,6 +98,12 @@ struct _E_Fm2_Icon E_Fm2_Icon_Info info; + struct { + Evas_Coord x, y; + unsigned char start : 1; + unsigned char dnd : 1; + } drag; + unsigned char realized : 1; unsigned char selected : 1; unsigned char last_selected : 1; @@ -123,6 +132,7 @@ static void _e_fm2_icon_realize(E_Fm2_Icon *ic); static void _e_fm2_icon_unrealize(E_Fm2_Icon *ic); static int _e_fm2_icon_visible(E_Fm2_Icon *ic); static void _e_fm2_icon_label_set(E_Fm2_Icon *ic, Evas_Object *obj); +static Evas_Object *_e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, void (*gen_func) (void *data, Evas_Object *obj, void *event_info), void *data); static void _e_fm2_icon_icon_set(E_Fm2_Icon *ic); static void _e_fm2_icon_thumb(E_Fm2_Icon *ic); static void _e_fm2_icon_select(E_Fm2_Icon *ic); @@ -135,9 +145,31 @@ static void _e_fm2_region_realize(E_Fm2_Region *rg); static void _e_fm2_region_unrealize(E_Fm2_Region *rg); static int _e_fm2_region_visible(E_Fm2_Region *rg); +static void _e_fm2_icon_make_visible(E_Fm2_Icon *ic); +static void _e_fm2_icon_desel_any(Evas_Object *obj); +static E_Fm2_Icon *_e_fm2_icon_first_selected_find(Evas_Object *obj); +static void _e_fm2_icon_sel_first(Evas_Object *obj); +static void _e_fm2_icon_sel_last(Evas_Object *obj); +static void _e_fm2_icon_sel_prev(Evas_Object *obj); +static void _e_fm2_icon_sel_next(Evas_Object *obj); +static void _e_fm2_typebuf_show(Evas_Object *obj); +static void _e_fm2_typebuf_hide(Evas_Object *obj); +static void _e_fm2_typebuf_history_prev(Evas_Object *obj); +static void _e_fm2_typebuf_history_next(Evas_Object *obj); +static void _e_fm2_typebuf_run(Evas_Object *obj); +static void _e_fm2_typebuf_match(Evas_Object *obj); +static void _e_fm2_typebuf_complete(Evas_Object *obj); +static void _e_fm2_typebuf_char_append(Evas_Object *obj, char *ch); +static void _e_fm2_typebuf_char_backspace(Evas_Object *obj); + +static void _e_fm2_cb_dnd_enter(void *data, const char *type, void *event); +static void _e_fm2_cb_dnd_move(void *data, const char *type, void *event); +static void _e_fm2_cb_dnd_leave(void *data, const char *type, void *event); +static void _e_fm2_cb_dnd_drop(void *data, const char *type, void *event); static void _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _e_fm2_cb_icon_thumb_dnd_gen(void *data, Evas_Object *obj, void *event_info); static void _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info); static void _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); @@ -489,8 +521,7 @@ e_fm2_file_show(Evas_Object *obj, const char *file) ic = l->data; if (!strcmp(ic->info.file, file)) { - e_fm2_pan_set(obj, ic->x, ic->y); - evas_object_smart_callback_call(obj, "pan_changed", NULL); + _e_fm2_icon_make_visible(ic); return; } } @@ -522,6 +553,26 @@ e_fm2_icon_menu_end_extend_callback_set(Evas_Object *obj, void (*func) (void *da sd->icon_menu.end.data = data; } +EAPI void +e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj) +{ + E_Fm2_Smart_Data *sd; + const char *drop[] = { "enlightenment/eapp", "enlightenment/border", "text/uri-list" }; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; // safety + if (!evas_object_type_get(obj)) return; // safety + if (strcmp(evas_object_type_get(obj), "e_fm")) return; // safety + sd->eobj = eobj; + if (sd->drop_handler) e_drop_handler_del(sd->drop_handler); + sd->drop_handler = e_drop_handler_add(sd->eobj, + sd, + _e_fm2_cb_dnd_enter, + _e_fm2_cb_dnd_move, + _e_fm2_cb_dnd_leave, + _e_fm2_cb_dnd_drop, + drop, 3, sd->x, sd->y, sd->w, sd->h); +} EAPI void e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y) @@ -1530,9 +1581,10 @@ _e_fm2_icon_label_set(E_Fm2_Icon *ic, Evas_Object *obj) } } -static void -_e_fm2_icon_icon_set(E_Fm2_Icon *ic) +static Evas_Object * +_e_fm2_icon_icon_direct_set(E_Fm2_Icon *ic, Evas_Object *o, void (*gen_func) (void *data, Evas_Object *obj, void *event_info), void *data) { + Evas_Object *oic; char buf[4096], *p; if (!ic->realized) return; @@ -1549,27 +1601,27 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) if (ic->info.icon[0] == '/') { /* path to icon file */ - ic->obj_icon = e_icon_add(evas_object_evas_get(ic->sd->obj)); - e_icon_file_set(ic->obj_icon, ic->info.icon); - e_icon_fill_inside_set(ic->obj_icon, 1); + oic = e_icon_add(evas_object_evas_get(o)); + e_icon_file_set(oic, ic->info.icon); + e_icon_fill_inside_set(oic, 1); } else { /* theme icon */ - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - e_util_edje_icon_set(ic->obj_icon, ic->info.icon); + oic = edje_object_add(evas_object_evas_get(o)); + e_util_edje_icon_set(oic, ic->info.icon); } - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); - evas_object_show(ic->obj_icon); - return; + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); + return oic; } if (S_ISDIR(ic->info.statinfo.st_mode)) { - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman", + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", "e/icons/fileman/folder"); - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); - evas_object_show(ic->obj_icon); + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); } else { @@ -1581,8 +1633,8 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) /* use mime type to select icon */ if (!icon) { - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman", + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", "e/icons/fileman/file"); } else if (!strcmp(icon, "THUMB")) @@ -1591,10 +1643,11 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); else snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); - ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj)); - e_thumb_icon_file_set(ic->obj_icon, buf, NULL); - e_thumb_icon_size_set(ic->obj_icon, 128, 128); - evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); + oic = e_thumb_icon_add(evas_object_evas_get(o)); + e_thumb_icon_file_set(oic, buf, NULL); + e_thumb_icon_size_set(oic, 128, 128); + evas_object_smart_callback_add(oic, "e_thumb_gen", + gen_func, data); _e_fm2_icon_thumb(ic); } else if (!strcmp(icon, "DESKTOP")) @@ -1603,19 +1656,20 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); else snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); - ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj)); - e_thumb_icon_file_set(ic->obj_icon, buf, e_config->icon_theme); - e_thumb_icon_size_set(ic->obj_icon, 128, 128); - evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); + oic = e_thumb_icon_add(evas_object_evas_get(o)); + e_thumb_icon_file_set(oic, buf, e_config->icon_theme); + e_thumb_icon_size_set(oic, 128, 128); + evas_object_smart_callback_add(oic, "e_thumb_gen", + gen_func, data); _e_fm2_icon_thumb(ic); } else if (!strncmp(icon, "e/icons/fileman/mime/", 21)) { - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - if (!e_theme_edje_object_set(ic->obj_icon, + oic = edje_object_add(evas_object_evas_get(o)); + if (!e_theme_edje_object_set(oic, "base/theme/fileman", icon)) - e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman", + e_theme_edje_object_set(oic, "base/theme/fileman", "e/icons/fileman/file"); } else @@ -1623,22 +1677,21 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) p = strrchr(icon, '.'); if ((p) && (!strcmp(p, ".edj"))) { - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - if (!e_theme_edje_object_set(ic->obj_icon, + oic = edje_object_add(evas_object_evas_get(o)); + if (!e_theme_edje_object_set(oic, "base/theme/fileman", icon)) - e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman", + e_theme_edje_object_set(oic, "base/theme/fileman", "e/icons/fileman/file"); } else { - ic->obj_icon = e_icon_add(evas_object_evas_get(ic->sd->obj)); - e_icon_file_set(ic->obj_icon, icon); + oic = e_icon_add(evas_object_evas_get(o)); + e_icon_file_set(oic, icon); } } - edje_object_part_swallow(ic->obj, "e.swallow.icon", - ic->obj_icon); - evas_object_show(ic->obj_icon); + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); return; } else @@ -1652,24 +1705,25 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); else snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); - ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj)); + oic = e_thumb_icon_add(evas_object_evas_get(o)); if (ic->sd->config->icon.key_hint) - e_thumb_icon_file_set(ic->obj_icon, buf, ic->sd->config->icon.key_hint); + e_thumb_icon_file_set(oic, buf, ic->sd->config->icon.key_hint); else - { - /* FIXME: There is probably a quicker way of doing this. */ - if (edje_file_group_exists(buf, "icon")) - e_thumb_icon_file_set(ic->obj_icon, buf, "icon"); - else if (edje_file_group_exists(buf, "e/desktop/background")) - e_thumb_icon_file_set(ic->obj_icon, buf, "e/desktop/background"); - else if (edje_file_group_exists(buf, "e/init/splash")) - e_thumb_icon_file_set(ic->obj_icon, buf, "e/init/splash"); - } - e_thumb_icon_size_set(ic->obj_icon, 128, 96); - evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); + { + /* FIXME: There is probably a quicker way of doing this. */ + if (edje_file_group_exists(buf, "icon")) + e_thumb_icon_file_set(oic, buf, "icon"); + else if (edje_file_group_exists(buf, "e/desktop/background")) + e_thumb_icon_file_set(oic, buf, "e/desktop/background"); + else if (edje_file_group_exists(buf, "e/init/splash")) + e_thumb_icon_file_set(oic, buf, "e/init/splash"); + } + e_thumb_icon_size_set(oic, 128, 96); + evas_object_smart_callback_add(oic, "e_thumb_gen", + gen_func, data); _e_fm2_icon_thumb(ic); - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); - evas_object_show(ic->obj_icon); + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); } else if ( (e_util_glob_case_match(ic->info.file, "*.eap")) @@ -1679,10 +1733,10 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); else snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - edje_object_file_set(ic->obj_icon, buf, "icon"); - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); - evas_object_show(ic->obj_icon); + oic = edje_object_add(evas_object_evas_get(o)); + edje_object_file_set(oic, buf, "icon"); + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); } else if ( (e_util_glob_case_match(ic->info.file, "*.desktop")) @@ -1693,29 +1747,35 @@ _e_fm2_icon_icon_set(E_Fm2_Icon *ic) else snprintf(buf, sizeof(buf), "%s/%s", ic->sd->realpath, ic->info.file); - ic->obj_icon = e_thumb_icon_add(evas_object_evas_get(ic->sd->obj)); -// FIXME: Dunno if key_hint is useful here, no one seems to use it. -// if (ic->sd->config->icon.key_hint) -// e_thumb_icon_file_set(ic->obj_icon, buf, ic->sd->config->icon.key_hint); -// else - e_thumb_icon_file_set(ic->obj_icon, buf, e_config->icon_theme); - e_thumb_icon_size_set(ic->obj_icon, 128, 96); - evas_object_smart_callback_add(ic->obj_icon, "e_thumb_gen", _e_fm2_cb_icon_thumb_gen, ic); + oic = e_thumb_icon_add(evas_object_evas_get(o)); + e_thumb_icon_file_set(oic, buf, e_config->icon_theme); + e_thumb_icon_size_set(oic, 128, 96); + evas_object_smart_callback_add(oic, "e_thumb_gen", + gen_func, data); _e_fm2_icon_thumb(ic); - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); - evas_object_show(ic->obj_icon); + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); } else { - ic->obj_icon = edje_object_add(evas_object_evas_get(ic->sd->obj)); - e_theme_edje_object_set(ic->obj_icon, "base/theme/fileman", + oic = edje_object_add(evas_object_evas_get(o)); + e_theme_edje_object_set(oic, "base/theme/fileman", "e/icons/fileman/file"); - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); - evas_object_show(ic->obj_icon); + edje_object_part_swallow(o, "e.swallow.icon", oic); + evas_object_show(oic); } } } + return oic; +} + +static void +_e_fm2_icon_icon_set(E_Fm2_Icon *ic) +{ + ic->obj_icon = _e_fm2_icon_icon_direct_set(ic, ic->obj, + _e_fm2_cb_icon_thumb_gen, + ic->obj); } static void @@ -1908,8 +1968,404 @@ _e_fm2_region_visible(E_Fm2_Region *rg) return 0; } +static void +_e_fm2_icon_make_visible(E_Fm2_Icon *ic) +{ + if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST) + { + if ( + ((ic->y - ic->sd->pos.y) >= 0) && + ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) + ) + return; + if ((ic->y - ic->sd->pos.y) < 0) + e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y); + else + e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y - ic->sd->h + ic->h); + } + else + { + Evas_Coord x, y; + + if ( + ((ic->y - ic->sd->pos.y) >= 0) && + ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) && + ((ic->x - ic->sd->pos.x) >= 0) && + ((ic->x + ic->w - ic->sd->pos.x) <= (ic->sd->w)) + ) + return; + x = ic->sd->pos.x; + if ((ic->x - ic->sd->pos.x) < 0) + x = ic->x; + else if ((ic->x + ic->w - ic->sd->pos.x) > (ic->sd->w)) + x = ic->x + ic->w - ic->sd->w; + y = ic->sd->pos.y; + if ((ic->y - ic->sd->pos.y) < 0) + y = ic->y; + else if ((ic->y + ic->h - ic->sd->pos.y) > (ic->sd->h)) + y = ic->y + ic->h - ic->sd->h; + e_fm2_pan_set(ic->sd->obj, x, y); + } + evas_object_smart_callback_call(ic->sd->obj, "pan_changed", NULL); +} + +static void +_e_fm2_icon_desel_any(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + Evas_List *l; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + for (l = sd->icons; l; l = l->next) + { + ic = l->data; + if (ic->selected) _e_fm2_icon_deselect(ic); + } +} + +static E_Fm2_Icon * +_e_fm2_icon_first_selected_find(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + Evas_List *l; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return NULL; + for (l = sd->icons; l; l = l->next) + { + ic = l->data; + if (ic->selected) return ic; + } + return NULL; +} + +static void +_e_fm2_icon_sel_first(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->icons) return; + _e_fm2_icon_desel_any(obj); + ic = sd->icons->data; + _e_fm2_icon_select(ic); + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + _e_fm2_icon_make_visible(ic); +} + +static void +_e_fm2_icon_sel_last(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->icons) return; + _e_fm2_icon_desel_any(obj); + ic = evas_list_last(sd->icons)->data; + _e_fm2_icon_select(ic); + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + _e_fm2_icon_make_visible(ic); +} + +static void +_e_fm2_icon_sel_prev(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + Evas_List *l; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->icons) return; + for (l = sd->icons; l; l = l->next) + { + ic = l->data; + if (ic->selected) + { + if (!l->prev) return; + ic = l->prev->data; + break; + } + ic = NULL; + } + if (!ic) + { + _e_fm2_icon_sel_last(obj); + return; + } + _e_fm2_icon_desel_any(obj); + _e_fm2_icon_select(ic); + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + _e_fm2_icon_make_visible(ic); +} + +static void +_e_fm2_icon_sel_next(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + Evas_List *l; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->icons) return; + for (l = sd->icons; l; l = l->next) + { + ic = l->data; + if (ic->selected) + { + if (!l->next) return; + ic = l->next->data; + break; + } + ic = NULL; + } + if (!ic) + { + _e_fm2_icon_sel_first(obj); + return; + } + _e_fm2_icon_desel_any(obj); + _e_fm2_icon_select(ic); + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + _e_fm2_icon_make_visible(ic); +} + +/* FIXME: prototype */ +static void +_e_fm2_typebuf_show(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + E_FREE(sd->typebuf.buf); + sd->typebuf.buf = strdup(""); + edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf); + edje_object_signal_emit(sd->overlay, "e,state,typebuf,start", "e"); + sd->typebuf_visible = 1; +} + +static void +_e_fm2_typebuf_hide(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + E_FREE(sd->typebuf.buf); + edje_object_signal_emit(sd->overlay, "e,state,typebuf,stop", "e"); + sd->typebuf_visible = 0; +} + +static void +_e_fm2_typebuf_history_prev(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + /* FIXME: do */ +} + +static void +_e_fm2_typebuf_history_next(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + /* FIXME: do */ +} + +static void +_e_fm2_typebuf_run(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + E_Fm2_Icon *ic; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + _e_fm2_typebuf_hide(obj); + ic = _e_fm2_icon_first_selected_find(obj); + if (ic) + { + if ((S_ISDIR(ic->info.statinfo.st_mode)) && + (ic->sd->config->view.open_dirs_in_place) && + (!ic->sd->config->view.no_subdir_jump) && + (!ic->sd->config->view.single_click) + ) + { + char buf[4096], *dev = NULL; + + if (ic->sd->dev) dev = strdup(ic->sd->dev); + if (ic->info.pseudo_link) + snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); + else + snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); + e_fm2_path_set(ic->sd->obj, dev, buf); + E_FREE(dev); + } + else + { + evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); + } + } +} + +static void +_e_fm2_typebuf_match(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + Evas_List *l; + E_Fm2_Icon *ic; + char *tb; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->typebuf.buf) return; + if (!sd->icons) return; + _e_fm2_icon_desel_any(obj); + tb = malloc(strlen(sd->typebuf.buf) + 2); + if (!tb) return; + strcpy(tb, sd->typebuf.buf); + strcat(tb, "*"); + for (l = sd->icons; l; l = l->next) + { + ic = l->data; + if ( + ((ic->info.label) && + (e_util_glob_case_match(ic->info.label, tb))) || + ((ic->info.file) && + (e_util_glob_case_match(ic->info.file, tb))) + ) + { + _e_fm2_icon_select(ic); + evas_object_smart_callback_call(sd->obj, "selection_change", NULL); + _e_fm2_icon_make_visible(ic); + break; + } + } + free(tb); +} + +static void +_e_fm2_typebuf_complete(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + /* FIXME: do */ + _e_fm2_typebuf_match(obj); +} + +static void +_e_fm2_typebuf_char_append(Evas_Object *obj, char *ch) +{ + E_Fm2_Smart_Data *sd; + char *ts; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->typebuf.buf) return; + ts = malloc(strlen(sd->typebuf.buf) + strlen(ch) + 1); + if (!ts) return; + strcpy(ts, sd->typebuf.buf); + strcat(ts, ch); + free(sd->typebuf.buf); + sd->typebuf.buf = ts; + _e_fm2_typebuf_match(obj); + edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf); +} + +static void +_e_fm2_typebuf_char_backspace(Evas_Object *obj) +{ + E_Fm2_Smart_Data *sd; + char *ts; + int len, p, dec; + + sd = evas_object_smart_data_get(obj); + if (!sd) return; + if (!sd->typebuf.buf) return; + len = strlen(sd->typebuf.buf); + if (len == 0) + { + _e_fm2_typebuf_hide(obj); + return; + } + p = evas_string_char_prev_get(sd->typebuf.buf, len, &dec); + if (p >= 0) sd->typebuf.buf[p] = 0; + ts = strdup(sd->typebuf.buf); + if (!ts) return; + free(sd->typebuf.buf); + sd->typebuf.buf = ts; + _e_fm2_typebuf_match(obj); + edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf); +} + /**************************/ +static void +_e_fm2_cb_dnd_enter(void *data, const char *type, void *event) +{ + E_Fm2_Smart_Data *sd; + E_Event_Dnd_Enter *ev; + + sd = data; + if (!type) return; + if (strcmp(type, "text/uri-list")) return; + ev = (E_Event_Dnd_Enter *)event; + printf("DND IN %i %i\n", ev->x, ev->y); +} + +static void +_e_fm2_cb_dnd_move(void *data, const char *type, void *event) +{ + E_Fm2_Smart_Data *sd; + E_Event_Dnd_Move *ev; + + sd = data; + if (!type) return; + if (strcmp(type, "text/uri-list")) return; + ev = (E_Event_Dnd_Move *)event; + printf("DND MOVE %i %i\n", ev->x, ev->y); +} + +static void +_e_fm2_cb_dnd_leave(void *data, const char *type, void *event) +{ + E_Fm2_Smart_Data *sd; + E_Event_Dnd_Leave *ev; + + sd = data; + if (!type) return; + if (strcmp(type, "text/uri-list")) return; + ev = (E_Event_Dnd_Leave *)event; + printf("DND LEAVE %i %i\n", ev->x, ev->y); +} + +static void +_e_fm2_cb_dnd_drop(void *data, const char *type, void *event) +{ + E_Fm2_Smart_Data *sd; + E_Event_Dnd_Drop *ev; + + sd = data; + if (!type) return; + if (strcmp(type, "text/uri-list")) return; + ev = (E_Event_Dnd_Drop *)event; + printf("DROP: %i %i %s\n", ev->x, ev->y, ev->data); +} + static void _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { @@ -1955,6 +2411,13 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf } else if (ev->button == 1) { + if ((ic->sd->eobj)) + { + ic->drag.x = ev->output.x; + ic->drag.y = ev->output.y; + ic->drag.start = 1; + ic->drag.dnd = 0; + } if (ic->sd->config->selection.windows_modifiers) { if (evas_key_modifier_is_set(ev->modifiers, "Shift")) @@ -2042,8 +2505,10 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf else if (ev->button == 3) { _e_fm2_icon_menu(ic, ic->sd->obj, ev->timestamp); - evas_event_feed_mouse_up(evas_object_evas_get(ic->sd->obj), ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(evas_object_evas_get(ic->sd->obj), + ev->button); +// evas_event_feed_mouse_up(evas_object_evas_get(ic->sd->obj), ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -2055,6 +2520,17 @@ _e_fm2_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info) ic = data; ev = event_info; + if ((ev->button == 1) && (!ic->drag.dnd)) + { + ic->drag.start = 0; + ic->drag.dnd = 0; + } +} + +static void +_e_fm2_cb_drag_finished(E_Drag *drag, int dropped) +{ + free(drag->data); } static void @@ -2062,11 +2538,126 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_inf { Evas_Event_Mouse_Move *ev; E_Fm2_Icon *ic; - + ic = data; ev = event_info; + if ((ic->drag.start) && (ic->sd->eobj)) + { + int dx, dy; + + dx = ev->cur.output.x - ic->drag.x; + dy = ev->cur.output.y - ic->drag.y; + if (((dx * dx) + (dy * dy)) > + (e_config->drag_resist * e_config->drag_resist)) + { + E_Drag *d; + Evas_Object *o, *o2; + Evas_Coord x, y, w, h; + const char *drag_types[] = { "text/uri-list" }, *realpath; + char buf[4096]; + E_Container *con = NULL; + + switch (ic->sd->eobj->type) + { + case E_GADCON_TYPE: + con = ((E_Gadcon *)(ic->sd->eobj))->zone->container; + break; + case E_WIN_TYPE: + con = ((E_Win *)(ic->sd->eobj))->container; + break; + case E_BORDER_TYPE: + con = ((E_Border *)(ic->sd->eobj))->zone->container; + break; + case E_POPUP_TYPE: + con = ((E_Popup *)(ic->sd->eobj))->zone->container; + break; + /* FIXME: add mroe types as needed */ + default: + break; + } + if (!con) return; + ic->drag.dnd = 1; + ic->drag.start = 0; + evas_object_geometry_get(ic->obj, &x, &y, &w, &h); + realpath = e_fm2_real_path_get(ic->sd->obj); + if (!strcmp(realpath, "/")) + snprintf(buf, sizeof(buf), "/%s", ic->info.file); + else + snprintf(buf, sizeof(buf), "%s/%s", realpath, ic->info.file); + + d = e_drag_new(con, + x, y, drag_types, 1, + strdup(buf), -1, _e_fm2_cb_drag_finished); + o = edje_object_add(e_drag_evas_get(d)); + if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST) + { + if (ic->sd->config->icon.fixed.w) + { + if (ic->odd) + e_theme_edje_object_set(o, "base/theme/widgets", + "e/fileman/list_odd/fixed"); + else + e_theme_edje_object_set(o, "base/theme/widgets", + "e/fileman/list/fixed"); + } + else + { + if (ic->odd) + e_theme_edje_object_set(o, "base/theme/widgets", + "e/fileman/list_odd/variable"); + else + e_theme_edje_object_set(o, "base/theme/widgets", + "e/fileman/list/variable"); + } + } + else + { + if (ic->sd->config->icon.fixed.w) + e_theme_edje_object_set(o, "base/theme/fileman", + "e/fileman/icon/fixed"); + else + e_theme_edje_object_set(o, "base/theme/fileman", + "e/fileman/icon/variable"); + } + _e_fm2_icon_label_set(ic, o); + o2 = _e_fm2_icon_icon_direct_set(ic, o, + _e_fm2_cb_icon_thumb_dnd_gen, o); + edje_object_signal_emit(o, "e,state,selected", "e"); + edje_object_signal_emit(o2, "e,state,selected", "e"); + e_drag_object_set(d, o); + e_drag_resize(d, w, h); + e_drag_start(d, ic->drag.x, ic->drag.y); + e_util_evas_fake_mouse_up_later(evas_object_evas_get(ic->sd->obj), + 1); +// evas_event_feed_mouse_up(evas_object_evas_get(ic->sd->obj), +// 1, EVAS_BUTTON_NONE, +// ecore_x_current_time_get(), NULL); + } + } } - + +static void +_e_fm2_cb_icon_thumb_dnd_gen(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *o; + Evas_Coord w = 0, h = 0; + int have_alpha; + + o = data; + e_icon_size_get(obj, &w, &h); + have_alpha = e_icon_alpha_get(obj); +// if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST) + { + edje_extern_object_aspect_set(obj, + EDJE_ASPECT_CONTROL_BOTH, w, h); + } + edje_object_part_swallow(o, "e.swallow.icon", obj); + if (have_alpha) + edje_object_signal_emit(o, "e,action,thumb,gen,alpha", "e"); + else + edje_object_signal_emit(o, "e,action,thumb,gen", "e"); +} + static void _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info) { @@ -2078,14 +2669,14 @@ _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info) Evas_Coord w = 0, h = 0; int have_alpha; - e_icon_size_get(ic->obj_icon, &w, &h); - have_alpha = e_icon_alpha_get(ic->obj_icon); + e_icon_size_get(obj, &w, &h); + have_alpha = e_icon_alpha_get(obj); if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST) { - edje_extern_object_aspect_set(ic->obj_icon, + edje_extern_object_aspect_set(obj, EDJE_ASPECT_CONTROL_BOTH, w, h); } - edje_object_part_swallow(ic->obj, "e.swallow.icon", ic->obj_icon); + edje_object_part_swallow(ic->obj, "e.swallow.icon", obj); if (have_alpha) edje_object_signal_emit(ic->obj, "e,action,thumb,gen,alpha", "e"); else @@ -2093,365 +2684,6 @@ _e_fm2_cb_icon_thumb_gen(void *data, Evas_Object *obj, void *event_info) } } -/* FIXME: prototype */ -static void -_e_fm2_icon_make_visible(E_Fm2_Icon *ic) -{ - if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST) - { - if ( - ((ic->y - ic->sd->pos.y) >= 0) && - ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) - ) - return; - if ((ic->y - ic->sd->pos.y) < 0) - e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y); - else - e_fm2_pan_set(ic->sd->obj, ic->sd->pos.x, ic->y - ic->sd->h + ic->h); - } - else - { - Evas_Coord x, y; - - if ( - ((ic->y - ic->sd->pos.y) >= 0) && - ((ic->y + ic->h - ic->sd->pos.y) <= (ic->sd->h)) && - ((ic->x - ic->sd->pos.x) >= 0) && - ((ic->x + ic->w - ic->sd->pos.x) <= (ic->sd->w)) - ) - return; - x = ic->sd->pos.x; - if ((ic->x - ic->sd->pos.x) < 0) - x = ic->x; - else if ((ic->x + ic->w - ic->sd->pos.x) > (ic->sd->w)) - x = ic->x + ic->w - ic->sd->w; - y = ic->sd->pos.y; - if ((ic->y - ic->sd->pos.y) < 0) - y = ic->y; - else if ((ic->y + ic->h - ic->sd->pos.y) > (ic->sd->h)) - y = ic->y + ic->h - ic->sd->h; - e_fm2_pan_set(ic->sd->obj, x, y); - } - evas_object_smart_callback_call(ic->sd->obj, "pan_changed", NULL); -} - -/* FIXME: prototype */ -static void -_e_fm2_icon_desel_any(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - Evas_List *l; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - for (l = sd->icons; l; l = l->next) - { - ic = l->data; - if (ic->selected) _e_fm2_icon_deselect(ic); - } -} - -/* FIXME: prototype */ -static E_Fm2_Icon * -_e_fm2_icon_first_selected_find(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - Evas_List *l; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return NULL; - for (l = sd->icons; l; l = l->next) - { - ic = l->data; - if (ic->selected) return ic; - } - return NULL; -} - -/* FIXME: prototype */ -static void -_e_fm2_icon_sel_first(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->icons) return; - _e_fm2_icon_desel_any(obj); - ic = sd->icons->data; - _e_fm2_icon_select(ic); - evas_object_smart_callback_call(sd->obj, "selection_change", NULL); - _e_fm2_icon_make_visible(ic); -} - -/* FIXME: prototype */ -static void -_e_fm2_icon_sel_last(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->icons) return; - _e_fm2_icon_desel_any(obj); - ic = evas_list_last(sd->icons)->data; - _e_fm2_icon_select(ic); - evas_object_smart_callback_call(sd->obj, "selection_change", NULL); - _e_fm2_icon_make_visible(ic); -} - -/* FIXME: prototype */ -static void -_e_fm2_icon_sel_prev(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - Evas_List *l; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->icons) return; - for (l = sd->icons; l; l = l->next) - { - ic = l->data; - if (ic->selected) - { - if (!l->prev) return; - ic = l->prev->data; - break; - } - ic = NULL; - } - if (!ic) - { - _e_fm2_icon_sel_last(obj); - return; - } - _e_fm2_icon_desel_any(obj); - _e_fm2_icon_select(ic); - evas_object_smart_callback_call(sd->obj, "selection_change", NULL); - _e_fm2_icon_make_visible(ic); -} - -/* FIXME: prototype */ -static void -_e_fm2_icon_sel_next(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - Evas_List *l; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->icons) return; - for (l = sd->icons; l; l = l->next) - { - ic = l->data; - if (ic->selected) - { - if (!l->next) return; - ic = l->next->data; - break; - } - ic = NULL; - } - if (!ic) - { - _e_fm2_icon_sel_first(obj); - return; - } - _e_fm2_icon_desel_any(obj); - _e_fm2_icon_select(ic); - evas_object_smart_callback_call(sd->obj, "selection_change", NULL); - _e_fm2_icon_make_visible(ic); -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_show(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - E_FREE(sd->typebuf.buf); - sd->typebuf.buf = strdup(""); - edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf); - edje_object_signal_emit(sd->overlay, "e,state,typebuf,start", "e"); - sd->typebuf_visible = 1; -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_hide(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - E_FREE(sd->typebuf.buf); - edje_object_signal_emit(sd->overlay, "e,state,typebuf,stop", "e"); - sd->typebuf_visible = 0; -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_history_prev(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - /* FIXME: do */ -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_history_next(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - /* FIXME: do */ -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_run(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - E_Fm2_Icon *ic; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - _e_fm2_typebuf_hide(obj); - ic = _e_fm2_icon_first_selected_find(obj); - if (ic) - { - if ((S_ISDIR(ic->info.statinfo.st_mode)) && - (ic->sd->config->view.open_dirs_in_place) && - (!ic->sd->config->view.no_subdir_jump) && - (!ic->sd->config->view.single_click) - ) - { - char buf[4096], *dev = NULL; - - if (ic->sd->dev) dev = strdup(ic->sd->dev); - if (ic->info.pseudo_link) - snprintf(buf, sizeof(buf), "%s/%s", ic->info.pseudo_dir, ic->info.file); - else - snprintf(buf, sizeof(buf), "%s/%s", ic->sd->path, ic->info.file); - e_fm2_path_set(ic->sd->obj, dev, buf); - E_FREE(dev); - } - else - { - evas_object_smart_callback_call(ic->sd->obj, "selected", NULL); - } - } -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_match(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - Evas_List *l; - E_Fm2_Icon *ic; - char *tb; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->typebuf.buf) return; - if (!sd->icons) return; - _e_fm2_icon_desel_any(obj); - tb = malloc(strlen(sd->typebuf.buf) + 2); - if (!tb) return; - strcpy(tb, sd->typebuf.buf); - strcat(tb, "*"); - for (l = sd->icons; l; l = l->next) - { - ic = l->data; - if ( - ((ic->info.label) && - (e_util_glob_case_match(ic->info.label, tb))) || - ((ic->info.file) && - (e_util_glob_case_match(ic->info.file, tb))) - ) - { - _e_fm2_icon_select(ic); - evas_object_smart_callback_call(sd->obj, "selection_change", NULL); - _e_fm2_icon_make_visible(ic); - break; - } - } - free(tb); -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_complete(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - /* FIXME: do */ - _e_fm2_typebuf_match(obj); -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_char_append(Evas_Object *obj, char *ch) -{ - E_Fm2_Smart_Data *sd; - char *ts; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->typebuf.buf) return; - ts = malloc(strlen(sd->typebuf.buf) + strlen(ch) + 1); - if (!ts) return; - strcpy(ts, sd->typebuf.buf); - strcat(ts, ch); - free(sd->typebuf.buf); - sd->typebuf.buf = ts; - _e_fm2_typebuf_match(obj); - edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf); -} - -/* FIXME: prototype */ -static void -_e_fm2_typebuf_char_backspace(Evas_Object *obj) -{ - E_Fm2_Smart_Data *sd; - char *ts; - int len, p, dec; - - sd = evas_object_smart_data_get(obj); - if (!sd) return; - if (!sd->typebuf.buf) return; - len = strlen(sd->typebuf.buf); - if (len == 0) - { - _e_fm2_typebuf_hide(obj); - return; - } - p = evas_string_char_prev_get(sd->typebuf.buf, len, &dec); - if (p >= 0) sd->typebuf.buf[p] = 0; - ts = strdup(sd->typebuf.buf); - if (!ts) return; - free(sd->typebuf.buf); - sd->typebuf.buf = ts; - _e_fm2_typebuf_match(obj); - edje_object_part_text_set(sd->overlay, "e.text.typebuf_label", sd->typebuf.buf); -} - static void _e_fm2_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info) { @@ -2626,8 +2858,10 @@ _e_fm2_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) if (ev->button == 3) { _e_fm2_menu(sd->obj, ev->timestamp); - evas_event_feed_mouse_up(evas_object_evas_get(sd->obj), ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(evas_object_evas_get(sd->obj), + ev->button); +// evas_event_feed_mouse_up(evas_object_evas_get(sd->obj), ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -2728,10 +2962,10 @@ _e_fm2_cb_icon_sort(void *data1, void *data2) ic1 = data1; ic2 = data2; - l1 = ic1->info.file; - if (ic1->info.label) l1 = ic1->info.label; - l2 = ic2->info.file; - if (ic2->info.label) l2 = ic2->info.label; + l1 = (char *)ic1->info.file; + if (ic1->info.label) l1 = (char *)ic1->info.label; + l2 = (char *)ic2->info.file; + if (ic2->info.label) l2 = (char *)ic2->info.label; if (ic1->sd->config->list.sort.dirs.first) { if ((S_ISDIR(ic1->info.statinfo.st_mode)) != @@ -2974,10 +3208,11 @@ _e_fm2_smart_del(Evas_Object *obj) if (sd->config) _e_fm2_config_free(sd->config); E_FREE(sd->typebuf.buf); - + evas_object_del(sd->underlay); evas_object_del(sd->overlay); evas_object_del(sd->clip); + if (sd->drop_handler) e_drop_handler_del(sd->drop_handler); free(sd); } @@ -2995,6 +3230,8 @@ _e_fm2_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y) evas_object_move(sd->overlay, sd->x, sd->y); evas_object_move(sd->clip, sd->x - OVERCLIP, sd->y - OVERCLIP); _e_fm2_obj_icons_place(sd); + if (sd->drop_handler) + e_drop_handler_geometry_set(sd->drop_handler, sd->x, sd->y, sd->w, sd->h); } static void @@ -3025,6 +3262,8 @@ _e_fm2_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) if (sd->scroll_job) ecore_job_del(sd->scroll_job); sd->scroll_job = ecore_job_add(_e_fm2_cb_scroll_job, obj); } + if (sd->drop_handler) + e_drop_handler_geometry_set(sd->drop_handler, sd->x, sd->y, sd->w, sd->h); } static void diff --git a/src/bin/e_fm.h b/src/bin/e_fm.h index 581e60e88..67a795ab2 100644 --- a/src/bin/e_fm.h +++ b/src/bin/e_fm.h @@ -116,7 +116,8 @@ EAPI void e_fm2_select_set(Evas_Object *obj, const char *file, EAPI void e_fm2_file_show(Evas_Object *obj, const char *file); EAPI void e_fm2_icon_menu_start_extend_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data); EAPI void e_fm2_icon_menu_end_extend_callback_set(Evas_Object *obj, void (*func) (void *data, Evas_Object *obj, E_Menu *m, E_Fm2_Icon_Info *info), void *data); - +EAPI void e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj); + EAPI void e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y); EAPI void e_fm2_pan_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); EAPI void e_fm2_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index a7d806948..7b37763e1 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -1200,8 +1200,10 @@ _e_gadcon_client_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *even e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -1521,8 +1523,10 @@ _e_gadcon_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_in e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } diff --git a/src/bin/e_int_config_wallpaper_import.c b/src/bin/e_int_config_wallpaper_import.c index c0b201fc4..3fd56a1c4 100644 --- a/src/bin/e_int_config_wallpaper_import.c +++ b/src/bin/e_int_config_wallpaper_import.c @@ -140,6 +140,7 @@ e_int_config_wallpaper_import(E_Config_Dialog *parent) _import_cb_sel_selected, import, _import_cb_sel_change, import, 1 ); + e_widget_fsel_window_object_set(ofm, win); import->fsel_obj = ofm; e_widget_list_object_append(o, ofm, 1, 1, 0.5); diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 4b25822fe..7f4c36362 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -923,8 +923,10 @@ _e_shelf_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_inf e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(es->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(es->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(es->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index dc7c0391b..20f1b4948 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -22,7 +22,7 @@ typedef struct _E_Util_Fake_Mouse_Up_Info E_Util_Fake_Mouse_Up_Info; struct _E_Util_Fake_Mouse_Up_Info { - E_Container *con; + Evas *evas; int button; }; @@ -37,19 +37,10 @@ static Ecore_Timer *_e_util_dummy_timer = NULL; EAPI void e_util_container_fake_mouse_up_later(E_Container *con, int button) { - E_Util_Fake_Mouse_Up_Info *info; - E_OBJECT_CHECK(con); E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE); - info = calloc(1, sizeof(E_Util_Fake_Mouse_Up_Info)); - if (info) - { - info->con = con; - info->button = button; - e_object_ref(E_OBJECT(info->con)); - ecore_job_add(_e_util_container_fake_mouse_up_cb, info); - } + e_util_evas_fake_mouse_up_later(con->bg_evas, button); } EAPI void @@ -63,6 +54,20 @@ e_util_container_fake_mouse_up_all_later(E_Container *con) e_util_container_fake_mouse_up_later(con, 3); } +EAPI void +e_util_evas_fake_mouse_up_later(Evas *e, int button) +{ + E_Util_Fake_Mouse_Up_Info *info; + + info = calloc(1, sizeof(E_Util_Fake_Mouse_Up_Info)); + if (info) + { + info->evas = e; + info->button = button; + ecore_job_add(_e_util_container_fake_mouse_up_cb, info); + } +} + EAPI void e_util_wakeup(void) { @@ -675,8 +680,8 @@ _e_util_container_fake_mouse_up_cb(void *data) info = data; if (info) { - evas_event_feed_mouse_up(info->con->bg_evas, info->button, EVAS_BUTTON_NONE, ecore_x_current_time_get(), NULL); - e_object_unref(E_OBJECT(info->con)); + evas_event_feed_mouse_up(info->evas, info->button, EVAS_BUTTON_NONE, + ecore_x_current_time_get(), NULL); free(info); } } diff --git a/src/bin/e_utils.h b/src/bin/e_utils.h index c71cf3a6d..3029db2ef 100644 --- a/src/bin/e_utils.h +++ b/src/bin/e_utils.h @@ -17,6 +17,7 @@ EAPI void e_util_container_fake_mouse_up_later(E_Container *con, int button); EAPI void e_util_container_fake_mouse_up_all_later(E_Container *con); +EAPI void e_util_evas_fake_mouse_up_later(Evas *e, int button); EAPI void e_util_wakeup(void); EAPI void e_util_env_set(const char *var, const char *val); EAPI E_Zone *e_util_zone_current_get(E_Manager *man); diff --git a/src/bin/e_widget_fsel.c b/src/bin/e_widget_fsel.c index a457cb877..5351c5d8f 100644 --- a/src/bin/e_widget_fsel.c +++ b/src/bin/e_widget_fsel.c @@ -542,6 +542,17 @@ e_widget_fsel_selection_path_get(Evas_Object *obj) return wd->path; } +EAPI void +e_widget_fsel_window_object_set(Evas_Object *obj, E_Object *eobj) +{ + E_Widget_Data *wd; + + if (!obj) return NULL; + wd = e_widget_data_get(obj); + e_fm2_window_object_set(wd->o_favorites_fm, eobj); + e_fm2_window_object_set(wd->o_files_fm, eobj); +} + static void _e_wid_fsel_preview_update(void *data, Evas_Object *obj, void *event_info) { diff --git a/src/bin/e_widget_fsel.h b/src/bin/e_widget_fsel.h index bb1ff2959..79dfca11c 100644 --- a/src/bin/e_widget_fsel.h +++ b/src/bin/e_widget_fsel.h @@ -9,8 +9,9 @@ EAPI Evas_Object *e_widget_fsel_add(Evas *evas, const char *dev, const char *path, char *selected, char *filter, void (*sel_func) (void *data, Evas_Object *obj), void *sel_data, void (*chg_func) (void *data, Evas_Object *obj), void *chg_data, int preview); -EAPI const char *e_widget_fsel_selection_path_get(Evas_Object *obj); EAPI void e_widget_fsel_path_get(Evas_Object *obj, const char **dev, const char **path); - +EAPI const char *e_widget_fsel_selection_path_get(Evas_Object *obj); +EAPI void e_widget_fsel_window_object_set(Evas_Object *obj, E_Object *eobj); + #endif #endif diff --git a/src/modules/battery/e_mod_main.c b/src/modules/battery/e_mod_main.c index b07b32896..9f089831a 100644 --- a/src/modules/battery/e_mod_main.c +++ b/src/modules/battery/e_mod_main.c @@ -184,8 +184,10 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } diff --git a/src/modules/cpufreq/e_mod_main.c b/src/modules/cpufreq/e_mod_main.c index 43744eadb..f8910a983 100644 --- a/src/modules/cpufreq/e_mod_main.c +++ b/src/modules/cpufreq/e_mod_main.c @@ -289,8 +289,10 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c index 56c847500..2d8c1f665 100644 --- a/src/modules/ibar/e_mod_main.c +++ b/src/modules/ibar/e_mod_main.c @@ -307,8 +307,10 @@ _ibar_cb_empty_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(b->inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(b->inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(b->inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -933,8 +935,10 @@ _ibar_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(ic->ibar->inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(ic->ibar->inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(ic->ibar->inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -989,9 +993,11 @@ _ibar_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info e_drag_resize(d, w, h); e_drag_start(d, ic->drag.x, ic->drag.y); - evas_event_feed_mouse_up(ic->ibar->inst->gcc->gadcon->evas, - 1, EVAS_BUTTON_NONE, - ecore_x_current_time_get(), NULL); + e_util_evas_fake_mouse_up_later(ic->ibar->inst->gcc->gadcon->evas, + 1); +// evas_event_feed_mouse_up(ic->ibar->inst->gcc->gadcon->evas, +// 1, EVAS_BUTTON_NONE, +// ecore_x_current_time_get(), NULL); e_object_ref(E_OBJECT(ic->app)); ic->ibar->icons = evas_list_remove(ic->ibar->icons, ic); _ibar_resize_handle(ic->ibar); @@ -1061,7 +1067,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info) Instance *inst; Evas_Object *o, *o2; IBar_Icon *ic; - int cx, cy, cw, ch; + Evas_Coord xx, yy; ev = event_info; inst = data; @@ -1078,8 +1084,8 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info) evas_object_layer_set(o2, 19999); evas_object_show(o); evas_object_show(o2); - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); - ic = _ibar_icon_at_coord(inst->ibar, ev->x - cx, ev->y - cy); + evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL); + ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy); inst->ibar->ic_drop_before = ic; if (ic) { @@ -1089,11 +1095,11 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info) evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); if (e_box_orientation_get(inst->ibar->o_box)) { - if ((ev->x - cx) < (ix + (iw / 2))) before = 1; + if ((ev->x + xx) < (ix + (iw / 2))) before = 1; } else { - if ((ev->y - cy) < (iy + (ih / 2))) before = 1; + if ((ev->y + yy) < (iy + (ih / 2))) before = 1; } if (before) e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); @@ -1119,13 +1125,13 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info) E_Event_Dnd_Move *ev; Instance *inst; IBar_Icon *ic; - int cx, cy, cw, ch; + Evas_Coord xx, yy; ev = event_info; inst = data; e_box_unpack(inst->ibar->o_drop); - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); - ic = _ibar_icon_at_coord(inst->ibar, ev->x - cx, ev->y - cy); + evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL); + ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy); inst->ibar->ic_drop_before = ic; if (ic) { @@ -1135,11 +1141,11 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info) evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); if (e_box_orientation_get(inst->ibar->o_box)) { - if ((ev->x - cx) < (ix + (iw / 2))) before = 1; + if ((ev->x + xx) < (ix + (iw / 2))) before = 1; } else { - if ((ev->y - cy) < (iy + (ih / 2))) before = 1; + if ((ev->y + yy) < (iy + (ih / 2))) before = 1; } if (before) e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder); diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c index 95e9d897f..ce3f39f47 100644 --- a/src/modules/ibox/e_mod_main.c +++ b/src/modules/ibox/e_mod_main.c @@ -297,8 +297,9 @@ _ibox_cb_empty_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(b->inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(b->inst->gcc->gadcon->evas, ev->button); +// evas_event_feed_mouse_up(b->inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -684,8 +685,10 @@ _ibox_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(ic->ibox->inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(ic->ibox->inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(ic->ibox->inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -738,9 +741,11 @@ _ibox_cb_icon_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info e_drag_resize(d, w, h); e_drag_start(d, ic->drag.x, ic->drag.y); - evas_event_feed_mouse_up(ic->ibox->inst->gcc->gadcon->evas, - 1, EVAS_BUTTON_NONE, - ecore_x_current_time_get(), NULL); + e_util_evas_fake_mouse_up_later(ic->ibox->inst->gcc->gadcon->evas, + 1); +// evas_event_feed_mouse_up(ic->ibox->inst->gcc->gadcon->evas, +// 1, EVAS_BUTTON_NONE, +// ecore_x_current_time_get(), NULL); e_object_ref(E_OBJECT(ic->border)); ic->ibox->icons = evas_list_remove(ic->ibox->icons, ic); _ibox_resize_handle(ic->ibox); @@ -813,7 +818,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info) Instance *inst; Evas_Object *o, *o2; IBox_Icon *ic; - int cx, cy, cw, ch; + Evas_Coord xx, yy; ev = event_info; inst = data; @@ -830,8 +835,8 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info) evas_object_layer_set(o2, 19999); evas_object_show(o); evas_object_show(o2); - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); - ic = _ibox_icon_at_coord(inst->ibox, ev->x - cx, ev->y - cy); + evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL); + ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx, ev->y + yy); inst->ibox->ic_drop_before = ic; if (ic) { @@ -841,11 +846,11 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info) evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); if (e_box_orientation_get(inst->ibox->o_box)) { - if ((ev->x - cx) < (ix + (iw / 2))) before = 1; + if ((ev->x + xx) < (ix + (iw / 2))) before = 1; } else { - if ((ev->y - cy) < (iy + (ih / 2))) before = 1; + if ((ev->y + yy) < (iy + (ih / 2))) before = 1; } if (before) e_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder); @@ -871,13 +876,13 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info) E_Event_Dnd_Move *ev; Instance *inst; IBox_Icon *ic; - int cx, cy, cw, ch; + Evas_Coord xx, yy; ev = event_info; inst = data; e_box_unpack(inst->ibox->o_drop); - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); - ic = _ibox_icon_at_coord(inst->ibox, ev->x - cx, ev->y - cy); + evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL); + ic = _ibox_icon_at_coord(inst->ibox, ev->x, ev->y); inst->ibox->ic_drop_before = ic; if (ic) { @@ -887,11 +892,11 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info) evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); if (e_box_orientation_get(inst->ibox->o_box)) { - if ((ev->x - cx) < (ix + (iw / 2))) before = 1; + if ((ev->x + xx) < (ix + (iw / 2))) before = 1; } else { - if ((ev->y - cy) < (iy + (ih / 2))) before = 1; + if ((ev->y + yy) < (iy + (ih / 2))) before = 1; } if (before) e_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder); diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index 82a785e33..a02b6e205 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -632,8 +632,10 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } @@ -1391,9 +1393,11 @@ _pager_window_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_i pw->drag.from_pager = pw->desk->pager; pw->drag.from_pager->dragging = 1; pw->drag.in_pager = 0; - evas_event_feed_mouse_up(evas_object_evas_get(pw->desk->pager->o_table), - pw->drag.button, EVAS_BUTTON_NONE, - ecore_x_current_time_get(), NULL); + e_util_evas_fake_mouse_up_later(evas_object_evas_get(pw->desk->pager->o_table), + pw->drag.button); +// evas_event_feed_mouse_up(evas_object_evas_get(pw->desk->pager->o_table), +// pw->drag.button, EVAS_BUTTON_NONE, +// ecore_x_current_time_get(), NULL); } } } @@ -1470,12 +1474,12 @@ _pager_inst_cb_move(void *data, const char *type, void *event_info) Instance *inst; Pager_Desk *pd, *pd2; Evas_List *l; - int cx, cy, cw, ch; + Evas_Coord xx, yy; ev = event_info; inst = data; - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); - pd = _pager_desk_at_coord(inst->pager, ev->x - cx, ev->y - cy); + evas_object_geometry_get(inst->pager->o_table, &xx, &yy, NULL, NULL); + pd = _pager_desk_at_coord(inst->pager, ev->x + xx, ev->y + yy); /* FIXME: keep track which one its over so we only emit drag in/out * when it actually goes form one desk to another */ for (l = inst->pager->desks; l; l = l->next) @@ -1517,13 +1521,14 @@ _pager_inst_cb_drop(void *data, const char *type, void *event_info) E_Border *bd = NULL; Evas_List *l; int dx = 0, dy = 0; - int cx, cy, cw, ch; Pager_Win *pw = NULL; + Evas_Coord xx, yy; ev = event_info; inst = data; - e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, &cw, &ch); - pd = _pager_desk_at_coord(inst->pager, ev->x - cx, ev->y - cy); + + evas_object_geometry_get(inst->pager->o_table, &xx, &yy, NULL, NULL); + pd = _pager_desk_at_coord(inst->pager, ev->x + xx, ev->y + yy); if (pd) { if (!strcmp(type, "enlightenment/pager_win")) @@ -1558,7 +1563,8 @@ _pager_inst_cb_drop(void *data, const char *type, void *event_info) if ((!pw) || ((pw) && (!pw->drag.no_place))) { e_layout_coord_canvas_to_virtual(pd->o_layout, - ev->x - cx + dx, ev->y - cy + dy, + ev->x + xx + dx, + ev->y + yy + dy, &nx, &ny); e_border_move(bd, nx + pd->desk->zone->x, ny + pd->desk->zone->y); } diff --git a/src/modules/start/e_mod_main.c b/src/modules/start/e_mod_main.c index 4c4627ae8..c273fe209 100644 --- a/src/modules/start/e_mod_main.c +++ b/src/modules/start/e_mod_main.c @@ -197,8 +197,10 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) x, y, w, h, dir, ev->timestamp); edje_object_signal_emit(inst->o_button, "e,state,focused", "e"); - evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } } } diff --git a/src/modules/temperature/e_mod_main.c b/src/modules/temperature/e_mod_main.c index d9efebdca..ad8f53081 100644 --- a/src/modules/temperature/e_mod_main.c +++ b/src/modules/temperature/e_mod_main.c @@ -154,8 +154,10 @@ _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) e_util_zone_current_get(e_manager_current_get()), cx + ev->output.x, cy + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, - EVAS_BUTTON_NONE, ev->timestamp, NULL); + e_util_evas_fake_mouse_up_later(inst->gcc->gadcon->evas, + ev->button); +// evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, +// EVAS_BUTTON_NONE, ev->timestamp, NULL); } }