fix dnd for desktop - if you have multiple zones! remove printf's too. lots

of noisiness in e.



SVN revision: 36103
This commit is contained in:
Carsten Haitzler 2008-09-19 23:58:07 +00:00
parent d0a7731bbb
commit 2d9dd3ea37
3 changed files with 21 additions and 64 deletions

View File

@ -241,7 +241,6 @@ e_drag_move(E_Drag *drag, int x, int y)
drag->x = x;
drag->y = y;
drag->xy_update = 1;
// printf("DND MOVE %i %i\n", x, y);
}
EAPI void
@ -335,7 +334,7 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y)
drag->dx = x - drag->x;
drag->dy = y - drag->y;
ecore_x_dnd_aware_set(_drag_win, 1);
ecore_x_dnd_types_set(_drag_win, drag->types, drag->num_types);
ecore_x_dnd_actions_set(_drag_win, actions, 5);
@ -502,7 +501,6 @@ e_drag_idler_before(void)
}
if (drag->xy_update)
{
// printf("DND REAL MOVE\n");
ecore_evas_move(drag->ecore_evas, drag->x, drag->y);
e_container_shape_move(drag->shape, drag->x, drag->y);
drag->xy_update = 0;
@ -587,7 +585,6 @@ _e_drag_move(E_Drag *drag, int x, int y)
drag->x = x - drag->dx;
drag->y = y - drag->dy;
drag->xy_update = 1;
// printf("DND MOVE 2 %i %i\n", x, y);
}
static void
@ -615,8 +612,8 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
py = ((E_Win *)(h->obj))->y;
break;
case E_ZONE_TYPE:
px = ((E_Zone *)(h->obj))->x;
py = ((E_Zone *)(h->obj))->y;
// px = ((E_Zone *)(h->obj))->x;
// py = ((E_Zone *)(h->obj))->y;
break;
case E_BORDER_TYPE:
px = ((E_Border *)(h->obj))->x + ((E_Border *)(h->obj))->fx.x;
@ -633,6 +630,7 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
}
*dx += px;
*dy += py;
printf("T: %x | dx = %i dy = %i\n", h->obj->type, *dx, *dy);
}
static Ecore_X_Window
@ -776,6 +774,7 @@ _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
if (_drag_current)
{
printf("--\n");
for (l = _drop_handlers; l; l = l->next)
{
E_Drop_Handler *h;
@ -792,9 +791,16 @@ _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
move_ev.action = action;
leave_ev.x = x - dx;
leave_ev.y = y - dy;
if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win, 0))
int inside, matches;
inside = E_INSIDE(x, y, dx, dy, dw, dh);
matches = _e_drag_win_matches(h, win, 0);
printf(" inside = %i, matches = %i\n", inside, matches);
if (E_INSIDE(x, y, dx, dy, dw, dh) &&
_e_drag_win_matches(h, win, 0))
{
if(e_drop_handler_responsive_get(h)) responsive = 1;
if (e_drop_handler_responsive_get(h)) responsive = 1;
if (!h->entered)
{
@ -808,6 +814,7 @@ _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
}
else
enter_ev.data = _drag_current->data;
printf("ENTER!\n");
h->cb.enter(h->cb.data, h->active_type, &enter_ev);
}
h->entered = 1;
@ -1223,7 +1230,6 @@ _e_dnd_cb_event_dnd_leave(void *data, int type, void *event)
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
printf("Xdnd leave\n");
leave_ev.x = 0;
leave_ev.y = 0;
@ -1333,7 +1339,6 @@ _e_dnd_cb_event_dnd_finished(void *data, int type, void *event)
Ecore_X_Event_Xdnd_Finished *ev;
ev = event;
printf("Xdnd finished\n");
if (!ev->completed)
return 1;
@ -1360,7 +1365,6 @@ _e_dnd_cb_event_dnd_drop(void *data, int type, void *event)
ev = event;
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
printf("Xdnd drop %x %s\n", ev->win, _xdnd->type);
ecore_x_selection_xdnd_request(ev->win, _xdnd->type);
@ -1381,7 +1385,6 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event)
id = e_util_winid_str_get(ev->win);
if (!evas_hash_find(_drop_win_hash, id)) return 1;
if (ev->selection != ECORE_X_SELECTION_XDND) return 1;
printf("Xdnd selection\n");
if (!strcmp("text/uri-list", _xdnd->type))
{
@ -1390,7 +1393,7 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event)
files = ev->data;
for (i = 0; i < files->num_files; i++)
l = evas_list_append(l, files->files[i]), printf("file: %s\n", files->files[i]);
l = evas_list_append(l, files->files[i]);
_xdnd->data = l;
_e_drag_xdnd_end(ev->win, _xdnd->x, _xdnd->y);
evas_list_free(l);
@ -1425,9 +1428,9 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event)
}
*/
}
printf("\n");
// printf("\n");
file[i] = '\0';
printf("file: %d \"%s\"\n", i, file);
// printf("file: %d \"%s\"\n", i, file);
l = evas_list_append(l, file);
_xdnd->data = l;

