work on fixing up the desktop code...... :)


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 22 years ago
parent 5a524ed26c
commit d59543dbc2
  1. BIN
      data/config/appearance/default/selections/file.bits.db
  2. BIN
      data/icons/archive/default.db
  3. 0
      data/icons/archive/gnu-zip-unix.db
  4. BIN
      data/icons/document/pdf.db
  5. 3
      src/config.c
  6. 166
      src/e.h
  7. 10
      src/fs.c
  8. 556
      src/icons.c
  9. 316
      src/shelf.c
  10. 6
      src/util.c
  11. 1736
      src/view.c

Binary file not shown.

Binary file not shown.

@ -19,6 +19,7 @@ static char cfg_borders_db[4096] = "";
static char cfg_apps_menu_db[4096] = "";
static char cfg_menus_dir[4096] = "";
static char cfg_entries_dir[4096] = "";
static char cfg_selections_dir[4096] = "";
static char cfg_user_dir[4096] = "";
static char cfg_images_dir[4096] = "";
static char cfg_fonts_dir[4096] = "";
@ -55,6 +56,8 @@ e_config_get(char *type)
PACKAGE_DATA_DIR"/data/config/appearance/default/menus/");
E_CONF("entries", cfg_entries_dir,
PACKAGE_DATA_DIR"/data/config/appearance/default/entries/");
E_CONF("selections", cfg_selections_dir,
PACKAGE_DATA_DIR"/data/config/appearance/default/selections/");
E_CONF("images", cfg_images_dir,
PACKAGE_DATA_DIR"/data/images/");
E_CONF("fonts", cfg_fonts_dir,

@ -104,9 +104,8 @@ _e_obj->e_obj_free = (void *) _e_obj_free_func; \
(y < (yy + hh)) && \
((x + w) > xx) && \
((y + h) > yy))
#define SPANS_COMMON(x1, w1, x2, w2) \
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define UN(_blah) _blah = 0
#define ACT_MOUSE_IN 0
@ -328,22 +327,8 @@ struct _E_View
struct {
Evas_Render_Method render_method;
int back_pixmap;
struct {
int method;
struct {
int dir;
int w, h;
int next_pos;
} grid;
} arrange;
} options;
struct {
struct {
int left, right, top, bottom;
} inset, icon, spacing;
} spacing;
Evas evas;
struct {
Window base;
@ -353,22 +338,68 @@ struct _E_View
struct {
int w, h;
} size;
struct {
int x, y;
} viewport;
struct {
int x, y;
} location;
struct {
Evas_Object obj_rect;
Evas_Object obj_l1;
Evas_Object obj_l2;
Evas_Object obj_l3;
Evas_Object obj_l4;
int on;
int start_x, start_y;
int x, y, w, h;
} selection;
/* +-----------------+
* | Wt |
* | +-----------+ |
* |Wl| |Wr|
* | | [I] Is | |
* | | Ig | |
* | | [txt] | |
* | | Ib | |
* | +-----------+ |
* | Wb |
* +-----------------+
*/
struct {
int l, r, t, b;
} window;
struct {
int s, g, b;
} icon;
} spacing;
struct {
int on;
int x, y, w, h;
struct {
int x, y;
} down;
struct {
struct {
int r, g, b, a;
}
edge_l, edge_r, edge_t, edge_b,
middle,
grad_l, grad_r, grad_t, grad_b;
struct {
int l, r, t, b;
} grad_size;
} config;
struct {
Evas_Object clip;
Evas_Object edge_l;
Evas_Object edge_r;
Evas_Object edge_t;
Evas_Object edge_b;
Evas_Object middle;
Evas_Object grad_l;
Evas_Object grad_r;
Evas_Object grad_t;
Evas_Object grad_b;
} obj;
} select;
struct {
int started;
Window win;
int x, y;
struct {
int x, y;
} offset;
int update;
} drag;
Evas_Object obj_bg;
@ -380,7 +411,9 @@ struct _E_View
E_FS_Restarter *restarter;
Evas_List icons;
Evas_List shelves;
int have_resort_queued;
int sel_count;
int changed;
};
@ -393,56 +426,49 @@ struct _E_Icon
E_View *view;
char *shelf_name;
E_Shelf *shelf;
struct {
struct {
char *base, *type;
} mime;
EfsdCmdId link_get_id;
char *icon;
char *custom_icon;
char *link;
int is_exe;
int is_dir;
struct {
char *normal;
char *selected;
char *clicked;
} icon;
struct {
int have;
int x, y;
} coord;
int ready;
char *base;
char *type;
} mime;
} info;
struct {
int x, y;
int ix, iy, tx, ty, iw, ih, tw, th, w, h;
struct {
int text_location;
int show_text;
int show_icon;
} options;
Evas_Object icon;
Evas_Object text;
Evas_Object event1;
Evas_Object event2;
struct {
int clicked;
int selected;
int hilited;
} state;
char *icon;
int visible;
int viewable;
} current, previous;
struct {
Ebits_Object icon;
Ebits_Object text;
} over, under;
} sel;
} obj;
struct {
Evas_Object icon;
Evas_Object filename;
Evas_Object sel1, sel2;
Ebits_Object sel_icon;
Ebits_Object sel_text;
Ebits_Object base_icon;
Ebits_Object base_text;
} obj;
int hilited;
int clicked;
int selected;
int running;
int disabled;
int visible;
int just_selected;
} state;
struct {
int x, y, w, h;
struct {
int w, h;
} icon;
struct {
int w, h;
} text;
} geom;
int changed;
};

