static void _e_fs_fd_handle(int fd);
static void
-_e_fs_fd_handle_a_la_cK(int fd)
+_e_fs_fd_handle(int fd)
{
- EfsdEvent ev;
- Evas_List l;
+ Evas_List events = NULL;
+ double start, current;
+ printf("############## fs event...\n");
+ start = e_get_time();
while ((ec) && efsd_events_pending(ec))
- {
- ZERO(&ev, EfsdEvent, 1);
+ {
+ EfsdEvent *ev;
+
+ ev = NEW(EfsdEvent, 1);
+ ZERO(ev, EfsdEvent, 1);
- if (efsd_next_event(ec, &ev) >= 0)
+ if (efsd_next_event(ec, ev) >= 0)
{
- for (l = fs_handlers; l; l = l->next)
- {
- void (*func) (EfsdEvent *ev);
-
- func = l->data;
- func(&ev);
- }
+ events = evas_list_append(events, ev);
}
else
{
+ FREE(ev);
efsd_close(ec);
e_del_event_fd(fd);
ec = NULL;
printf("EEEEEEEEEEK efsd went wonky\n");
}
- efsd_event_cleanup(&ev);
+ /* spent more thna 1/20th of a second here.. get out */
+ current = e_get_time();
+ if ((current - start) > 0.05)
+ {
+ printf("fs... too much time spent..\n");
+ break;
+ }
}
-}
-
-static void
-_e_fs_fd_handle(int fd)
-{
- EfsdEvent ev;
- int i = 1;
-
- /* VERY nasty - sicne efas has no way of checkign If an event is in the */
- /* event queue waiting to be picked up - i cant loop and get the events */
- printf("_e_fs_fd_handle(%i)\n", fd);
- while (i >= 0)
+ if (events)
{
- fd_set fdset;
- struct timeval tv;
+ Evas_List l;
- FD_ZERO(&fdset);
- FD_SET(fd, &fdset);
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- select(fd + 1, &fdset, NULL, NULL, &tv);
- if (FD_ISSET(fd, &fdset))
+ for (l = events; l; l = l->next)
{
- i = efsd_next_event(ec, &ev);
- if (i < 0)
- {
- efsd_close(ec);
- e_del_event_fd(fd);
- /* FIXME: need to queue a popup dialog here saying */
- /* efsd went wonky */
- printf("EEEEEEEEEEK efsd went wonky\n");
-/*
- ec = efsd_open();
- if (ec)
- e_add_event_fd(efsd_get_connection_fd(ec),
- _e_fs_fd_handle);
-*/
- }
- if (i >= 0)
+ Evas_List ll;
+ EfsdEvent *ev;
+
+ ev = l->data;
+ for (ll = fs_handlers; ll; ll = ll->next)
{
- Evas_List l;
+ void (*func) (EfsdEvent *ev);
- for (l = fs_handlers; l; l = l->next)
- {
- void (*func) (EfsdEvent *ev);
-
- func = l->data;
- func(&ev);
- }
- efsd_event_cleanup(&ev);
+ func = ll->data;
+ func(ev);
}
+ efsd_event_cleanup(ev);
+ FREE(ev);
}
- else
- i = -1;
+ evas_list_free(events);
}
+ printf("############## fs done\n");
}
void
fprintf(stderr, "efsd is not running - please run efsd.\n");
exit(-1);
}
- e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle_a_la_cK);
+ e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle);
}
EfsdConnection *
}
void
+e_icon_place_grid(E_Icon *icon)
+{
+ int x, y;
+
+ if (icon->view->options.arrange.grid.dir == 0) /* h */
+ {
+ int gw;
+
+ if (icon->view->options.arrange.grid.w > 0)
+ gw = icon->view->size.w / icon->view->options.arrange.grid.w;
+ else gw = 1;
+ y = icon->view->options.arrange.grid.next_pos / gw;
+ x = icon->view->options.arrange.grid.next_pos - (y * gw);
+ x *= icon->view->options.arrange.grid.w;
+ y *= icon->view->options.arrange.grid.h;
+ e_icon_set_xy(icon, x, y);
+ printf("GRID PLACE at %i %i\n", x, y);
+ icon->view->options.arrange.grid.next_pos++;
+ }
+ else /* v */
+ {
+ }
+}
+
+void
+e_icon_pre_show(E_Icon *icon)
+{
+ int x, y;
+
+ if (icon->info.ready) return;
+ printf("*********!!!!!!!!!!!!!!!********* update from e_icon_pre_show()\n");
+ e_icon_update(icon);
+ icon->info.ready = 1;
+ if (icon->info.coord.have)
+ {
+ x = icon->info.coord.x;
+ y = icon->info.coord.y;
+ e_icon_set_xy(icon, x, y);
+ }
+ else
+ {
+ if (icon->view->options.arrange.method == 0) /* grid */
+ {
+ /* need to redo whole grid... */
+ if ((icon->current.w > icon->view->options.arrange.grid.w) ||
+ (icon->current.h > icon->view->options.arrange.grid.h))
+ {
+ Evas_List l;
+
+ icon->view->options.arrange.grid.next_pos = 0;
+ icon->view->options.arrange.grid.w = icon->current.w;
+ icon->view->options.arrange.grid.h = icon->current.h;
+ for (l = icon->view->icons; l; l = l->next)
+ {
+ E_Icon *ic;
+
+ ic = l->data;
+ if (ic->info.ready)
+ e_icon_place_grid(ic);
+ }
+ }
+ else
+ e_icon_place_grid(icon);
+ }
+ }
+ e_icon_show(icon);
+}
+
+void
e_icon_calulcate_geometry(E_Icon *icon)
{
+ int iw, ih, tw, th;
+ double dtw, dth;
+
if (!icon->view) return;
+ dtw = 0; dth = 0; iw = 0; ih = 0;
+ evas_get_geometry(icon->view->evas, icon->obj.filename, NULL, NULL, &dtw, &dth);
+ tw = (int)dtw;
+ th = (int)dth;
+ evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
+ if (tw < iw)
+ {
+ icon->current.ix = icon->current.x;
+ icon->current.iy = icon->current.y;
+ icon->current.tx = icon->current.x + ((iw - tw) / 2);
+ icon->current.ty = icon->current.y + ih;
+ icon->current.w = iw;
+ icon->current.h = ih + th;
+ icon->current.iw = iw;
+ icon->current.ih = ih;
+ icon->current.tw = tw;
+ icon->current.th = th;
+ }
+ else
+ {
+ icon->current.ix = icon->current.x + ((tw - iw) / 2);
+ icon->current.iy = icon->current.y;
+ icon->current.tx = icon->current.x;
+ icon->current.ty = icon->current.y + ih;
+ icon->current.w = tw;
+ icon->current.h = ih + th;
+ icon->current.iw = iw;
+ icon->current.ih = ih;
+ icon->current.tw = tw;
+ icon->current.th = th;
+ }
}
void
{
icon->obj.sel1 = evas_add_rectangle(icon->view->evas);
icon->obj.sel2 = evas_add_rectangle(icon->view->evas);
- evas_set_layer(icon->view->evas, icon->obj.sel1, 11);
- evas_set_layer(icon->view->evas, icon->obj.sel2, 11);
evas_set_color(icon->view->evas, icon->obj.sel1, 0, 0, 0, 0);
evas_set_color(icon->view->evas, icon->obj.sel2, 0, 0, 0, 0);
+ evas_set_layer(icon->view->evas, icon->obj.sel1, 11);
+ evas_set_layer(icon->view->evas, icon->obj.sel2, 11);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_IN, e_icon_in_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_OUT, e_icon_out_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, icon);
e_icon_set_filename(E_Icon *icon, char *file)
{
IF_FREE(icon->file);
- printf("e_icon_set_filename(%s)\n", file);
icon->file = strdup(file);
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
int obj_new = 0;
if (!icon->changed) return;
+ printf("icon (%s).. update\n", icon->file);
if (icon->current.state.clicked)
{
if (icon->info.icon.clicked)
}
if ((!icon->current.state.selected) && (icon->obj.sel_icon))
{
- printf("no\n");
ebits_hide(icon->obj.sel_icon);
ebits_free(icon->obj.sel_icon);
icon->obj.sel_icon = NULL;
}
- if (icon->obj.icon)
+ if ((icon->obj.icon) &&
+ (icon->current.icon) &&
+ ((!icon->previous.icon) ||
+ ((icon->previous.icon) &&
+ (!strcmp(icon->current.icon, icon->previous.icon)))))
{
int iw, ih;
+ printf("set file etc.\n");
evas_set_image_file(icon->view->evas, icon->obj.icon, icon->current.icon);
evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
evas_set_image_fill(icon->view->evas, icon->obj.icon, 0, 0, iw, ih);
}
}
if ((icon->previous.x != icon->current.x) ||
- (icon->previous.y != icon->current.y))
+ (icon->previous.y != icon->current.y) ||
+ (icon->current.visible != icon->previous.visible) ||
+ (obj_new))
{
- int fx, fy;
- int iw, ih;
- double tw, th;
-
- evas_get_geometry(icon->view->evas, icon->obj.filename, NULL, NULL, &tw, &th);
- evas_get_image_size(icon->view->evas, icon->obj.icon, &iw, &ih);
- fx = icon->current.x + ((iw - tw) / 2);
- fy = icon->current.y + ih;
- evas_move(icon->view->evas, icon->obj.icon, icon->current.x, icon->current.y);
- evas_move(icon->view->evas, icon->obj.filename, fx, fy);
- evas_move(icon->view->evas, icon->obj.sel1, icon->current.x, icon->current.y);
- evas_resize(icon->view->evas, icon->obj.sel1, iw, ih);
- evas_move(icon->view->evas, icon->obj.sel2, fx, fy);
- evas_resize(icon->view->evas, icon->obj.sel2, tw, th);
+ e_icon_calulcate_geometry(icon);
+/* HRRRM - must optimize this*/
+ evas_move(icon->view->evas, icon->obj.icon, icon->current.ix, icon->current.iy);
+ evas_move(icon->view->evas, icon->obj.filename, icon->current.tx, icon->current.ty);
+ evas_move(icon->view->evas, icon->obj.sel1, icon->current.ix, icon->current.iy);
+ evas_resize(icon->view->evas, icon->obj.sel1, icon->current.iw, icon->current.ih);
+ evas_move(icon->view->evas, icon->obj.sel2, icon->current.tx, icon->current.ty);
+ evas_resize(icon->view->evas, icon->obj.sel2, icon->current.tw, icon->current.th);
evas_set_color(icon->view->evas, icon->obj.filename, 0, 0, 0, 255);
- if (icon->obj.sel_icon)
+/**/ if (icon->obj.sel_icon)
{
int pl, pr, pt, pb;
pl = pr = pt = pb = 0;
ebits_get_insets(icon->obj.sel_icon, &pl, &pr, &pt, &pb);
- ebits_move(icon->obj.sel_icon, icon->current.x - pl, icon->current.y - pt);
- ebits_resize(icon->obj.sel_icon, iw + pl + pr, ih + pt + pb);
+ ebits_move(icon->obj.sel_icon, icon->current.ix - pl, icon->current.iy - pt);
+ ebits_resize(icon->obj.sel_icon, icon->current.iw + pl + pr, icon->current.ih + pt + pb);
}
}
- if (icon->current.visible)
+ if (icon->current.visible != icon->previous.visible)
{
- evas_show(icon->view->evas, icon->obj.icon);
- evas_show(icon->view->evas, icon->obj.filename);
- evas_show(icon->view->evas, icon->obj.sel1);
- evas_show(icon->view->evas, icon->obj.sel2);
- if (icon->obj.sel_icon) ebits_show(icon->obj.sel_icon);
- }
- else
- {
- evas_hide(icon->view->evas, icon->obj.icon);
- evas_hide(icon->view->evas, icon->obj.filename);
- evas_hide(icon->view->evas, icon->obj.sel1);
- evas_hide(icon->view->evas, icon->obj.sel2);
- if (icon->obj.sel_icon) ebits_hide(icon->obj.sel_icon);
+ if (icon->current.visible)
+ {
+ evas_show(icon->view->evas, icon->obj.icon);
+ evas_show(icon->view->evas, icon->obj.filename);
+ evas_show(icon->view->evas, icon->obj.sel1);
+ evas_show(icon->view->evas, icon->obj.sel2);
+ if (icon->obj.sel_icon) ebits_show(icon->obj.sel_icon);
+ }
+ else
+ {
+ evas_hide(icon->view->evas, icon->obj.icon);
+ evas_hide(icon->view->evas, icon->obj.filename);
+ evas_hide(icon->view->evas, icon->obj.sel1);
+ evas_hide(icon->view->evas, icon->obj.sel2);
+ if (icon->obj.sel_icon) ebits_hide(icon->obj.sel_icon);
+ }
}
icon->previous = icon->current;
icon->changed = 0;
+ printf("... done\n");
}
if (!e_view_filter_file(v, file)) return;
icon = e_icon_new();
e_icon_set_filename(icon, file);
- e_icon_set_xy(icon, rand()%(v->size.w - 60), rand()%(v->size.h - 60));
- e_icon_show(icon);
e_view_add_icon(v, icon);
sprintf(buf, "%s/%s", v->dir, file);
if (efsd_ready(e_fs_get_connection()))
}
else
{
- printf("Efsd not ready.\n");
+ printf("*********** EEEEEEEEEEEEEEEEEK Efsd not ready.\n");
}
v->changed = 1;
}
}
icon->changed = 1;
icon->view->changed = 1;
- if (!icon->info.link_get_id) icon->info.ready = 1;
+ if (!icon->info.link_get_id)
+ e_icon_pre_show(icon);
}
}
break;
memcpy(icon->info.link, (char*)ev->efsd_reply_event.data, ev->efsd_reply_event.data_len);
icon->info.link[ev->efsd_reply_event.data_len] = 0;
icon->info.link_get_id = 0;
- if (!icon->info.link_get_id) icon->info.ready = 1;
+ if (!icon->info.link_get_id)
+ e_icon_pre_show(icon);
icon->changed = 1;
icon->view->changed = 1;
printf("link_to = %s\n", icon->info.link);
#endif
#endif
views = evas_list_append(views, v);
-
+
+ /*
{
E_Shelf *sh;
e_shelf_resize(sh, 500, 350);
v->shelves = evas_list_append(v->shelves, sh);
}
-
+ */
return v;
}
e_icon_realize(icon);
v->changed = 1;
v->icons = evas_list_append(v->icons, icon);
- e_shelf_add_icon(v->shelves->data, icon);
+/* e_shelf_add_icon(v->shelves->data, icon); */
}
void
e_view_del_icon(E_View *v, E_Icon *icon)
{
if (!icon->view) return;
- e_shelf_del_icon(v->shelves->data, icon);
+/* e_shelf_del_icon(v->shelves->data, icon); */
e_icon_unrealize(icon);
OBJ_UNREF(icon);
icon->view = NULL;
image_cache,
font_dir);
v->win.main = evas_get_window(v->evas);
+ evas_event_move(v->evas, -999999, -999999);
e_add_child(v->win.base, v->win.main);
if (v->options.back_pixmap)
{
{
Evas_List l;
+ printf("view update\n");
if (v->changed)
{
for (l = v->icons; l; l = l->next)
e_icon_update(icon);
}
}
+ printf("done\n");
if (v->options.back_pixmap)
{
Imlib_Updates up;