View File

@ -471,7 +471,6 @@ _e_fm2_cb_mount_fail(void *data)
/* FIXME; some dialog */
if (sd->mount)
{
printf("UM1\n");
e_fm2_hal_unmount(sd->mount);
sd->mount = NULL;
evas_object_smart_callback_call(data, "dir_deleted", NULL);
@ -573,7 +572,6 @@ e_fm2_path_set(Evas_Object *obj, const char *dev, const char *path)
&& strncmp(sd->mount->mount_point, sd->realpath,
strlen(sd->mount->mount_point)))
{
printf("UM2\n");
e_fm2_hal_unmount(sd->mount);
sd->mount = NULL;
}
@ -985,7 +983,8 @@ e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj)
_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);
drop, 3,
sd->x, sd->y, sd->w, sd->h);
e_drop_handler_responsive_set(sd->drop_handler);
}
@ -1726,7 +1725,6 @@ _e_fm2_client_mount(const char *udi, const char *mountpoint)
d = alloca(l);
strcpy(d, udi);
strcpy(d + l1 + 1, mountpoint);
printf("SEND %s %s\n", udi, mountpoint);
return _e_fm_client_send_new(E_FM_OP_MOUNT, (void *)d, l);
}
@ -1744,7 +1742,6 @@ _e_fm2_client_unmount(const char *udi)
strcpy(d, udi);
cl = _e_fm2_client_get();
printf("send UM %s\n", udi);
return _e_fm_client_send_new(E_FM_OP_UNMOUNT, (void *)d, l);
}
@ -2919,8 +2916,6 @@ _e_fm2_icons_place_icon(E_Fm2_Icon *ic)
l = l->next;
if ((ic2 != ic) && (ic2->saved_pos))
{
// printf("REMOVE %p [%s]\n",
// pl->data, ((E_Fm2_Icon *)pl->data)->info.file);
// ic->sd->icons_place = evas_list_remove_list(ic->sd->icons_place, pl);
}
}
@ -3474,7 +3469,6 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf)
* fileman/list_odd/variable
*
*/
// printf("CALC ICON\n");
if ((!ic->sd->config->icon.fixed.w) || (!ic->sd->config->icon.fixed.h))
{
obj = ic->sd->tmp.obj;
@ -3490,7 +3484,6 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf)
"base/theme/fileman",
"icon/variable");
ic->sd->tmp.obj = obj;
// printf("CALC OBJ %p\n", ic->sd->tmp.obj);
}
_e_fm2_icon_label_set(ic, obj);
obj2 = ic->sd->tmp.obj2;
@ -3504,7 +3497,6 @@ _e_fm2_icon_fill(E_Fm2_Icon *ic, E_Fm2_Finfo *finf)
edje_extern_object_max_size_set(obj2, ic->sd->config->icon.icon.w, ic->sd->config->icon.icon.h);
edje_object_part_swallow(obj, "e.swallow.icon", obj2);
edje_object_size_min_calc(obj, &mw, &mh);
// printf("CALC %ix%i\n", mw, mh);
}
ic->w = mw;
ic->h = mh;
@ -3684,7 +3676,6 @@ _e_fm2_icon_realize(E_Fm2_Icon *ic)
if ((selectraise) && (!strcmp(selectraise, "on")))
evas_object_stack_below(ic->obj, ic->sd->drop);
}
// printf("realize %s full = %i\n", ic->info.file, (int)ic->info.removable_full);
if (ic->info.removable_full)
edje_object_signal_emit(ic->obj_icon, "e,state,removable,full", "e");
// else
@ -3862,7 +3853,6 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
if (!desktop) goto error;
// if (desktop->type != EFREET_DESKTOP_TYPE_LINK) goto error;
// printf(" mod time %lli\n", desktop->load_time);
ic->info.removable = 0;
ic->info.removable_full = 0;
if (desktop->name) ic->info.label = evas_stringshare_add(desktop->name);
@ -3882,18 +3872,15 @@ _e_fm2_icon_desktop_load(E_Fm2_Icon *ic)
else if (!strcmp(type, "Removable"))
{
ic->info.removable = 1;
// printf("REMOVABLE %s\n", ic->info.link);
if ((!e_fm2_hal_storage_find(ic->info.link)) &&
(!e_fm2_hal_volume_find(ic->info.link)))
{
// printf("REMOVE IT %s\n", ic->info.file);
_e_fm2_live_file_del(ic->sd->obj, ic->info.file);
efreet_desktop_free(desktop);
goto error;
}
}
type = ecore_hash_get(desktop->x, "X-Enlightenment-Removable-State");
// printf(" rem state type = %s\n", type);
if (type)
{
if (!strcmp(type, "Full"))
@ -4416,7 +4403,6 @@ _e_fm2_dnd_drop_all_show(Evas_Object *obj)
}
if (!sd->drop_all)
{
printf("DISP DROP ALL SHOW\n");
edje_object_signal_emit(sd->overlay, "e,state,drop,start", "e");
sd->drop_all = 1;
}
@ -4434,7 +4420,6 @@ _e_fm2_dnd_drop_all_hide(Evas_Object *obj)
if (!sd) return;
if (sd->drop_all)
{
printf("DISP DROP ALL HIDE\n");
edje_object_signal_emit(sd->overlay, "e,state,drop,stop", "e");
sd->drop_all = 0;
}
@ -4459,7 +4444,6 @@ _e_fm2_dnd_drop_show(E_Fm2_Icon *ic, int after)
{
if (ic->sd->drop_after != -1)
{
printf("DISP DROP ON drop\n");
edje_object_signal_emit(ic->sd->drop_in, "e,state,unselected", "e");
edje_object_signal_emit(ic->sd->drop, "e,state,selected", "e");
ic->sd->drop_in_show = 0;
@ -4467,7 +4451,6 @@ _e_fm2_dnd_drop_show(E_Fm2_Icon *ic, int after)
}
else
{
printf("DISP DROP ON drop_in\n");
edje_object_signal_emit(ic->sd->drop, "e,state,unselected", "e");
edje_object_signal_emit(ic->sd->drop_in, "e,state,selected", "e");
ic->sd->drop_in_show = 1;
@ -4486,7 +4469,6 @@ _e_fm2_dnd_drop_hide(Evas_Object *obj)
sd = evas_object_smart_data_get(obj);
if (!sd) return;
printf("DISP DROP OFF BOTH\n");
if (sd->drop_show)
{
edje_object_signal_emit(sd->drop, "e,state,unselected", "e");
@ -4534,7 +4516,6 @@ _e_fm2_cb_dnd_enter(void *data, const char *type, void *event)
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);
e_drop_handler_action_set(ev->action);
}
@ -4550,14 +4531,12 @@ _e_fm2_cb_dnd_move(void *data, const char *type, void *event)
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);
e_drop_handler_action_set(ev->action);
for (l = sd->icons; l; l = l->next) /* FIXME: should only walk regions and skip non-visible ones */
{
ic = l->data;
if (E_INSIDE(ev->x, ev->y, ic->x - ic->sd->pos.x, ic->y - ic->sd->pos.y, ic->w, ic->h))
{
printf("OVER %s\n", ic->info.file);
if (ic->drag.dnd) continue;
/* if list view */
if (ic->sd->config->view.mode == E_FM2_VIEW_MODE_LIST)
@ -4574,17 +4553,14 @@ _e_fm2_cb_dnd_move(void *data, const char *type, void *event)
if (ev->y <= (ic->y - ic->sd->pos.y + (ic->h / 4)))
{
_e_fm2_dnd_drop_show(ic, 0);
printf("DDD 0\n");
}
else if (ev->y > (ic->y - ic->sd->pos.y + ((ic->h * 3) / 4)))
{
_e_fm2_dnd_drop_show(ic, 1);
printf("DDD 1\n");
}
else
{
_e_fm2_dnd_drop_show(ic, -1);
printf("DDD -1\n");
}
}
else
@ -4660,7 +4636,6 @@ _e_fm2_cb_dnd_leave(void *data, const char *type, void *event)
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);
_e_fm2_dnd_drop_hide(sd->obj);
_e_fm2_dnd_drop_all_hide(sd->obj);
}
@ -4832,15 +4807,9 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
if (strcmp(type, "text/uri-list")) return;
ev = (E_Event_Dnd_Drop *)event;
printf("DROP: %i %i\n", ev->x, ev->y);
fsel = _e_fm2_uri_path_list_get(ev->data);
isel = _e_fm2_uri_icon_list_get(fsel);
if (!isel) return;
for (l = fsel; l; l = l->next)
{
fl = l->data;
printf(" %s\n", fl);
}
dx = 0; dy = 0;
ox = 0; oy = 0;
for (l = isel; l; l = l->next)
@ -4852,11 +4821,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
oy = ic->y;
dx = (ic->drag.x + ic->x - ic->sd->pos.x);
dy = (ic->drag.y + ic->y - ic->sd->pos.y);
printf("DND offset %i %i | %i %i | %i %i | %i %i\n",
dx, dy,
ic->drag.x, ic->drag.y,
ic->x, ic->y,
ic->sd->pos.x, ic->sd->pos.y);
break;
}
}
@ -4870,7 +4834,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
*/
if (sd->drop_all) /* drop arbitarily into the dir */
{
printf("drop all\n");
/* move file into this fm dir */
for (ll = fsel, il = isel; ll && il; ll = ll->next, il = il->next)
{
@ -4931,7 +4894,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
}
else if (sd->drop_icon) /* inot or before/after an icon */
{
printf("drop on/before/after icon\n");
if (sd->drop_after == -1) /* put into subdir in icon */
{
/* move file into dir that this icon is for */
@ -4943,7 +4905,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
/* move the file into the subdir */
snprintf(buf, sizeof(buf), "%s/%s/%s",
sd->realpath, sd->drop_icon->info.file, ecore_file_file_get(fp));
printf("mv %s %s\n", (char *)fp, buf);
args = _e_fm_string_append_quoted(args, &size, &length, fp);
args = _e_fm_string_append_char(args, &size, &length, ' ');
@ -4967,7 +4928,6 @@ _e_fm2_cb_dnd_drop(void *data, const char *type, void *event)
sd->realpath, ecore_file_file_get(fp));
if (sd->config->view.link_drop)
{
printf("ln -s %s %s\n", (char *)fp, buf);
_e_fm2_client_file_symlink(buf, fp, sd->drop_icon->info.file, sd->drop_after, -9999, -9999, sd->h, sd->h);
}
else
@ -5060,7 +5020,6 @@ _e_fm2_mouse_1_handler(E_Fm2_Icon *ic, int up, Evas_Modifier *modifiers)
else if (evas_key_modifier_is_set(modifiers, "Shift"))
multi_sel = 1;
}
// printf("MOUSE 1 range=%i multi=%i\n", range_sel, multi_sel);
if (ic->sd->config->selection.single)
{
multi_sel = 0;
@ -5200,7 +5159,6 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_inf
{
ic->drag.x = ev->output.x - ic->x - ic->sd->x + ic->sd->pos.x;
ic->drag.y = ev->output.y - ic->y - ic->sd->y + ic->sd->pos.y;
// printf("DX: %i %i\n", ic->drag.x, ic->drag.y);
ic->drag.start = 1;
ic->drag.dnd = 0;
ic->drag.src = 1;
@ -5906,7 +5864,6 @@ _e_fm2_cb_resize_job(void *data)
_e_fm2_regions_populate(sd->obj);
break;
case E_FM2_VIEW_MODE_CUSTOM_ICONS:
printf("CUSTOM ICONRESIZE HANDLE\n");
if (sd->config->view.fit_custom_pos)
{
for (l = sd->icons; l; l = l->next)
@ -5938,7 +5895,6 @@ _e_fm2_cb_resize_job(void *data)
_e_fm2_regions_populate(sd->obj);
break;
case E_FM2_VIEW_MODE_LIST:
// printf("LIST RESIZE HANDLE\n");
if (sd->iconlist_changed)
{
for (l = sd->icons; l; l = l->next)
@ -6200,7 +6156,6 @@ _e_fm2_smart_del(Evas_Object *obj)
if (sd->path) evas_stringshare_del(sd->path);
if (sd->mount)
{
printf("UM3\n");
e_fm2_hal_unmount(sd->mount);
sd->mount = NULL;
}
@ -7767,7 +7722,6 @@ _e_fm2_cb_live_idler(void *data)
_e_fm2_cb_live_timer(data);
if ((sd->order_file) || (sd->config->view.always_order))
{
printf("refresh from .order\n");
e_fm2_refresh(data);
}
sd->live.idler = NULL;

View File

@ -184,7 +184,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i
{
e_drop_xdnd_register_set(es->zone->container->bg_win, 1);
e_gadcon_xdnd_window_set(es->gadcon, es->zone->container->bg_win);
e_gadcon_dnd_window_set(es->gadcon, es->zone->container->event_win);
e_gadcon_dnd_window_set(es->gadcon, es->zone->container->bg_win);
}
e_gadcon_util_menu_attach_func_set(es->gadcon,
_e_shelf_cb_menu_items_append, es);