@ -79,7 +79,7 @@ static void
_e_fs_restarter(int val, void *data)
{
if (ec) return;
printf("%i\n", efsd_pid);
printf("_e_fs_restarter %i\n", efsd_pid);
if (val > 0)
{
if (efsd_pid <= 0)
@ -92,6 +92,7 @@ _e_fs_restarter(int val, void *data)
Evas_List l;
printf("connect!\n");
e_add_event_fd(efsd_get_connection_fd(ec), _e_fs_fd_handle);
for (l = fs_restart_handlers; l; l = l->next)
{
E_FS_Restarter *rs;
@ -146,18 +147,23 @@ e_fs_init(void)
e_event_filter_handler_add(EV_CHILD, e_fs_child_handle);
/* already have an efsd around? */
printf("try efsd initial open...\n");
ec = efsd_open();
/* no - efsd around */
if (!ec)
{
/* start efsd */
printf("start efsd...\n");
efsd_pid = e_exec_run("efsd -f");
if (efsd_pid > 0)
{
for (i = 0; (!ec) && (i < 4); i++)
ec = efsd_open();
for (i = 0; (!ec) && (i < 15); i++)
{
sleep(1);
printf("try efsd open %i...\n", i, ec);
ec = efsd_open();
printf("(connection ptr: %p)\n", ec);
}
}
}

@ -1,557 +1 @@
#include "e.h"
static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void
e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Icon *icon;
icon = _data;
icon->current.state.hilited = 1;
icon->changed = 1;
icon->view->changed = 1;
}
static void
e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Icon *icon;
icon = _data;
icon->current.state.hilited = 0;
icon->changed = 1;
icon->view->changed = 1;
}
static void
e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Icon *icon;
Ev_Mouse_Down *ev;
Eevent *event;
event = e_view_get_current_event();
ev = event->event;
icon = _data;
if (ev->triple_click)
{
printf("triple\n");
}
else if (ev->double_click)
{
printf("double\n");
}
else
{
printf("up\n");
}
if (icon->current.state.selected)
icon->current.state.selected = 0;
else
icon->current.state.selected = 1;
icon->current.state.clicked = 1;
icon->changed = 1;
icon->view->changed = 1;
}
static void
e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Icon *icon;
Ev_Mouse_Up *ev;
Eevent *event;
event = e_view_get_current_event();
ev = event->event;
icon = _data;
icon->current.state.clicked = 0;
icon->changed = 1;
icon->view->changed = 1;
}
void
e_icon_free(E_Icon *icon)
{
IF_FREE(icon->file);
IF_FREE(icon->info.icon.normal);
IF_FREE(icon->info.icon.selected);
IF_FREE(icon->info.icon.clicked);
IF_FREE(icon->info.link);
IF_FREE(icon->info.mime.base);
IF_FREE(icon->info.mime.type);
IF_FREE(icon->previous.icon);
FREE(icon);
}
E_Icon *
e_icon_new(void)
{
E_Icon *icon;
icon = NEW(E_Icon, 1);
ZERO(icon, E_Icon, 1);
OBJ_INIT(icon, e_icon_free);
icon->info.icon.normal = strdup(PACKAGE_DATA_DIR"/data/icons/unknown/default.db:/icon/normal");
icon->previous.state.clicked = -1;
return icon;
}
void
e_icon_apply_mime(E_Icon *icon, char *mime)
{
char m1[4096], m2[4096], *p;
strcpy(m1, mime);
p = strchr(m1, '/');
if (p) *p = 0;
p = strchr(mime, '/');
if (p) strcpy(m2, &(p[1]));
else m2[0] = 0;
IF_FREE(icon->info.mime.base);
IF_FREE(icon->info.mime.type);
icon->info.mime.base = strdup(m1);
icon->info.mime.type = strdup(m2);
}
void
e_icon_get_icon(E_Icon *icon)
{
char m1[4096], m2[4096], *p;
int found = 0;
/* errr.. hmm do something useful if its a symlink */
if (icon->info.link)
{
}
sprintf(m1, "%s/data/icons/%s/%s.db",PACKAGE_DATA_DIR,
icon->info.mime.base,
icon->info.mime.type);
if (e_file_exists(m1)) found = 1;
if (!found)
{
strcpy(m2, icon->info.mime.type);
p = strrchr(m2, '/');
while (p)
{
p[0] = 0;
sprintf(m1, "%s/data/icons/%s/%s.db",PACKAGE_DATA_DIR,
icon->info.mime.base, m2);
if (e_file_exists(m1))
{
found = 1;
break;
}
p = strrchr(m2, '/');
}
}
if (!found)
{
sprintf(m1, "%s/data/icons/%s/default.db",PACKAGE_DATA_DIR,
icon->info.mime.base);
if (e_file_exists(m1)) found = 1;
}
if (!found)
{
sprintf(m1, "%s/data/icons/unknown/unknown.db",PACKAGE_DATA_DIR);
if (e_file_exists(m1)) found = 1;
}
if (!found)
{
sprintf(m1, "%s/data/icons/unknown/default.db",PACKAGE_DATA_DIR);
found = 1;
}
printf("%s/%s: %s\n", icon->info.mime.base, icon->info.mime.type, m1);
IF_FREE(icon->info.icon.normal);
IF_FREE(icon->info.icon.selected);
IF_FREE(icon->info.icon.clicked);
sprintf(m2, "%s:/icon/normal", m1);
icon->info.icon.normal = strdup(m2);
sprintf(m2, "%s:/icon/selected", m1);
icon->info.icon.selected = strdup(m2);
sprintf(m2, "%s:/icon/clicked", m1);
icon->info.icon.clicked = strdup(m2);
icon->changed = 1;
icon->view->changed = 1;
}
void
e_icon_place_grid(E_Icon *icon)
{
int x, y;
if (icon->view->options.arrange.grid.dir == 0) /* h */
{
int gw;
int iw, ih;
iw = icon->current.w +
icon->view->spacing.icon.left +
icon->view->spacing.icon.right +
icon->view->spacing.spacing.left +
icon->view->spacing.spacing.right;
ih = icon->current.h +
icon->view->spacing.icon.top +
icon->view->spacing.icon.bottom +
icon->view->spacing.spacing.top +
icon->view->spacing.spacing.bottom;
if (icon->view->options.arrange.grid.w > 0)
gw = (icon->view->size.w -
icon->view->spacing.inset.left -
icon->view->spacing.inset.right) /
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;
x += (icon->view->options.arrange.grid.w -
icon->view->spacing.icon.left -
icon->view->spacing.icon.right -
icon->view->spacing.spacing.left -
icon->view->spacing.spacing.right -
icon->current.w) / 2;
y += (icon->view->options.arrange.grid.h -
icon->view->spacing.icon.top -
icon->view->spacing.icon.bottom -
icon->view->spacing.spacing.top -
icon->view->spacing.spacing.bottom -
icon->current.h);
x -= icon->view->viewport.x;
y -= icon->view->viewport.y;
x += icon->view->spacing.inset.left;
y += icon->view->spacing.inset.top;
x += icon->view->spacing.icon.left + icon->view->spacing.spacing.left;
y += icon->view->spacing.icon.top + icon->view->spacing.spacing.top;
e_icon_set_xy(icon, 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;
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 */
{
int iw, ih;
iw = icon->current.w +
icon->view->spacing.icon.left +
icon->view->spacing.icon.right +
icon->view->spacing.spacing.left +
icon->view->spacing.spacing.right;
ih = icon->current.h +
icon->view->spacing.icon.top +
icon->view->spacing.icon.bottom +
icon->view->spacing.spacing.top +
icon->view->spacing.spacing.bottom;
/* need to redo whole grid... ??? */
if ((iw > icon->view->options.arrange.grid.w) ||
(ih > icon->view->options.arrange.grid.h))
{
Evas_List l;
icon->view->options.arrange.grid.next_pos = 0;
icon->view->options.arrange.grid.w = iw;
icon->view->options.arrange.grid.h = ih;
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 + icon->view->spacing.icon.top + icon->view->spacing.icon.bottom + 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 + icon->view->spacing.icon.top + icon->view->spacing.icon.bottom + 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;
}
if (INTERSECTS(0, 0, icon->view->size.w, icon->view->size.h,
icon->current.x, icon->current.y, icon->current.w, icon->current.h))
icon->current.viewable = 1;
else
icon->current.viewable = 0;
}
void
e_icon_realize(E_Icon *icon)
{
icon->obj.sel1 = evas_add_rectangle(icon->view->evas);
icon->obj.sel2 = evas_add_rectangle(icon->view->evas);
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);
evas_callback_add(icon->view->evas, icon->obj.sel1, CALLBACK_MOUSE_UP, e_icon_up_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_IN, e_icon_in_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_OUT, e_icon_out_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, icon);
evas_callback_add(icon->view->evas, icon->obj.sel2, CALLBACK_MOUSE_UP, e_icon_up_cb, icon);
}
void
e_icon_unrealize(E_Icon *icon)
{
if (icon->obj.icon) evas_del_object(icon->view->evas, icon->obj.icon);
if (icon->obj.filename) evas_del_object(icon->view->evas, icon->obj.filename);
if (icon->obj.sel1) evas_del_object(icon->view->evas, icon->obj.sel1);
if (icon->obj.sel2) evas_del_object(icon->view->evas, icon->obj.sel2);
icon->obj.icon = NULL;
icon->obj.filename = NULL;
icon->obj.sel1 = NULL;
icon->obj.sel2 = NULL;
if (icon->view) icon->view->changed = 1;
}
void
e_icon_set_icon(E_Icon *icon, char *file)
{
IF_FREE(icon->current.icon);
icon->current.icon = strdup(file);
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
}
void
e_icon_show(E_Icon *icon)
{
if (!icon->current.visible)
{
icon->current.visible = 1;
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
}
}
void
e_icon_hide(E_Icon *icon)
{
if (icon->current.visible)
{
icon->current.visible = 0;
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
}
}
void
e_icon_set_xy(E_Icon *icon, int x, int y)
{
icon->current.x = x;
icon->current.y = y;
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
}
void
e_icon_get_xy(E_Icon *icon, int *x, int *y)
{
if (x) *x = icon->current.x;
if (y) *y = icon->current.y;
}
void
e_icon_set_filename(E_Icon *icon, char *file)
{
IF_FREE(icon->file);
icon->file = strdup(file);
icon->changed = 1;
if (icon->view) icon->view->changed = 1;
}
void
e_icon_update(E_Icon *icon)
{
int obj_new = 0;
if (!icon->changed) return;
if (icon->current.state.clicked)
{
if (icon->info.icon.clicked)
icon->current.icon = icon->info.icon.clicked;
else if (icon->info.icon.selected)
icon->current.icon = icon->info.icon.selected;
else
icon->current.icon = icon->info.icon.normal;
}
else if (icon->current.state.selected)
{
if (icon->info.icon.selected)
icon->current.icon = icon->info.icon.selected;
else
icon->current.icon = icon->info.icon.normal;
}
else
{
icon->current.icon = icon->info.icon.normal;
}
if ((!icon->current.state.selected) && (icon->obj.sel_icon))
{
ebits_hide(icon->obj.sel_icon);
ebits_free(icon->obj.sel_icon);
icon->obj.sel_icon = NULL;
}
if (!icon->obj.filename)
{
icon->obj.filename = evas_add_text(icon->view->evas, "borzoib", 8, icon->file);
evas_set_layer(icon->view->evas, icon->obj.filename, 10);
icon->previous.x = icon->current.x - 1;
icon->previous.visible = icon->current.visible - 1;
obj_new = 1;
}
if (((icon->previous.icon) && (icon->current.icon) &&
(strcmp(icon->current.icon, icon->previous.icon))) ||
((!icon->previous.icon) && (icon->current.icon)))
{
int iw, ih;
if (!icon->obj.icon)
{
icon->obj.icon = evas_add_image_from_file(icon->view->evas, icon->current.icon);
evas_set_layer(icon->view->evas, icon->obj.icon, 10);
obj_new = 1;
}
else
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);
evas_resize(icon->view->evas, icon->obj.icon, iw, ih);
icon->previous.x = icon->current.x - 1;
}
if ((!icon->obj.sel_icon) && (icon->current.state.selected))
{
icon->obj.sel_icon = ebits_load(PACKAGE_DATA_DIR"/data/config/appearance/default/selections/file.bits.db");
if (icon->obj.sel_icon)
{
ebits_add_to_evas(icon->obj.sel_icon, icon->view->evas);
ebits_set_layer(icon->obj.sel_icon, 9);
ebits_set_color_class(icon->obj.sel_icon, "Selected BG", 100, 200, 255, 255);
obj_new = 1;
}
}
if (obj_new)
{
if (icon->shelf)
{
E_Shelf *sh;
sh = icon->shelf;
e_shelf_del_icon(sh, icon);
e_shelf_add_icon(sh, icon);
}
}
if ((icon->previous.x != icon->current.x) ||
(icon->previous.y != icon->current.y) ||
(icon->current.visible != icon->previous.visible) ||
(obj_new))
{
e_icon_calulcate_geometry(icon);
if (icon->current.viewable)
{
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)
{
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.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 != icon->previous.visible) || (obj_new) ||
(icon->current.viewable != icon->previous.viewable))
{
if ((icon->current.visible) && (icon->current.viewable))
{
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_FREE(icon->previous.icon);
icon->previous = icon->current;
icon->previous.icon = strdup(icon->current.icon);
icon->changed = 0;
}

@ -1,317 +1 @@
#include "e.h"
static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static int mv_prev_x, mv_prev_y;
static void
e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Shelf *sh;
sh = data;
return;
UN(o);
UN(bt);
UN(ox);
UN(oy);
UN(ow);
UN(oh);
}
static void
e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Shelf *sh;
sh = data;
return;
UN(o);
UN(bt);
UN(ox);
UN(oy);
UN(ow);
UN(oh);
}
static void
e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Shelf *sh;
sh = data;
if (!strcmp(class, "Title_Bar"))
{
mv_prev_x = x;
mv_prev_y = y;
sh->state.moving = 1;
}
if (!strcmp(class, "Resize"))
{
mv_prev_x = x;
mv_prev_y = y;
sh->state.resizing = 1;
}
if (!strcmp(class, "Resize_Horizontal"))
{
mv_prev_x = x;
mv_prev_y = y;
sh->state.resizing = 1;
}
if (!strcmp(class, "Resize_Vertical"))
{
mv_prev_x = x;
mv_prev_y = y;
sh->state.resizing = 1;
}
if (!strcmp(class, "Menu"))
{
}
if (!strcmp(class, "Close"))
{
}
return;
UN(o);
UN(bt);
UN(ox);
UN(oy);
UN(ow);
UN(oh);
}
static void
e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Shelf *sh;
sh = data;
if (sh->state.moving) sh->state.moving = 0;
if (sh->state.resizing) sh->state.resizing = 0;
return;
UN(o);
UN(bt);
UN(ox);
UN(oy);
UN(ow);
UN(oh);
}
static void
e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Shelf *sh;
sh = data;
if (sh->state.moving)
{
e_shelf_move_by(sh, x - mv_prev_x, y - mv_prev_y);
mv_prev_x = x;
mv_prev_y = y;
}
if (sh->state.resizing)
{
if (sh->state.resizing == 1)
{
e_shelf_resize_by(sh, x - mv_prev_x, y - mv_prev_y);
mv_prev_x = x;
mv_prev_y = y;
}
}
return;
UN(o);
UN(bt);
UN(ox);
UN(oy);
UN(ow);
UN(oh);
}
void
e_shelf_free(E_Shelf *sh)
{
IF_FREE(sh->name);
FREE(sh);
}
E_Shelf *
e_shelf_new(void)
{
E_Shelf *sh;
sh = NEW(E_Shelf, 1);
ZERO(sh, E_Shelf, 1);
OBJ_INIT(sh, e_shelf_free);
return sh;
}
void
e_shelf_set_name(E_Shelf *sh, char *name)
{
IF_FREE(sh->name);
sh->name = strdup(name);
}
void
e_shelf_set_view(E_Shelf *sh, E_View *v)
{
sh->view = v;
}
void
e_shelf_realize(E_Shelf *sh)
{
int pl, pr, pt, pb;
sh->bit.border = ebits_load(PACKAGE_DATA_DIR"/data/config/appearance/default/shelves/default.bits.db");
if (sh->bit.border)
{
ebits_add_to_evas(sh->bit.border, sh->view->evas);
ebits_move(sh->bit.border, sh->x, sh->y);
ebits_resize(sh->bit.border, sh->w, sh->h);
ebits_set_layer(sh->bit.border, 5);
if (sh->visible)
ebits_show(sh->bit.border);
#define HOOK_CB(_class) \
ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_IN, e_cb_mouse_in, sh); \
ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_OUT, e_cb_mouse_out, sh); \
ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_DOWN, e_cb_mouse_down, sh); \
ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_UP, e_cb_mouse_up, sh); \
ebits_set_bit_callback(sh->bit.border, _class, CALLBACK_MOUSE_MOVE, e_cb_mouse_move, sh);
HOOK_CB("Title_Bar");
HOOK_CB("Resize");
HOOK_CB("Resize_Horizontal");
HOOK_CB("Resize_Vertical");
HOOK_CB("Close");
HOOK_CB("Iconify");
HOOK_CB("Max_Size");
HOOK_CB("Menu");
}
sh->obj.clipper = evas_add_rectangle(sh->view->evas);
evas_set_layer(sh->view->evas, sh->obj.clipper, 9);
evas_set_color(sh->view->evas, sh->obj.clipper, 255, 255, 255, 255);
pl = pr = pt = pb = 0;
if (sh->bit.border) ebits_get_insets(sh->bit.border, &pl, &pr, &pt, &pb);
evas_move(sh->view->evas, sh->obj.clipper, sh->x + pl, sh->y + pt);
evas_resize(sh->view->evas, sh->obj.clipper, sh->w - pl - pr, sh->h - pt - pb);
if ((sh->visible) && (sh->icon_count > 0))
evas_show(sh->view->evas, sh->obj.clipper);
}
void
e_shelf_show(E_Shelf *sh)
{
if (sh->visible) return;
sh->visible = 1;
}
void
e_shelf_hide(E_Shelf *sh)
{
if (!sh->visible) return;
sh->visible = 0;
}
void
e_shelf_move(E_Shelf *sh, int x, int y)
{
int dx, dy;
dx = x - sh->x;
dy = y - sh->y;
e_shelf_move_by(sh, dx, dy);
}
void
e_shelf_move_by(E_Shelf *sh, int dx, int dy)
{
Evas_List l;
sh->x += dx;
sh->y += dy;
if (sh->bit.border) ebits_move(sh->bit.border, sh->x, sh->y);
if (sh->obj.clipper)
{
int pl, pr, pt, pb;
pl = pr = pt = pb = 0;
if (sh->bit.border) ebits_get_insets(sh->bit.border, &pl, &pr, &pt, &pb);
evas_move(sh->view->evas, sh->obj.clipper, sh->x + pl, sh->y + pt);
printf("move to %i %i\n", sh->x + pl, sh->y + pt);
}
for (l = sh->view->icons; l; l = l->next)
{
E_Icon *icon;
int x, y;
icon = l->data;
if (icon->shelf == sh)
{
e_icon_get_xy(icon, &x, &y);
e_icon_set_xy(icon, x + dx, y + dy);
}
}
}
void
e_shelf_resize(E_Shelf *sh, int w, int h)
{
sh->w = w;
sh->h = h;
if (sh->bit.border) ebits_resize(sh->bit.border, sh->w, sh->h);
if (sh->obj.clipper)
{
int pl, pr, pt, pb;
pl = pr = pt = pb = 0;
if (sh->bit.border) ebits_get_insets(sh->bit.border, &pl, &pr, &pt, &pb);
evas_resize(sh->view->evas, sh->obj.clipper, sh->w - pl - pr, sh->h - pt - pb);
printf("resize to %i %i\n", sh->w - pl - pr, sh->h - pt - pb);
}
}
void
e_shelf_resize_by(E_Shelf *sh, int dw, int dh)
{
e_shelf_resize(sh, sh->w + dw, sh->h + dh);
}
void
e_shelf_add_icon(E_Shelf *sh, E_Icon *icon)
{
if (icon->shelf)
e_shelf_del_icon(icon->shelf, icon);
icon->shelf = sh;
sh->icon_count++;
if (sh->icon_count > 0)
evas_show(sh->view->evas, sh->obj.clipper);
evas_set_clip(sh->view->evas, icon->obj.icon, sh->obj.clipper);
evas_set_clip(sh->view->evas, icon->obj.filename, sh->obj.clipper);
evas_set_clip(sh->view->evas, icon->obj.sel1, sh->obj.clipper);
evas_set_clip(sh->view->evas, icon->obj.sel2, sh->obj.clipper);
if (icon->obj.sel_icon)
ebits_set_clip(icon->obj.sel_icon, sh->obj.clipper);
}
void
e_shelf_del_icon(E_Shelf *sh, E_Icon *icon)
{
if (icon->shelf != sh) return;
icon->shelf = NULL;
if (sh->icon_count <= 0)
evas_hide(sh->view->evas, sh->obj.clipper);
evas_unset_clip(sh->view->evas, icon->obj.icon);
evas_unset_clip(sh->view->evas, icon->obj.filename);
evas_unset_clip(sh->view->evas, icon->obj.sel1);
evas_unset_clip(sh->view->evas, icon->obj.sel2);
if (icon->obj.sel_icon)
ebits_unset_clip(icon->obj.sel_icon);
}

@ -133,14 +133,16 @@ e_glob_matches(char *str, char *glob)
int
e_file_can_exec(struct stat *st)
{
static int have_uid = 0;
static uid_t uid = -1;
static gid_t gid = -1;
int ok;
if (!st) return 0;
ok = 0;
if (uid < 0) uid = getuid();
if (gid < 0) gid = getgid();
if (!have_uid) uid = getuid();
if (!have_uid) gid = getgid();
have_uid = 1;
if (st->st_uid == uid)
{
if (st->st_mode & S_IXUSR) ok = 1;

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save