fix annoying redraw bug (finally) and hide it under an indent run ;)

SVN revision: 6016
This commit is contained in:
Till Adam 2002-03-03 10:40:07 +00:00
parent fdb0dbc708
commit e752aabcd1
79 changed files with 11626 additions and 10259 deletions

14
src/.indent.pro vendored Normal file
View File

@ -0,0 +1,14 @@
-i3
-bl
-bad
-nbap
-sob
-ncdb
-di20
-nbc
-lp
-nce
-npcs
-sc
-ncs
-l80

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,8 @@ typedef enum e_action_type
ACT_MOUSE_MOVE, ACT_MOUSE_MOVE,
ACT_KEY_DOWN, ACT_KEY_DOWN,
ACT_KEY_UP ACT_KEY_UP
} E_Action_Type; }
E_Action_Type;
struct _E_Active_Action_Timer struct _E_Active_Action_Timer
{ {
@ -44,12 +45,15 @@ struct _E_Action
int grabbed; int grabbed;
}; };
typedef void (*E_Action_Start_Func)(E_Object *o, E_Action *a, typedef void (*E_Action_Start_Func) (E_Object * o, E_Action * a,
void *data, int x, int y, int rx, int ry); void *data, int x, int y, int rx,
typedef void (*E_Action_Cont_Func) (E_Object *o, E_Action *a, int ry);
void *data, int x, int y, int rx, int ry, int dx, int dy); typedef void (*E_Action_Cont_Func) (E_Object * o, E_Action * a,
typedef void (*E_Action_Stop_Func) (E_Object *o, E_Action *a, void *data, int x, int y, int rx,
void *data, int x, int y, int rx, int ry); int ry, int dx, int dy);
typedef void (*E_Action_Stop_Func) (E_Object * o, E_Action * a,
void *data, int x, int y, int rx,
int ry);
struct _E_Action_Impl struct _E_Action_Impl
{ {
@ -62,7 +66,6 @@ struct _E_Action_Impl
E_Action_Stop_Func func_stop; E_Action_Stop_Func func_stop;
}; };
/** /**
* e_action_init - Actions implementation initializer * e_action_init - Actions implementation initializer
* *
@ -71,21 +74,27 @@ struct _E_Action_Impl
*/ */
void e_action_init(void); void e_action_init(void);
int e_action_start(char *action, E_Action_Type act, int button, char *key, int e_action_start(char *action, E_Action_Type act, int button,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data, char *key, Ecore_Event_Key_Modifiers mods,
int x, int y, int rx, int ry); E_Object * o, void *data, int x, int y,
void e_action_stop(char *action, E_Action_Type act, int button, char *key, int rx, int ry);
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data, void e_action_stop(char *action, E_Action_Type act, int button,
int x, int y, int rx, int ry); char *key, Ecore_Event_Key_Modifiers mods,
void e_action_cont(char *action, E_Action_Type act, int button, char *key, E_Object * o, void *data, int x, int y,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data, int rx, int ry);
int x, int y, int rx, int ry, int dx, int dy); void e_action_cont(char *action, E_Action_Type act, int button,
void e_action_stop_by_object(E_Object *o, void *data, int x, int y, int rx, int ry); char *key, Ecore_Event_Key_Modifiers mods,
E_Object * o, void *data, int x, int y,
int rx, int ry, int dx, int dy);
void e_action_stop_by_object(E_Object * o, void *data, int x,
int y, int rx, int ry);
void e_action_stop_by_type(char *action); void e_action_stop_by_type(char *action);
void e_action_add_impl(char *action, E_Action_Start_Func func_start, void e_action_add_impl(char *action,
E_Action_Cont_Func func_cont, E_Action_Stop_Func func_stop); E_Action_Start_Func func_start,
void e_action_del_timer(E_Object *object, char *name); E_Action_Cont_Func func_cont,
void e_action_add_timer(E_Object *object, char *name); E_Action_Stop_Func func_stop);
void e_action_del_timer_object(E_Object *object); void e_action_del_timer(E_Object * object, char *name);
void e_action_add_timer(E_Object * object, char *name);
void e_action_del_timer_object(E_Object * object);
#endif #endif

View File

@ -4,7 +4,7 @@
#include "util.h" #include "util.h"
static void static void
e_background_cleanup(E_Background *bg) e_background_cleanup(E_Background * bg)
{ {
Evas_List l; Evas_List l;
@ -17,15 +17,20 @@ e_background_cleanup(E_Background *bg)
E_Background_Layer *bl; E_Background_Layer *bl;
bl = l->data; bl = l->data;
if (bl->color_class) FREE(bl->color_class); if (bl->color_class)
if (bl->file) FREE(bl->file); FREE(bl->color_class);
if (bl->obj) evas_del_object(bg->evas, bl->obj); if (bl->file)
FREE(bl->file);
if (bl->obj)
evas_del_object(bg->evas, bl->obj);
FREE(bl); FREE(bl);
} }
evas_list_free(bg->layers); evas_list_free(bg->layers);
} }
if (bg->file) FREE (bg->file); if (bg->file)
if (bg->base_obj) evas_del_object(bg->evas, bg->base_obj); FREE(bg->file);
if (bg->base_obj)
evas_del_object(bg->evas, bg->base_obj);
e_object_cleanup(E_OBJECT(bg)); e_object_cleanup(E_OBJECT(bg));
@ -57,7 +62,8 @@ e_background_load(char *file)
D_ENTER; D_ENTER;
db = e_db_open_read(file); db = e_db_open_read(file);
if (!db) D_RETURN_(NULL); if (!db)
D_RETURN_(NULL);
num = 0; num = 0;
e_db_int_get(db, "/type/bg", &num); e_db_int_get(db, "/type/bg", &num);
if (num != 1) if (num != 1)
@ -79,54 +85,82 @@ e_background_load(char *file)
ZERO(bl, E_Background_Layer, 1); ZERO(bl, E_Background_Layer, 1);
bg->layers = evas_list_append(bg->layers, bl); bg->layers = evas_list_append(bg->layers, bl);
snprintf(buf, PATH_MAX, "/layers/%i/type", i); e_db_int_get(db, buf, (int*)&(bl->type)); snprintf(buf, PATH_MAX, "/layers/%i/type", i);
snprintf(buf, PATH_MAX, "/layers/%i/inlined", i); e_db_int_get(db, buf, &(bl->inlined)); e_db_int_get(db, buf, (int *)&(bl->type));
snprintf(buf, PATH_MAX, "/layers/%i/color_class", i); bl->color_class = e_db_str_get(db, buf); snprintf(buf, PATH_MAX, "/layers/%i/inlined", i);
e_db_int_get(db, buf, &(bl->inlined));
snprintf(buf, PATH_MAX, "/layers/%i/color_class", i);
bl->color_class = e_db_str_get(db, buf);
if (bl->inlined) if (bl->inlined)
{ {
snprintf(buf, PATH_MAX, "%s:/layers/%i/image", file, i); e_strdup(bl->file, buf); snprintf(buf, PATH_MAX, "%s:/layers/%i/image", file, i);
e_strdup(bl->file, buf);
} }
else else
{ {
snprintf(buf, PATH_MAX, "/layers/%i/file", i); bl->file = e_db_str_get(db, buf); snprintf(buf, PATH_MAX, "/layers/%i/file", i);
bl->file = e_db_str_get(db, buf);
} }
snprintf(buf, PATH_MAX, "/layers/%i/scroll.x", i); e_db_float_get(db, buf, &(bl->scroll.x)); snprintf(buf, PATH_MAX, "/layers/%i/scroll.x", i);
snprintf(buf, PATH_MAX, "/layers/%i/scroll.y", i); e_db_float_get(db, buf, &(bl->scroll.y)); e_db_float_get(db, buf, &(bl->scroll.x));
snprintf(buf, PATH_MAX, "/layers/%i/pos.x", i); e_db_float_get(db, buf, &(bl->pos.x)); snprintf(buf, PATH_MAX, "/layers/%i/scroll.y", i);
snprintf(buf, PATH_MAX, "/layers/%i/pos.y", i); e_db_float_get(db, buf, &(bl->pos.y)); e_db_float_get(db, buf, &(bl->scroll.y));
snprintf(buf, PATH_MAX, "/layers/%i/size.w", i); e_db_float_get(db, buf, &(bl->size.w)); snprintf(buf, PATH_MAX, "/layers/%i/pos.x", i);
snprintf(buf, PATH_MAX, "/layers/%i/size.h", i); e_db_float_get(db, buf, &(bl->size.h)); e_db_float_get(db, buf, &(bl->pos.x));
snprintf(buf, PATH_MAX, "/layers/%i/size.orig.w", i); e_db_int_get(db, buf, &(bl->size.orig.w)); snprintf(buf, PATH_MAX, "/layers/%i/pos.y", i);
snprintf(buf, PATH_MAX, "/layers/%i/size.orig.h", i); e_db_int_get(db, buf, &(bl->size.orig.h)); e_db_float_get(db, buf, &(bl->pos.y));
snprintf(buf, PATH_MAX, "/layers/%i/fill.w", i); e_db_float_get(db, buf, &(bl->fill.w)); snprintf(buf, PATH_MAX, "/layers/%i/size.w", i);
snprintf(buf, PATH_MAX, "/layers/%i/fill.h", i); e_db_float_get(db, buf, &(bl->fill.h)); e_db_float_get(db, buf, &(bl->size.w));
snprintf(buf, PATH_MAX, "/layers/%i/fill.orig.w", i); e_db_int_get(db, buf, &(bl->fill.orig.w)); snprintf(buf, PATH_MAX, "/layers/%i/size.h", i);
snprintf(buf, PATH_MAX, "/layers/%i/fill.orig.h", i); e_db_int_get(db, buf, &(bl->fill.orig.h)); e_db_float_get(db, buf, &(bl->size.h));
snprintf(buf, PATH_MAX, "/layers/%i/angle", i); e_db_float_get(db, buf, (float*)&(bl->angle)); snprintf(buf, PATH_MAX, "/layers/%i/size.orig.w", i);
snprintf(buf, PATH_MAX, "/layers/%i/fg.r", i); e_db_int_get(db, buf, &(bl->fg.r)); e_db_int_get(db, buf, &(bl->size.orig.w));
snprintf(buf, PATH_MAX, "/layers/%i/fg.g", i); e_db_int_get(db, buf, &(bl->fg.g)); snprintf(buf, PATH_MAX, "/layers/%i/size.orig.h", i);
snprintf(buf, PATH_MAX, "/layers/%i/fg.b", i); e_db_int_get(db, buf, &(bl->fg.b)); e_db_int_get(db, buf, &(bl->size.orig.h));
snprintf(buf, PATH_MAX, "/layers/%i/fg.a", i); e_db_int_get(db, buf, &(bl->fg.a)); snprintf(buf, PATH_MAX, "/layers/%i/fill.w", i);
snprintf(buf, PATH_MAX, "/layers/%i/bg.r", i); e_db_int_get(db, buf, &(bl->bg.r)); e_db_float_get(db, buf, &(bl->fill.w));
snprintf(buf, PATH_MAX, "/layers/%i/bg.g", i); e_db_int_get(db, buf, &(bl->bg.g)); snprintf(buf, PATH_MAX, "/layers/%i/fill.h", i);
snprintf(buf, PATH_MAX, "/layers/%i/bg.b", i); e_db_int_get(db, buf, &(bl->bg.b)); e_db_float_get(db, buf, &(bl->fill.h));
snprintf(buf, PATH_MAX, "/layers/%i/bg.a", i); e_db_int_get(db, buf, &(bl->bg.a)); snprintf(buf, PATH_MAX, "/layers/%i/fill.orig.w", i);
e_db_int_get(db, buf, &(bl->fill.orig.w));
snprintf(buf, PATH_MAX, "/layers/%i/fill.orig.h", i);
e_db_int_get(db, buf, &(bl->fill.orig.h));
snprintf(buf, PATH_MAX, "/layers/%i/angle", i);
e_db_float_get(db, buf, (float *)&(bl->angle));
snprintf(buf, PATH_MAX, "/layers/%i/fg.r", i);
e_db_int_get(db, buf, &(bl->fg.r));
snprintf(buf, PATH_MAX, "/layers/%i/fg.g", i);
e_db_int_get(db, buf, &(bl->fg.g));
snprintf(buf, PATH_MAX, "/layers/%i/fg.b", i);
e_db_int_get(db, buf, &(bl->fg.b));
snprintf(buf, PATH_MAX, "/layers/%i/fg.a", i);
e_db_int_get(db, buf, &(bl->fg.a));
snprintf(buf, PATH_MAX, "/layers/%i/bg.r", i);
e_db_int_get(db, buf, &(bl->bg.r));
snprintf(buf, PATH_MAX, "/layers/%i/bg.g", i);
e_db_int_get(db, buf, &(bl->bg.g));
snprintf(buf, PATH_MAX, "/layers/%i/bg.b", i);
e_db_int_get(db, buf, &(bl->bg.b));
snprintf(buf, PATH_MAX, "/layers/%i/bg.a", i);
e_db_int_get(db, buf, &(bl->bg.a));
} }
e_db_close(db); e_db_close(db);
D_RETURN_(bg); D_RETURN_(bg);
} }
void void
e_background_realize(E_Background *bg, Evas evas) e_background_realize(E_Background * bg, Evas evas)
{ {
Evas_List l; Evas_List l;
int ww, hh, count; int ww, hh, count;
D_ENTER; D_ENTER;
if (bg->evas) D_RETURN; if (bg->evas)
D_RETURN;
bg->evas = evas; bg->evas = evas;
if (!bg->evas) D_RETURN; if (!bg->evas)
D_RETURN;
for (count = 0, l = bg->layers; l; l = l->next, count++) for (count = 0, l = bg->layers; l; l = l->next, count++)
{ {
E_Background_Layer *bl; E_Background_Layer *bl;
@ -167,16 +201,18 @@ e_background_realize(E_Background *bg, Evas evas)
} }
void void
e_background_set_scroll(E_Background *bg, int sx, int sy) e_background_set_scroll(E_Background * bg, int sx, int sy)
{ {
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
if ((bg->geom.sx == sx) && (bg->geom.sy == sy)) D_RETURN; if ((bg->geom.sx == sx) && (bg->geom.sy == sy))
D_RETURN;
bg->geom.sx = sx; bg->geom.sx = sx;
bg->geom.sy = sy; bg->geom.sy = sy;
if (!bg->evas) D_RETURN; if (!bg->evas)
D_RETURN;
for (l = bg->layers; l; l = l->next) for (l = bg->layers; l; l = l->next)
{ {
E_Background_Layer *bl; E_Background_Layer *bl;
@ -194,13 +230,14 @@ e_background_set_scroll(E_Background *bg, int sx, int sy)
} }
void void
e_background_set_size(E_Background *bg, int w, int h) e_background_set_size(E_Background * bg, int w, int h)
{ {
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
if ((bg->geom.w == w) && (bg->geom.h == h)) D_RETURN; if ((bg->geom.w == w) && (bg->geom.h == h))
D_RETURN;
bg->geom.w = w; bg->geom.w = w;
bg->geom.h = h; bg->geom.h = h;
for (l = bg->layers; l; l = l->next) for (l = bg->layers; l; l = l->next)
@ -212,15 +249,24 @@ e_background_set_size(E_Background *bg, int w, int h)
bl = l->data; bl = l->data;
iw = 0; iw = 0;
ih = 0; ih = 0;
if (bg->evas) evas_get_image_size(bg->evas, bl->obj, &iw, &ih); if (bg->evas)
evas_get_image_size(bg->evas, bl->obj, &iw, &ih);
w = bl->size.w * (double)bg->geom.w; w = bl->size.w * (double)bg->geom.w;
h = bl->size.h * (double)bg->geom.h; h = bl->size.h * (double)bg->geom.h;
if (bl->size.orig.w) w = (double)iw * bl->size.w; if (bl->size.orig.w)
if (bl->size.orig.h) h = (double)ih * bl->size.h; w = (double)iw *bl->size.w;
if (bl->size.orig.h)
h = (double)ih *bl->size.h;
fw = bl->fill.w * w; fw = bl->fill.w * w;
fh = bl->fill.h * h; fh = bl->fill.h * h;
if (bl->fill.orig.w) fw = (double)iw * bl->fill.w; if (bl->fill.orig.w)
if (bl->fill.orig.h) fh = (double)ih * bl->fill.h; fw = (double)iw *bl->fill.w;
if (bl->fill.orig.h)
fh = (double)ih *bl->fill.h;
x = ((double)bg->geom.w - w + 1) * bl->pos.x; x = ((double)bg->geom.w - w + 1) * bl->pos.x;
y = ((double)bg->geom.h - h + 1) * bl->pos.y; y = ((double)bg->geom.h - h + 1) * bl->pos.y;
bl->x = x; bl->x = x;
@ -253,7 +299,8 @@ e_background_set_size(E_Background *bg, int w, int h)
} }
void void
e_background_set_color_class(E_Background *bg, char *cc, int r, int g, int b, int a) e_background_set_color_class(E_Background * bg, char *cc, int r, int g, int b,
int a)
{ {
Evas_List l; Evas_List l;

View File

@ -21,52 +21,63 @@ struct _E_Background
Evas evas; Evas evas;
char *file; char *file;
struct { struct
{
int sx, sy; int sx, sy;
int w, h; int w, h;
} geom; }
geom;
Evas_List layers; Evas_List layers;
Evas_Object base_obj; Evas_Object base_obj;
}; };
struct _E_Background_Layer struct _E_Background_Layer
{ {
E_Background_Type type; E_Background_Type type;
int inlined; int inlined;
struct { struct
{
float x, y; float x, y;
} scroll; }
struct { scroll;
struct
{
float x, y; float x, y;
} pos; }
struct { pos;
struct
{
float w, h; float w, h;
struct { struct
{
int w, h; int w, h;
} orig; }
} size, fill; orig;
}
size , fill;
char *color_class; char *color_class;
char *file; char *file;
double angle; double angle;
struct { struct
{
int r, g, b, a; int r, g, b, a;
} fg, bg; }
fg , bg;
double x, y, w, h, fw, fh; double x, y, w, h, fw, fh;
Evas_Object obj; Evas_Object obj;
}; };
E_Background *e_background_new(void); E_Background *e_background_new(void);
E_Background *e_background_load(char *file); E_Background *e_background_load(char *file);
void e_background_realize(E_Background *bg, Evas evas); void e_background_realize(E_Background * bg, Evas evas);
void e_background_set_scroll(E_Background *bg, int sx, int sy); void e_background_set_scroll(E_Background * bg, int sx, int sy);
void e_background_set_size(E_Background *bg, int w, int h); void e_background_set_size(E_Background * bg, int w, int h);
void e_background_set_color_class(E_Background *bg, char *cc, int r, int g, int b, int a); void e_background_set_color_class(E_Background * bg, char *cc,
int r, int g, int b, int a);
#endif #endif

View File

@ -8,4 +8,3 @@ void e_block_stop(char *name);
int e_block_is_active(char *name); int e_block_is_active(char *name);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -27,38 +27,55 @@ struct _E_Border
{ {
E_Observee obs; E_Observee obs;
struct { struct
{
Window main; Window main;
Window l, r, t, b; Window l, r, t, b;
Window input; Window input;
Window container; Window container;
Window client; Window client;
} win; }
struct { win;
struct
{
Evas l, r, t, b; Evas l, r, t, b;
} evas; }
struct { evas;
struct { struct
{
struct
{
E_Text *l, *r, *t, *b; E_Text *l, *r, *t, *b;
} title; }
struct { title;
struct
{
Evas_Object l, r, t, b; Evas_Object l, r, t, b;
} title_clip; }
} obj; title_clip;
struct { }
obj;
struct
{
Pixmap l, r, t, b; Pixmap l, r, t, b;
} pixmap; }
struct { pixmap;
struct
{
int new; int new;
Ebits_Object l, r, t, b; Ebits_Object l, r, t, b;
} bits; }
bits;
struct { struct
struct { {
struct
{
int x, y, w, h; int x, y, w, h;
int visible; int visible;
int dx, dy; int dx, dy;
} requested; }
requested;
int x, y, w, h; int x, y, w, h;
int visible; int visible;
int selected; int selected;
@ -67,13 +84,17 @@ struct _E_Border
int has_shape; int has_shape;
int shape_changes; int shape_changes;
int shaped_client; int shaped_client;
} current, previous; }
current , previous;
struct { struct
struct { {
struct
{
int w, h; int w, h;
double aspect; double aspect;
} base, min, max, step; }
base , min, max, step;
int layer; int layer;
char *title; char *title;
char *name; char *name;
@ -97,67 +118,96 @@ struct _E_Border
int is_desktop; int is_desktop;
int w, h; int w, h;
int no_place; int no_place;
struct { struct
{
int launch_id; int launch_id;
pid_t pid; pid_t pid;
pid_t ppid; pid_t ppid;
uid_t user; uid_t user;
} e; }
struct { e;
struct
{
int requested; int requested;
int x, y; int x, y;
int gravity; int gravity;
} pos; }
pos;
int desk; int desk;
struct { struct
{
int x, y; int x, y;
} area; }
area;
int internal; int internal;
struct { struct
{
int matched; int matched;
struct { struct
{
int matched; int matched;
int ignore; int ignore;
} prog_location; }
struct { prog_location;
struct
{
int matched; int matched;
char *style; char *style;
} border; }
struct { border;
struct
{
int matched; int matched;
int x, y; int x, y;
} location; }
struct { location;
struct
{
int matched; int matched;
int x, y; int x, y;
} desk_area; }
struct { desk_area;
struct
{
int matched; int matched;
int w, h; int w, h;
} size; }
struct { size;
struct
{
int matched; int matched;
int desk; int desk;
} desktop; }
struct { desktop;
struct
{
int matched; int matched;
int sticky; int sticky;
} sticky; }
struct { sticky;
struct
{
int matched; int matched;
int layer; int layer;
} layer; }
} matched; layer;
} client; }
matched;
}
client;
struct { struct
{
int move, resize; int move, resize;
} mode; }
mode;
struct { struct
{
int x, y, w, h; int x, y, w, h;
int is; int is;
} max; }
max;
int ignore_unmap; int ignore_unmap;
int shape_changed; int shape_changed;
@ -190,36 +240,37 @@ void e_border_init(void);
E_Border *e_border_new(void); E_Border *e_border_new(void);
void e_border_update_borders(void); void e_border_update_borders(void);
void e_border_apply_border(E_Border *b); void e_border_apply_border(E_Border * b);
void e_border_reshape(E_Border *b); void e_border_reshape(E_Border * b);
void e_border_release(E_Border *b); void e_border_release(E_Border * b);
E_Border *e_border_adopt(Window win, int use_client_pos); E_Border *e_border_adopt(Window win, int use_client_pos);
void e_border_adopt_children(Window win); void e_border_adopt_children(Window win);
void e_border_remove_mouse_grabs(E_Border *b); void e_border_remove_mouse_grabs(E_Border * b);
void e_border_remove_click_grab(E_Border *b); void e_border_remove_click_grab(E_Border * b);
void e_border_attach_mouse_grabs(E_Border *b); void e_border_attach_mouse_grabs(E_Border * b);
void e_border_remove_all_mouse_grabs(void); void e_border_remove_all_mouse_grabs(void);
void e_border_attach_all_mouse_grabs(void); void e_border_attach_all_mouse_grabs(void);
void e_border_redo_grabs(void); void e_border_redo_grabs(void);
E_Border *e_border_find_by_window(Window win); E_Border *e_border_find_by_window(Window win);
void e_border_set_bits(E_Border *b, char *file); void e_border_set_bits(E_Border * b, char *file);
void e_border_set_color_class(E_Border *b, char *class, int rr, int gg, int bb, int aa); void e_border_set_color_class(E_Border * b, char *class, int rr,
void e_border_adjust_limits(E_Border *b); int gg, int bb, int aa);
void e_border_update(E_Border *b); void e_border_adjust_limits(E_Border * b);
void e_border_set_layer(E_Border *b, int layer); void e_border_update(E_Border * b);
void e_border_raise(E_Border *b); void e_border_set_layer(E_Border * b, int layer);
void e_border_lower(E_Border *b); void e_border_raise(E_Border * b);
void e_border_iconify(E_Border *b); void e_border_lower(E_Border * b);
void e_border_uniconify(E_Border *b); void e_border_iconify(E_Border * b);
void e_border_raise_above(E_Border *b, E_Border *above); void e_border_uniconify(E_Border * b);
void e_border_lower_below(E_Border *b, E_Border *below); void e_border_raise_above(E_Border * b, E_Border * above);
void e_border_lower_below(E_Border * b, E_Border * below);
E_Border *e_border_current_focused(void); E_Border *e_border_current_focused(void);
void e_border_focus_grab_ended(void); void e_border_focus_grab_ended(void);
void e_border_raise_next(void); void e_border_raise_next(void);
void e_border_send_pointer(E_Border *b); void e_border_send_pointer(E_Border * b);
int e_border_viewable(E_Border *b); int e_border_viewable(E_Border * b);
void e_border_print_pos(char *buf, E_Border *b); void e_border_print_pos(char *buf, E_Border * b);
void e_border_print_size(char *buf, E_Border *b); void e_border_print_size(char *buf, E_Border * b);
void e_border_set_gravity(E_Border *b, int gravity); void e_border_set_gravity(E_Border * b, int gravity);
Evas_List e_border_get_borders_list(); Evas_List e_border_get_borders_list();
#endif #endif

View File

@ -6,23 +6,41 @@
#include "icccm.h" #include "icccm.h"
#include "bordermenu.h" #include "bordermenu.h"
static void e_bordermenu_cb_close(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_close(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_kill(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_bordermenu_cb_raise(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_kill(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_lower(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_bordermenu_cb_sticky(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_raise(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_iconify(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_bordermenu_cb_max(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_lower(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_zoom(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_bordermenu_cb_remember_location(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_sticky(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_remember_size(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_bordermenu_cb_remember_desktop(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_iconify(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_remember_sticky(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_bordermenu_cb_remember_prog_location_ignore(E_Menu *m, E_Menu_Item *mi, void *data); static void e_bordermenu_cb_max(E_Menu * m, E_Menu_Item * mi,
static void e_bordermenu_cb_menu_hide(E_Menu *m, void *data); void *data);
static void e_bordermenu_cb_zoom(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_remember_location(E_Menu * m,
E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_remember_size(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_remember_desktop(E_Menu * m,
E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_remember_sticky(E_Menu * m,
E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_remember_prog_location_ignore(E_Menu * m,
E_Menu_Item *
mi,
void *data);
static void e_bordermenu_cb_menu_hide(E_Menu * m, void *data);
static void static void
e_bordermenu_cb_close(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_close(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -30,7 +48,8 @@ e_bordermenu_cb_close(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (b->win.client) e_icccm_delete(b->win.client); if (b->win.client)
e_icccm_delete(b->win.client);
D_RETURN; D_RETURN;
UN(m); UN(m);
@ -38,7 +57,7 @@ e_bordermenu_cb_close(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_kill(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_kill(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -46,7 +65,8 @@ e_bordermenu_cb_kill(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (b->win.client) ecore_window_kill_client(b->win.client); if (b->win.client)
ecore_window_kill_client(b->win.client);
D_RETURN; D_RETURN;
UN(m); UN(m);
@ -54,7 +74,7 @@ e_bordermenu_cb_kill(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_raise(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_raise(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -70,7 +90,7 @@ e_bordermenu_cb_raise(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_lower(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_lower(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -86,7 +106,7 @@ e_bordermenu_cb_lower(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_sticky(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_sticky(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -94,8 +114,10 @@ e_bordermenu_cb_sticky(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
b->client.sticky = mi->on; b->client.sticky = mi->on;
@ -107,7 +129,7 @@ e_bordermenu_cb_sticky(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_iconify(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_iconify(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -121,7 +143,7 @@ e_bordermenu_cb_iconify(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_max(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_max(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -129,14 +151,19 @@ e_bordermenu_cb_max(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (b->client.is_desktop) D_RETURN; if (b->client.is_desktop)
if (b->current.shaded > 0) D_RETURN; D_RETURN;
if ((b->mode.move) || (b->mode.resize)) D_RETURN; if (b->current.shaded > 0)
D_RETURN;
if ((b->mode.move) || (b->mode.resize))
D_RETURN;
b->mode.move = 0; b->mode.move = 0;
b->mode.resize = 0; b->mode.resize = 0;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
if (mi->on) if (mi->on)
@ -178,7 +205,7 @@ e_bordermenu_cb_max(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_zoom(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_zoom(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -192,7 +219,7 @@ e_bordermenu_cb_zoom(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_remember_location(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_remember_location(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -200,8 +227,10 @@ e_bordermenu_cb_remember_location(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
b->client.matched.matched = 1; b->client.matched.matched = 1;
@ -212,7 +241,7 @@ e_bordermenu_cb_remember_location(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_remember_size(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_remember_size(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -220,8 +249,10 @@ e_bordermenu_cb_remember_size(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
b->client.matched.matched = 1; b->client.matched.matched = 1;
@ -232,7 +263,7 @@ e_bordermenu_cb_remember_size(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_remember_desktop(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_remember_desktop(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -240,8 +271,10 @@ e_bordermenu_cb_remember_desktop(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
b->client.matched.matched = 1; b->client.matched.matched = 1;
@ -252,7 +285,7 @@ e_bordermenu_cb_remember_desktop(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_remember_sticky(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_remember_sticky(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -260,8 +293,10 @@ e_bordermenu_cb_remember_sticky(E_Menu *m, E_Menu_Item *mi, void *data)
b = data; b = data;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
b->client.matched.matched = 1; b->client.matched.matched = 1;
@ -272,7 +307,8 @@ e_bordermenu_cb_remember_sticky(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_bordermenu_cb_remember_prog_location_ignore(E_Menu *m, E_Menu_Item *mi, void *data) e_bordermenu_cb_remember_prog_location_ignore(E_Menu * m, E_Menu_Item * mi,
void *data)
{ {
E_Border *b; E_Border *b;
@ -280,8 +316,10 @@ e_bordermenu_cb_remember_prog_location_ignore(E_Menu *m, E_Menu_Item *mi, void
b = data; b = data;
if (mi->on) e_menu_item_set_state(mi, 0); if (mi->on)
else e_menu_item_set_state(mi, 1); e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi); e_menu_set_state(m, mi);
b->client.matched.matched = 1; b->client.matched.matched = 1;
@ -293,7 +331,7 @@ e_bordermenu_cb_remember_prog_location_ignore(E_Menu *m, E_Menu_Item *mi, void
} }
static void static void
e_bordermenu_cb_menu_hide(E_Menu *m, void *data) e_bordermenu_cb_menu_hide(E_Menu * m, void *data)
{ {
E_Border *b; E_Border *b;
@ -313,7 +351,7 @@ e_bordermenu_cb_menu_hide(E_Menu *m, void *data)
} }
void void
e_bordermenu_do(E_Border *b) e_bordermenu_do(E_Border * b)
{ {
E_Menu *menu; E_Menu *menu;
E_Menu_Item *menuitem; E_Menu_Item *menuitem;
@ -330,8 +368,8 @@ e_bordermenu_do(E_Border *b)
menuitem = e_menu_item_new("Close"); menuitem = e_menu_item_new("Close");
/* e_menu_item_set_icon(menuitem, icon); */ /* e_menu_item_set_icon(menuitem, icon); */
/* e_menu_item_set_scale_icon(menuitem, 1);*/ /* e_menu_item_set_scale_icon(menuitem, 1); */
/* e_menu_item_set_separator(menuitem, 1);*/ /* e_menu_item_set_separator(menuitem, 1); */
e_menu_item_set_callback(menuitem, e_bordermenu_cb_close, b); e_menu_item_set_callback(menuitem, e_bordermenu_cb_close, b);
e_menu_add_item(menu, menuitem); e_menu_add_item(menu, menuitem);
@ -378,7 +416,8 @@ e_bordermenu_do(E_Border *b)
menuitem = e_menu_item_new("Remember Location"); menuitem = e_menu_item_new("Remember Location");
e_menu_item_set_check(menuitem, 1); e_menu_item_set_check(menuitem, 1);
e_menu_item_set_state(menuitem, b->client.matched.location.matched); e_menu_item_set_state(menuitem, b->client.matched.location.matched);
e_menu_item_set_callback(menuitem, e_bordermenu_cb_remember_location, b); e_menu_item_set_callback(menuitem, e_bordermenu_cb_remember_location,
b);
e_menu_add_item(menu, menuitem); e_menu_add_item(menu, menuitem);
e_menu_set_state(menu, menuitem); e_menu_set_state(menu, menuitem);
@ -405,8 +444,11 @@ e_bordermenu_do(E_Border *b)
menuitem = e_menu_item_new("Ignore Program Specified Position"); menuitem = e_menu_item_new("Ignore Program Specified Position");
e_menu_item_set_check(menuitem, 1); e_menu_item_set_check(menuitem, 1);
e_menu_item_set_state(menuitem, b->client.matched.prog_location.matched); e_menu_item_set_state(menuitem,
e_menu_item_set_callback(menuitem, e_bordermenu_cb_remember_prog_location_ignore, b); b->client.matched.prog_location.matched);
e_menu_item_set_callback(menuitem,
e_bordermenu_cb_remember_prog_location_ignore,
b);
e_menu_add_item(menu, menuitem); e_menu_add_item(menu, menuitem);
e_menu_set_state(menu, menuitem); e_menu_set_state(menu, menuitem);
} }
@ -418,16 +460,21 @@ e_bordermenu_do(E_Border *b)
menu = b->menus->data; menu = b->menus->data;
pl = pr = pt = pb = 0; pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb); if (b->bits.t)
ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
crx = b->current.x + pl; crx = b->current.x + pl;
cry = b->current.y + pt; cry = b->current.y + pt;
crw = b->client.w; crw = b->client.w;
crh = b->client.h; crh = b->client.h;
ecore_pointer_xy_get(&mx, &my); ecore_pointer_xy_get(&mx, &my);
if (mx + menu->current.w > crx + crw) mx = crx + crw - menu->current.w; if (mx + menu->current.w > crx + crw)
if (my + menu->current.h > cry + crh) my = cry + crh - menu->current.h; mx = crx + crw - menu->current.w;
if (mx < crx) mx = crx; if (my + menu->current.h > cry + crh)
if (my < cry) my = cry; my = cry + crh - menu->current.h;
if (mx < crx)
mx = crx;
if (my < cry)
my = cry;
e_menu_show_at_mouse(menu, mx, my, CurrentTime); e_menu_show_at_mouse(menu, mx, my, CurrentTime);
} }

View File

@ -3,7 +3,6 @@
#include "e.h" #include "e.h"
void e_bordermenu_do(E_Border *b); void e_bordermenu_do(E_Border * b);
#endif #endif

View File

@ -54,39 +54,28 @@ e_config_get(char *type)
} \ } \
} }
E_CONF("grabs", cfg_grabs_db, E_CONF("grabs", cfg_grabs_db, "%s/behavior/grabs.db", e_config_user_dir());
"%s/behavior/grabs.db", e_config_user_dir());
E_CONF("settings", cfg_settings_db, E_CONF("settings", cfg_settings_db,
"%s/behavior/settings.db", e_config_user_dir()); "%s/behavior/settings.db", e_config_user_dir());
E_CONF("actions", cfg_actions_db, E_CONF("actions", cfg_actions_db,
"%s/behavior/actions.db", e_config_user_dir()); "%s/behavior/actions.db", e_config_user_dir());
E_CONF("apps_menu", cfg_apps_menu_db, E_CONF("apps_menu", cfg_apps_menu_db,
"%s/behavior/apps_menu.db", e_config_user_dir()); "%s/behavior/apps_menu.db", e_config_user_dir());
E_CONF("match", cfg_match_db, E_CONF("match", cfg_match_db, "%s/behavior/match.db", e_config_user_dir());
"%s/behavior/match.db", e_config_user_dir()); E_CONF("borders", cfg_borders_db, PACKAGE_DATA_DIR "/data/borders/");
E_CONF("borders", cfg_borders_db, E_CONF("menus", cfg_menus_dir, PACKAGE_DATA_DIR "/data/menus/");
PACKAGE_DATA_DIR"/data/borders/"); E_CONF("entries", cfg_entries_dir, PACKAGE_DATA_DIR "/data/entries/");
E_CONF("menus", cfg_menus_dir,
PACKAGE_DATA_DIR"/data/menus/");
E_CONF("entries", cfg_entries_dir,
PACKAGE_DATA_DIR"/data/entries/");
E_CONF("selections", cfg_selections_dir, E_CONF("selections", cfg_selections_dir,
PACKAGE_DATA_DIR"/data/selections/"); PACKAGE_DATA_DIR "/data/selections/");
E_CONF("scrollbars", cfg_scrollbars_dir, E_CONF("scrollbars", cfg_scrollbars_dir,
PACKAGE_DATA_DIR"/data/scrollbars/"); PACKAGE_DATA_DIR "/data/scrollbars/");
E_CONF("guides", cfg_guides_dir, E_CONF("guides", cfg_guides_dir, PACKAGE_DATA_DIR "/data/guides/");
PACKAGE_DATA_DIR"/data/guides/"); E_CONF("images", cfg_images_dir, PACKAGE_DATA_DIR "/data/images/");
E_CONF("images", cfg_images_dir, E_CONF("cursors", cfg_cursors_dir, PACKAGE_DATA_DIR "/data/cursors/");
PACKAGE_DATA_DIR"/data/images/");
E_CONF("cursors", cfg_cursors_dir,
PACKAGE_DATA_DIR"/data/cursors/");
E_CONF("backgrounds", cfg_backgrounds_dir, E_CONF("backgrounds", cfg_backgrounds_dir,
PACKAGE_DATA_DIR"/data/backgrounds/"); PACKAGE_DATA_DIR "/data/backgrounds/");
E_CONF("fonts", cfg_fonts_dir, E_CONF("fonts", cfg_fonts_dir, PACKAGE_DATA_DIR "/data/fonts/");
PACKAGE_DATA_DIR"/data/fonts/"); E_CONF("epplets", cfg_epplets_dir, PACKAGE_DATA_DIR "/data/epplets/");
E_CONF("epplets", cfg_epplets_dir,
PACKAGE_DATA_DIR"/data/epplets/");
D_RETURN_(""); D_RETURN_("");
} }
@ -99,26 +88,34 @@ e_config_init(void)
D_ENTER; D_ENTER;
#if 1 /* for now don't do this. i think a cp -r will be needed later anyway */ #if 1 /* for now don't do this. i think a cp -r will be needed later anyway */
if (!e_file_is_dir(e_config_user_dir())) e_file_mkdir(e_config_user_dir()); if (!e_file_is_dir(e_config_user_dir()))
e_file_mkdir(e_config_user_dir());
snprintf(buf, PATH_MAX, "%sappearance", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sappearance", e_config_user_dir());
if (!e_file_is_dir(buf)) e_file_mkdir(buf); if (!e_file_is_dir(buf))
e_file_mkdir(buf);
snprintf(buf, PATH_MAX, "%sappearance/borders", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sappearance/borders", e_config_user_dir());
if (!e_file_is_dir(buf)) e_file_mkdir(buf); if (!e_file_is_dir(buf))
e_file_mkdir(buf);
snprintf(buf, PATH_MAX, "%sbehavior", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sbehavior", e_config_user_dir());
if (!e_file_is_dir(buf)) e_file_mkdir(buf); if (!e_file_is_dir(buf))
e_file_mkdir(buf);
snprintf(buf, PATH_MAX, "%sbehavior/grabs.db", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sbehavior/grabs.db", e_config_user_dir());
if (!e_file_exists(buf)) if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/grabs.db", buf); e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/grabs.db", buf);
snprintf(buf, PATH_MAX, "%sbehavior/settings.db", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sbehavior/settings.db", e_config_user_dir());
if (!e_file_exists(buf)) if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/settings.db", buf); e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/settings.db",
buf);
snprintf(buf, PATH_MAX, "%sbehavior/actions.db", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sbehavior/actions.db", e_config_user_dir());
if (!e_file_exists(buf)) if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/actions.db", buf); e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/actions.db",
buf);
snprintf(buf, PATH_MAX, "%sbehavior/apps_menu.db", e_config_user_dir()); snprintf(buf, PATH_MAX, "%sbehavior/apps_menu.db", e_config_user_dir());
if (!e_file_exists(buf)) if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/apps_menu.db", buf); e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/apps_menu.db",
snprintf(buf, PATH_MAX, "%sappearance/borders/border.bits.db", e_config_user_dir()); buf);
snprintf(buf, PATH_MAX, "%sappearance/borders/border.bits.db",
e_config_user_dir());
#endif #endif
#if 0 #if 0
ts(); ts();
@ -138,8 +135,8 @@ e_config_set_user_dir(char *dir)
cfg_settings_db[0] = 0; cfg_settings_db[0] = 0;
cfg_actions_db[0] = 0; cfg_actions_db[0] = 0;
cfg_borders_db[0] = 0; cfg_borders_db[0] = 0;
cfg_apps_menu_db[0]= 0; cfg_apps_menu_db[0] = 0;
cfg_match_db[0]= 0; cfg_match_db[0] = 0;
cfg_menus_dir[0] = 0; cfg_menus_dir[0] = 0;
cfg_entries_dir[0] = 0; cfg_entries_dir[0] = 0;
cfg_selections_dir[0] = 0; cfg_selections_dir[0] = 0;
@ -161,12 +158,14 @@ e_config_user_dir(void)
{ {
D_ENTER; D_ENTER;
if (cfg_user_dir[0]) D_RETURN_(cfg_user_dir); if (cfg_user_dir[0])
if (cfg_root[0]) D_RETURN_(cfg_root); D_RETURN_(cfg_user_dir);
if (cfg_root[0])
D_RETURN_(cfg_root);
#if 1 /* disabled for now - use system ones only */ #if 1 /* disabled for now - use system ones only */
snprintf(cfg_user_dir, PATH_MAX, "%s/.e/", e_util_get_user_home()); snprintf(cfg_user_dir, PATH_MAX, "%s/.e/", e_util_get_user_home());
#else #else
snprintf(cfg_user_dir, PATH_MAX, PACKAGE_DATA_DIR"/data/config/"); snprintf(cfg_user_dir, PATH_MAX, PACKAGE_DATA_DIR "/data/config/");
#endif #endif
D_RETURN_(cfg_user_dir); D_RETURN_(cfg_user_dir);
@ -177,10 +176,12 @@ typedef struct _e_config_file_entry E_Config_File_Entry;
struct _e_config_file_entry struct _e_config_file_entry
{ {
char *name; char *name;
struct { struct
{
char *path; char *path;
time_t last_mod; time_t last_mod;
} user, system; }
user , system;
Evas_List hash[256]; Evas_List hash[256];
}; };
@ -214,16 +215,10 @@ e_config_val_key_get(char *file, char *key, char *def)
{ {
} }
void void
e_config_type_add_node(E_Config_Base_Type *base, char *prefix, e_config_type_add_node(E_Config_Base_Type * base, char *prefix,
E_Config_Datatype type, E_Config_Base_Type *list_type, E_Config_Datatype type, E_Config_Base_Type * list_type,
int offset, int offset, int def_int, float def_float, char *def_str)
int def_int,
float def_float,
char *def_str)
{ {
E_Config_Node *cfg_node; E_Config_Node *cfg_node;
@ -261,7 +256,7 @@ e_config_type_new(void)
} }
void * void *
e_config_load(char *file, char *prefix, E_Config_Base_Type *type) e_config_load(char *file, char *prefix, E_Config_Base_Type * type)
{ {
E_DB_File *db; E_DB_File *db;
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -270,14 +265,16 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
D_ENTER; D_ENTER;
if (!e_file_exists(file)) D_RETURN_(NULL); if (!e_file_exists(file))
D_RETURN_(NULL);
db = e_db_open_read(file); db = e_db_open_read(file);
if (!db) if (!db)
D_RETURN_(NULL); D_RETURN_(NULL);
data = NEW(char, type->size); data = NEW(char, type->size);
ZERO(data, char , type->size); ZERO(data, char, type->size);
for (l = type->nodes; l; l = l->next) for (l = type->nodes; l; l = l->next)
{ {
E_Config_Node *node; E_Config_Node *node;
@ -306,7 +303,8 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
if ((val = e_db_str_get(db, buf))) if ((val = e_db_str_get(db, buf)))
(*((char **)(&(data[node->offset])))) = val; (*((char **)(&(data[node->offset])))) = val;
else else
e_strdup((*((char **)(&(data[node->offset])))), node->def_str); e_strdup((*((char **)(&(data[node->offset])))),
node->def_str);
} }
break; break;
case E_CFG_TYPE_FLOAT: case E_CFG_TYPE_FLOAT:
@ -334,11 +332,12 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
{ {
void *data2; void *data2;
snprintf(buf, PATH_MAX, "%s/%s/%i", prefix, node->prefix, i); snprintf(buf, PATH_MAX, "%s/%s/%i", prefix, node->prefix,
i);
data2 = e_config_load(file, buf, node->sub_type); data2 = e_config_load(file, buf, node->sub_type);
l2 = evas_list_append(l2, data2); l2 = evas_list_append(l2, data2);
} }
(*((Evas_List *)(&(data[node->offset])))) = l2; (*((Evas_List *) (&(data[node->offset])))) = l2;
} }
break; break;
case E_CFG_TYPE_KEY: case E_CFG_TYPE_KEY:
@ -356,7 +355,6 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
D_RETURN_(data); D_RETURN_(data);
} }
#if 0 #if 0
typedef struct _list_base List_Base; typedef struct _list_base List_Base;
typedef struct _list_element List_Element; typedef struct _list_element List_Element;
@ -374,7 +372,8 @@ struct _list_element
}; };
/* eg: */ /* eg: */
void ts(void) void
ts(void)
{ {
/* define the different config types and structs to the config engine */ /* define the different config types and structs to the config engine */
E_Config_Base_Type *cf_list; E_Config_Base_Type *cf_list;
@ -383,12 +382,16 @@ void ts(void)
D_ENTER; D_ENTER;
cf_element = e_config_type_new(); cf_element = e_config_type_new();
E_CONFIG_NODE(cf_element, "name", E_CFG_TYPE_STR, NULL, List_Element, name, 0, 0, "DEFAULT_NAME"); E_CONFIG_NODE(cf_element, "name", E_CFG_TYPE_STR, NULL, List_Element, name,
E_CONFIG_NODE(cf_element, "size", E_CFG_TYPE_INT, NULL, List_Element, size, 777, 0, NULL); 0, 0, "DEFAULT_NAME");
E_CONFIG_NODE(cf_element, "perc", E_CFG_TYPE_FLOAT, NULL, List_Element, perc, 0, 3.1415, NULL); E_CONFIG_NODE(cf_element, "size", E_CFG_TYPE_INT, NULL, List_Element, size,
777, 0, NULL);
E_CONFIG_NODE(cf_element, "perc", E_CFG_TYPE_FLOAT, NULL, List_Element, perc,
0, 3.1415, NULL);
cf_list = e_config_type_new(); cf_list = e_config_type_new();
E_CONFIG_NODE(cf_list, "list", E_CFG_TYPE_LIST, cf_element, List_Base, elements, 0, 0, NULL); E_CONFIG_NODE(cf_list, "list", E_CFG_TYPE_LIST, cf_element, List_Base,
elements, 0, 0, NULL);
/* now test it */ /* now test it */
{ {

View File

@ -47,12 +47,12 @@ _var.last_fetch = __time;
} }
typedef enum e_config_type typedef enum e_config_type
{ {
E_CFG_INT_T, E_CFG_INT_T,
E_CFG_FLOAT_T, E_CFG_FLOAT_T,
E_CFG_STR_T, E_CFG_STR_T,
E_CFG_DATA_T, E_CFG_DATA_T,
} }
E_Config_Type; E_Config_Type;
#define E_CFG_INT(_var, _src, _key, _default) \ #define E_CFG_INT(_var, _src, _key, _default) \
@ -146,7 +146,6 @@ E_CFG_END_VALIDITY_CHECK \
_val = _var.cur_data_val; \ _val = _var.cur_data_val; \
_size = _var.cur_data_size;} _size = _var.cur_data_size;}
char *e_config_get(char *type); char *e_config_get(char *type);
void e_config_init(void); void e_config_init(void);
void e_config_set_user_dir(char *dir); void e_config_set_user_dir(char *dir);
@ -197,26 +196,25 @@ struct _e_config_node
var->size = sizeof(struct_type); \ var->size = sizeof(struct_type); \
} }
E_Config_Value *e_config_value_get_int(E_Config_Value *handle, char *file, E_Config_Value *e_config_value_get_int(E_Config_Value * handle, char *file,
char *prefix, char *key, char *prefix, char *key,
int *val_ret, int default_val); int *val_ret, int default_val);
E_Config_Value *e_config_value_get_str(E_Config_Value *handle, char *file, E_Config_Value *e_config_value_get_str(E_Config_Value * handle, char *file,
char *prefix, char *key, char *prefix, char *key,
char **val_ret, char *default_val); char **val_ret, char *default_val);
E_Config_Value *e_config_value_get_float(E_Config_Value *handle, char *file, E_Config_Value *e_config_value_get_float(E_Config_Value * handle,
char *prefix, char *key, char *file, char *prefix,
float *val_ret, float default_val); char *key, float *val_ret,
float default_val);
E_Config_Base_Type *e_config_type_new(void); E_Config_Base_Type *e_config_type_new(void);
void e_config_type_add_node(E_Config_Base_Type *base, void e_config_type_add_node(E_Config_Base_Type * base,
char *prefix, char *prefix,
E_Config_Datatype type, E_Config_Datatype type,
E_Config_Base_Type *list_type, E_Config_Base_Type * list_type,
int offset, int offset,
int def_int, int def_int,
float def_float, float def_float, char *def_str);
char *def_str);
void *e_config_load(char *file, void *e_config_load(char *file,
char *prefix, char *prefix, E_Config_Base_Type * type);
E_Config_Base_Type *type);
#endif #endif

View File

@ -20,7 +20,7 @@ static Evas_List cursors = NULL;
static void e_cursors_idle(void *data); static void e_cursors_idle(void *data);
static void e_cursors_set(char *type); static void e_cursors_set(char *type);
static E_Cursor * e_cursors_find(char *type); static E_Cursor *e_cursors_find(char *type);
static void static void
e_cursors_idle(void *data) e_cursors_idle(void *data)
@ -29,14 +29,16 @@ e_cursors_idle(void *data)
D_ENTER; D_ENTER;
if (!cursor_change) D_RETURN; if (!cursor_change)
D_RETURN;
if ((prev_cursor) && (cur_cursor) && (strcmp(prev_cursor, cur_cursor))) if ((prev_cursor) && (cur_cursor) && (strcmp(prev_cursor, cur_cursor)))
change = 1; change = 1;
if ((prev_cursor) && (!cur_cursor)) if ((prev_cursor) && (!cur_cursor))
change = 1; change = 1;
if ((!prev_cursor) && (cur_cursor)) if ((!prev_cursor) && (cur_cursor))
change = 1; change = 1;
if (change) e_cursors_set(cur_cursor); if (change)
e_cursors_set(cur_cursor);
IF_FREE(prev_cursor); IF_FREE(prev_cursor);
e_strdup(prev_cursor, cur_cursor); e_strdup(prev_cursor, cur_cursor);
IF_FREE(cur_cursor); IF_FREE(cur_cursor);
@ -95,7 +97,8 @@ e_cursors_display_in_window(Window win, char *type)
D_ENTER; D_ENTER;
if (!type) type = "Default"; if (!type)
type = "Default";
c = e_cursors_find(type); c = e_cursors_find(type);
if (!c) if (!c)
{ {
@ -117,7 +120,8 @@ e_cursors_display_in_window(Window win, char *type)
c->mod = e_file_mod_time(buf); c->mod = e_file_mod_time(buf);
E_DB_INT_GET(buf, "/cursor/x", hx, ok); E_DB_INT_GET(buf, "/cursor/x", hx, ok);
E_DB_INT_GET(buf, "/cursor/y", hy, ok); E_DB_INT_GET(buf, "/cursor/y", hy, ok);
snprintf(buf, PATH_MAX, "%s/%s.db:/cursor/image", e_config_get("cursors"), type); snprintf(buf, PATH_MAX, "%s/%s.db:/cursor/image",
e_config_get("cursors"), type);
im = imlib_load_image(buf); im = imlib_load_image(buf);
if (im) if (im)
{ {
@ -134,7 +138,8 @@ e_cursors_display_in_window(Window win, char *type)
data = imlib_image_get_data_for_reading_only(); data = imlib_image_get_data_for_reading_only();
/* figure out fg & bg */ /* figure out fg & bg */
if (!data) goto done; if (!data)
goto done;
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
@ -144,8 +149,8 @@ e_cursors_display_in_window(Window win, char *type)
pix = data[(y * w) + x]; pix = data[(y * w) + x];
r = (pix >> 16) & 0xff; r = (pix >> 16) & 0xff;
g = (pix >> 8 ) & 0xff; g = (pix >> 8) & 0xff;
b = (pix ) & 0xff; b = (pix) & 0xff;
a = (pix >> 24) & 0xff; a = (pix >> 24) & 0xff;
if (a > 127) if (a > 127)
@ -186,7 +191,8 @@ e_cursors_display_in_window(Window win, char *type)
/* fill out cursor pixmap with 0's (bg) */ /* fill out cursor pixmap with 0's (bg) */
ecore_fill_rectangle(pmap, gcb, 0, 0, w, h); ecore_fill_rectangle(pmap, gcb, 0, 0, w, h);
ecore_fill_rectangle(mask, gcb, 0, 0, w, h); ecore_fill_rectangle(mask, gcb, 0, 0, w, h);
if (!data) goto done2; if (!data)
goto done2;
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
for (x = 0; x < w; x++) for (x = 0; x < w; x++)
@ -196,8 +202,8 @@ e_cursors_display_in_window(Window win, char *type)
pix = data[(y * w) + x]; pix = data[(y * w) + x];
r = (pix >> 16) & 0xff; r = (pix >> 16) & 0xff;
g = (pix >> 8 ) & 0xff; g = (pix >> 8) & 0xff;
b = (pix ) & 0xff; b = (pix) & 0xff;
a = (pix >> 24) & 0xff; a = (pix >> 24) & 0xff;
if (a > 127) if (a > 127)
@ -224,7 +230,8 @@ e_cursors_display_in_window(Window win, char *type)
} }
if (c) if (c)
{ {
c->cursor = ecore_cursor_new(pmap, mask, hx, hy, fr, fg, fb, br, bg, bb); c->cursor =
ecore_cursor_new(pmap, mask, hx, hy, fr, fg, fb, br, bg, bb);
ecore_pixmap_free(pmap); ecore_pixmap_free(pmap);
ecore_pixmap_free(mask); ecore_pixmap_free(mask);
cursors = evas_list_append(cursors, c); cursors = evas_list_append(cursors, c);
@ -234,7 +241,8 @@ e_cursors_display_in_window(Window win, char *type)
ecore_cursor_set(win, c->cursor); ecore_cursor_set(win, c->cursor);
else else
{ {
if (!strcmp(type, "Default")) D_RETURN; if (!strcmp(type, "Default"))
D_RETURN;
e_cursors_display_in_window(win, "Default"); e_cursors_display_in_window(win, "Default");
} }

View File

@ -8,4 +8,3 @@ void e_cursors_display_in_window(Window win, char *type);
void e_cursors_init(void); void e_cursors_init(void);
#endif #endif

View File

@ -33,7 +33,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "debug.h" #include "debug.h"
static int do_print = 0; static int do_print = 0;
static int calldepth = 0; static int calldepth = 0;
@ -45,19 +44,16 @@ debug_whitespace(int calldepth)
{ {
int i; int i;
for (i = 0; i < 2*calldepth; i++) for (i = 0; i < 2 * calldepth; i++)
printf("-"); printf("-");
} }
static void static void
debug_print_info(void) debug_print_info(void)
{ {
printf("e17 dbg: "); printf("e17 dbg: ");
} }
void void
e_debug_enter(const char *file, const char *func) e_debug_enter(const char *file, const char *func)
{ {
@ -73,7 +69,6 @@ e_debug_enter(const char *file, const char *func)
} }
} }
void void
e_debug_return(const char *file, const char *func) e_debug_return(const char *file, const char *func)
{ {
@ -91,5 +86,3 @@ e_debug_return(const char *file, const char *func)
printf("NEGATIVE!!!\n"); printf("NEGATIVE!!!\n");
} }
} }

View File

@ -65,4 +65,3 @@ void e_debug_return(const char *file, const char *func);
#endif #endif
#endif #endif

View File

@ -3,7 +3,7 @@
#include "delayed.h" #include "delayed.h"
static void static void
e_delayed_action_cleanup(E_Delayed_Action *eda) e_delayed_action_cleanup(E_Delayed_Action * eda)
{ {
D_ENTER; D_ENTER;
@ -13,10 +13,8 @@ e_delayed_action_cleanup(E_Delayed_Action *eda)
D_RETURN; D_RETURN;
} }
E_Delayed_Action * E_Delayed_Action *
e_delayed_action_new(E_Event_Type event, e_delayed_action_new(E_Event_Type event, double delay, E_Delay_Func delay_func)
double delay, E_Delay_Func delay_func)
{ {
E_Delayed_Action *eda = NULL; E_Delayed_Action *eda = NULL;
@ -34,12 +32,11 @@ e_delayed_action_new(E_Event_Type event,
D_RETURN_(eda); D_RETURN_(eda);
} }
void void
e_delayed_action_start(E_Observer *obs, E_Observee *obj, E_Event_Type event) e_delayed_action_start(E_Observer * obs, E_Observee * obj, E_Event_Type event)
{ {
char event_name[PATH_MAX]; char event_name[PATH_MAX];
E_Delayed_Action *eda = (E_Delayed_Action*) obs; E_Delayed_Action *eda = (E_Delayed_Action *) obs;
D_ENTER; D_ENTER;
@ -49,17 +46,16 @@ e_delayed_action_start(E_Observer *obs, E_Observee *obj, E_Event_Type event)
D_RETURN; D_RETURN;
} }
void void
e_delayed_action_cancel(E_Delayed_Action *eda) e_delayed_action_cancel(E_Delayed_Action * eda)
{ {
char event_name[PATH_MAX]; char event_name[PATH_MAX];
D_ENTER; D_ENTER;
snprintf(event_name, PATH_MAX, "_e_delayed_action_notify(%d)", E_OBSERVER(eda)->event); snprintf(event_name, PATH_MAX, "_e_delayed_action_notify(%d)",
E_OBSERVER(eda)->event);
ecore_del_event_timer(event_name); ecore_del_event_timer(event_name);
D_RETURN; D_RETURN;
} }

View File

@ -4,7 +4,7 @@
#include "e.h" #include "e.h"
#include "observer.h" #include "observer.h"
typedef void (*E_Delay_Func)(int val, void *obj); typedef void (*E_Delay_Func) (int val, void *obj);
typedef struct _e_delayed_action typedef struct _e_delayed_action
{ {
@ -13,14 +13,14 @@ typedef struct _e_delayed_action
double delay; double delay;
E_Delay_Func delay_func; E_Delay_Func delay_func;
} E_Delayed_Action; }
E_Delayed_Action;
E_Delayed_Action *e_delayed_action_new(E_Event_Type event, E_Delayed_Action *e_delayed_action_new(E_Event_Type event,
double delay, E_Delay_Func delay_func); double delay, E_Delay_Func delay_func);
void e_delayed_action_start(E_Observer *obs, E_Observee *obj, E_Event_Type event); void e_delayed_action_start(E_Observer * obs, E_Observee * obj,
void e_delayed_action_cancel(E_Delayed_Action *eda); E_Event_Type event);
void e_delayed_action_cancel(E_Delayed_Action * eda);
#endif #endif

View File

@ -54,7 +54,7 @@ e_desktops_init(void)
} }
void void
e_desktops_scroll(E_Desktop *desk, int dx, int dy) e_desktops_scroll(E_Desktop * desk, int dx, int dy)
{ {
Evas_List l; Evas_List l;
int xd, yd, wd, hd; int xd, yd, wd, hd;
@ -63,7 +63,8 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
D_ENTER; D_ENTER;
/* set grav */ /* set grav */
if ((dx ==0) && (dy == 0)) D_RETURN; if ((dx == 0) && (dy == 0))
D_RETURN;
desk->x -= dx; desk->x -= dx;
desk->y -= dy; desk->y -= dy;
xd = yd = wd = hd = 0; xd = yd = wd = hd = 0;
@ -119,8 +120,7 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
grav_stick = StaticGravity; grav_stick = StaticGravity;
/* scroll */ /* scroll */
ecore_window_move_resize(desk->win.container, ecore_window_move_resize(desk->win.container,
xd, yd, xd, yd, screen_w + wd, screen_h + hd);
screen_w + wd, screen_h + hd);
/* reset */ /* reset */
for (l = desk->windows; l; l = l->next) for (l = desk->windows; l; l = l->next)
{ {
@ -159,7 +159,7 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
} }
void void
e_desktops_cleanup(E_Desktop *desk) e_desktops_cleanup(E_Desktop * desk)
{ {
D_ENTER; D_ENTER;
@ -185,7 +185,7 @@ e_desktops_cleanup(E_Desktop *desk)
} }
void void
e_desktops_init_file_display(E_Desktop *desk) e_desktops_init_file_display(E_Desktop * desk)
{ {
E_View *v; E_View *v;
E_Border *b; E_Border *b;
@ -223,7 +223,8 @@ e_desktops_init_file_display(E_Desktop *desk)
b->client.fixed = 1; b->client.fixed = 1;
b->client.is_desktop = 1; b->client.is_desktop = 1;
if (v->options.back_pixmap) e_view_update(v); if (v->options.back_pixmap)
e_view_update(v);
D_RETURN; D_RETURN;
} }
@ -240,8 +241,10 @@ e_desktops_new(void)
e_observee_init(E_OBSERVEE(desk), (E_Cleanup_Func) e_desktops_cleanup); e_observee_init(E_OBSERVEE(desk), (E_Cleanup_Func) e_desktops_cleanup);
desk->win.main = ecore_window_override_new(e_base_win, 0, 0, screen_w, screen_h); desk->win.main =
desk->win.container = ecore_window_override_new(desk->win.main, 0, 0, screen_w, screen_h); ecore_window_override_new(e_base_win, 0, 0, screen_w, screen_h);
desk->win.container =
ecore_window_override_new(desk->win.main, 0, 0, screen_w, screen_h);
ecore_window_lower(desk->win.container); ecore_window_lower(desk->win.container);
ecore_window_show(desk->win.container); ecore_window_show(desk->win.container);
@ -259,11 +262,12 @@ e_desktops_new(void)
} }
void void
e_desktops_add_border(E_Desktop *d, E_Border *b) e_desktops_add_border(E_Desktop * d, E_Border * b)
{ {
D_ENTER; D_ENTER;
if ((!d) || (!b)) D_RETURN; if ((!d) || (!b))
D_RETURN;
b->desk = d; b->desk = d;
b->client.desk = d->desk.desk; b->client.desk = d->desk.desk;
b->client.area.x = d->desk.area.x; b->client.area.x = d->desk.area.x;
@ -274,11 +278,12 @@ e_desktops_add_border(E_Desktop *d, E_Border *b)
} }
void void
e_desktops_del_border(E_Desktop *d, E_Border *b) e_desktops_del_border(E_Desktop * d, E_Border * b)
{ {
D_ENTER; D_ENTER;
if ((!d) || (!b)) D_RETURN; if ((!d) || (!b))
D_RETURN;
d->windows = evas_list_remove(d->windows, b); d->windows = evas_list_remove(d->windows, b);
b->desk = NULL; b->desk = NULL;
@ -286,7 +291,7 @@ e_desktops_del_border(E_Desktop *d, E_Border *b)
} }
void void
e_desktops_delete(E_Desktop *d) e_desktops_delete(E_Desktop * d)
{ {
D_ENTER; D_ENTER;
@ -296,7 +301,7 @@ e_desktops_delete(E_Desktop *d)
} }
void void
e_desktops_show(E_Desktop *d) e_desktops_show(E_Desktop * d)
{ {
D_ENTER; D_ENTER;
@ -306,7 +311,7 @@ e_desktops_show(E_Desktop *d)
} }
void void
e_desktops_hide(E_Desktop *d) e_desktops_hide(E_Desktop * d)
{ {
D_ENTER; D_ENTER;
@ -333,7 +338,7 @@ e_desktops_get(int d)
for (i = 0, l = desktops; l; l = l->next, i++) for (i = 0, l = desktops; l; l = l->next, i++)
{ {
if (i == d) if (i == d)
D_RETURN_((E_Desktop *)l->data); D_RETURN_((E_Desktop *) l->data);
} }
D_RETURN_(NULL); D_RETURN_(NULL);
@ -360,7 +365,6 @@ e_desktops_goto_desk(int d)
e_desktops_goto(d, 0, 0); e_desktops_goto(d, 0, 0);
D_RETURN; D_RETURN;
} }
@ -378,8 +382,8 @@ e_desktops_goto(int d, int ax, int ay)
Evas_List l; Evas_List l;
if ((d == desk->desk.desk) && if ((d == desk->desk.desk) &&
(ax == desk->desk.area.x) && (ax == desk->desk.area.x) && (ay == desk->desk.area.y))
(ay == desk->desk.area.y)) D_RETURN; D_RETURN;
dx = ax - desk->desk.area.x; dx = ax - desk->desk.area.x;
dy = ay - desk->desk.area.y; dy = ay - desk->desk.area.y;
@ -389,7 +393,8 @@ e_desktops_goto(int d, int ax, int ay)
E_Border *b; E_Border *b;
b = l->data; b = l->data;
if ((!b->client.sticky) && (!b->mode.move) && (!b->client.iconified)) if ((!b->client.sticky) && (!b->mode.move)
&& (!b->client.iconified))
{ {
if (b->client.desk != d) if (b->client.desk != d)
{ {
@ -432,4 +437,3 @@ e_desktops_get_desktops_list()
D_ENTER; D_ENTER;
D_RETURN_(desktops); D_RETURN_(desktops);
} }

View File

@ -17,21 +17,29 @@ struct _E_Desktop
char *name; char *name;
char *dir; char *dir;
struct { struct
{
Window main; Window main;
Window container; Window container;
} win; }
win;
int x, y; int x, y;
struct { struct
{
int w, h; int w, h;
} real, virt; }
real , virt;
Evas_List windows; Evas_List windows;
struct { struct
{
int desk; int desk;
struct { struct
{
int x, y; int x, y;
} area; }
} desk; area;
}
desk;
E_View *view; E_View *view;
int changed; int changed;
}; };
@ -46,8 +54,8 @@ struct _E_Desktop
*/ */
void e_desktops_init(void); void e_desktops_init(void);
void e_desktops_scroll(E_Desktop *desk, int dx, int dy); void e_desktops_scroll(E_Desktop * desk, int dx, int dy);
void e_desktops_free(E_Desktop *desk); void e_desktops_free(E_Desktop * desk);
/** /**
* e_desktops_init_file_display - Loads desktop graphics information * e_desktops_init_file_display - Loads desktop graphics information
@ -56,14 +64,14 @@ void e_desktops_free(E_Desktop *desk);
* This function loads the desktop's graphics from the user's desktop * This function loads the desktop's graphics from the user's desktop
* file definition, which lives in ~/.e/desktop/default/.e_background.bg.db. * file definition, which lives in ~/.e/desktop/default/.e_background.bg.db.
*/ */
void e_desktops_init_file_display(E_Desktop *desk); void e_desktops_init_file_display(E_Desktop * desk);
E_Desktop *e_desktops_new(void); E_Desktop *e_desktops_new(void);
void e_desktops_add_border(E_Desktop *d, E_Border *b); void e_desktops_add_border(E_Desktop * d, E_Border * b);
void e_desktops_del_border(E_Desktop *d, E_Border *b); void e_desktops_del_border(E_Desktop * d, E_Border * b);
void e_desktops_delete(E_Desktop *d); void e_desktops_delete(E_Desktop * d);
void e_desktops_show(E_Desktop *d); void e_desktops_show(E_Desktop * d);
void e_desktops_hide(E_Desktop *d); void e_desktops_hide(E_Desktop * d);
/** /**
* e_desktops_get_num - Returns number of desktops. * e_desktops_get_num - Returns number of desktops.

View File

@ -51,7 +51,9 @@ typedef struct _e_prof
char *func; char *func;
double total; double total;
double t1, t2; double t1, t2;
} E_Prof; }
E_Prof;
#define E_PROF_START(_prof_func) \ #define E_PROF_START(_prof_func) \
{ \ { \
E_Prof __p, *__pp; \ E_Prof __p, *__pp; \

View File

@ -13,59 +13,64 @@
#endif #endif
#endif #endif
void e_ferite_init(void) void
e_ferite_init(void)
{ {
D_ENTER; D_ENTER;
D( "Initialising ferite....\n" ); D("Initialising ferite....\n");
ferite_init( 0, NULL ); ferite_init(0, NULL);
D_RETURN; D_RETURN;
} }
void e_ferite_deinit(void) void
e_ferite_deinit(void)
{ {
D_ENTER; D_ENTER;
D( "Deinitialising ferite....\n" ); D("Deinitialising ferite....\n");
ferite_deinit(); ferite_deinit();
D_RETURN; D_RETURN;
} }
int e_ferite_script_error( FeriteScript *script, char *errmsg, int val ) int
e_ferite_script_error(FeriteScript * script, char *errmsg, int val)
{ {
D_ENTER; D_ENTER;
fprintf( stderr, "e17: ferite error: %s\n", errmsg ); fprintf(stderr, "e17: ferite error: %s\n", errmsg);
D_RETURN_(1); D_RETURN_(1);
} }
int e_ferite_script_warning( FeriteScript *script, char *warnmsg ) int
e_ferite_script_warning(FeriteScript * script, char *warnmsg)
{ {
D_ENTER; D_ENTER;
fprintf( stderr, "e17: ferite warning: %s\n", warnmsg ); fprintf(stderr, "e17: ferite warning: %s\n", warnmsg);
D_RETURN_(1); D_RETURN_(1);
} }
void e_ferite_run( char *txt ) void
e_ferite_run(char *txt)
{ {
FeriteScript *script = NULL; FeriteScript *script = NULL;
D_ENTER; D_ENTER;
D("Ferite: Compiling script `%s'\n", txt); D("Ferite: Compiling script `%s'\n", txt);
script = __ferite_compile_string( txt ); script = __ferite_compile_string(txt);
e_ferite_register( script, script->mainns ); e_ferite_register(script, script->mainns);
script->error_cb = e_ferite_script_error; script->error_cb = e_ferite_script_error;
script->warning_cb = e_ferite_script_warning; script->warning_cb = e_ferite_script_warning;
D("Ferite: executing script.\n"); D("Ferite: executing script.\n");
ferite_script_execute( script ); ferite_script_execute(script);
D("Ferite: Cleaning up.\n"); D("Ferite: Cleaning up.\n");
ferite_script_delete( script ); ferite_script_delete(script);
D_RETURN; D_RETURN;
} }

View File

@ -19,9 +19,12 @@
void e_ferite_init(void); void e_ferite_init(void);
void e_ferite_deinit(void); void e_ferite_deinit(void);
void e_ferite_run( char *script ); void e_ferite_run(char *script);
void e_ferite_register( FeriteScript *script, FeriteNamespace *ns ); void e_ferite_register(FeriteScript * script,
int e_ferite_script_error( FeriteScript *script, char *errmsg, int val ); FeriteNamespace * ns);
int e_ferite_script_warning( FeriteScript *script, char *warnmsg ); int e_ferite_script_error(FeriteScript * script, char *errmsg,
int val);
int e_ferite_script_warning(FeriteScript * script,
char *warnmsg);
#endif /* E_FERITE_H */ #endif /* E_FERITE_H */

View File

@ -3,16 +3,15 @@
#include "file.h" #include "file.h"
#include "util.h" #include "util.h"
static void e_file_cleanup (E_File *f); static void e_file_cleanup(E_File * f);
static void static void
e_file_cleanup(E_File *f) e_file_cleanup(E_File * f)
{ {
D_ENTER; D_ENTER;
IF_FREE(f->info.icon); IF_FREE(f->info.icon);
IF_FREE(f->info.link) IF_FREE(f->info.link) IF_FREE(f->info.custom_icon);
IF_FREE(f->info.custom_icon);
IF_FREE(f->info.mime.base); IF_FREE(f->info.mime.base);
IF_FREE(f->info.mime.type); IF_FREE(f->info.mime.type);
IF_FREE(f->file); IF_FREE(f->file);
@ -25,6 +24,7 @@ E_File *
e_file_new(char *file) e_file_new(char *file)
{ {
E_File *f; E_File *f;
D_ENTER; D_ENTER;
if (!file || *file == 0) if (!file || *file == 0)
@ -32,8 +32,7 @@ e_file_new(char *file)
f = NEW(E_File, 1); f = NEW(E_File, 1);
e_object_init(E_OBJECT(f), e_object_init(E_OBJECT(f), (E_Cleanup_Func) e_file_cleanup);
(E_Cleanup_Func) e_file_cleanup);
f->info.icon = NULL; f->info.icon = NULL;
f->info.link = NULL; f->info.link = NULL;
@ -56,9 +55,9 @@ e_file_get_by_name(Evas_List l, char *file)
if (!l || !file || *file == 0) if (!l || !file || *file == 0)
D_RETURN_(NULL); D_RETURN_(NULL);
for (ll=l; ll; ll=ll->next) for (ll = l; ll; ll = ll->next)
{ {
f = (E_File*) ll->data; f = (E_File *) ll->data;
if (!strcmp(file, f->file)) if (!strcmp(file, f->file))
{ {
@ -70,7 +69,7 @@ e_file_get_by_name(Evas_List l, char *file)
} }
void void
e_file_set_mime(E_File *f, char *base, char *mime) e_file_set_mime(E_File * f, char *base, char *mime)
{ {
char icon[PATH_MAX]; char icon[PATH_MAX];
char type[PATH_MAX]; char type[PATH_MAX];
@ -83,9 +82,8 @@ e_file_set_mime(E_File *f, char *base, char *mime)
D("Setting mime: %40s: %s/%s\n", f->file, base, mime); D("Setting mime: %40s: %s/%s\n", f->file, base, mime);
if (((f->info.mime.base) && !(strcmp(f->info.mime.base, base)))
if ( ((f->info.mime.base) && !(strcmp(f->info.mime.base, base))) && ((f->info.mime.type) && !(strcmp(f->info.mime.type, mime))))
&&((f->info.mime.type) && !(strcmp(f->info.mime.type, mime))))
D_RETURN; D_RETURN;
IF_FREE(f->info.mime.base); IF_FREE(f->info.mime.base);
@ -94,7 +92,6 @@ e_file_set_mime(E_File *f, char *base, char *mime)
f->info.mime.base = strdup(base); f->info.mime.base = strdup(base);
f->info.mime.type = strdup(mime); f->info.mime.type = strdup(mime);
/* effect changes here */ /* effect changes here */
/* /*
* if (f->info.custom_icon) * if (f->info.custom_icon)
@ -110,13 +107,14 @@ e_file_set_mime(E_File *f, char *base, char *mime)
/* find an icon */ /* find an icon */
strcpy(type, f->info.mime.type); strcpy(type, f->info.mime.type);
p=type; p = type;
do do
{ {
snprintf(icon, PATH_MAX, "%s/data/icons/%s/%s.db", snprintf(icon, PATH_MAX, "%s/data/icons/%s/%s.db",
PACKAGE_DATA_DIR, f->info.mime.base, type); PACKAGE_DATA_DIR, f->info.mime.base, type);
p = strrchr(type, '/'); p = strrchr(type, '/');
if (p) *p = 0; if (p)
*p = 0;
} }
while (p && !e_file_exists(icon)); while (p && !e_file_exists(icon));
@ -135,7 +133,7 @@ e_file_set_mime(E_File *f, char *base, char *mime)
} }
void void
e_file_set_link(E_File *f, char *link) e_file_set_link(E_File * f, char *link)
{ {
D_ENTER; D_ENTER;

View File

@ -11,20 +11,24 @@ struct _E_File
char *file; char *file;
struct stat stat; struct stat stat;
struct { struct
{
char *icon; char *icon;
char *custom_icon; char *custom_icon;
char *link; char *link;
struct { struct
{
char *base; char *base;
char *type; char *type;
} mime; }
} info; mime;
}
info;
}; };
E_File *e_file_new(char *file); E_File *e_file_new(char *file);
E_File *e_file_get_by_name(Evas_List l, char *file); E_File *e_file_get_by_name(Evas_List l, char *file);
void e_file_set_mime(E_File *f, char *base, char *mime); void e_file_set_mime(E_File * f, char *base, char *mime);
void e_file_set_link(E_File *f, char *link); void e_file_set_link(E_File * f, char *link);
#endif #endif

View File

@ -23,7 +23,7 @@ e_view_machine_init()
} }
void void
e_view_machine_register_view_model (E_View_Model *m) e_view_machine_register_view_model(E_View_Model * m)
{ {
D_ENTER; D_ENTER;
VM->models = evas_list_append(VM->models, m); VM->models = evas_list_append(VM->models, m);
@ -31,7 +31,7 @@ e_view_machine_register_view_model (E_View_Model *m)
} }
void void
e_view_machine_unregister_view_model(E_View_Model *m) e_view_machine_unregister_view_model(E_View_Model * m)
{ {
D_ENTER; D_ENTER;
VM->models = evas_list_remove(VM->models, m); VM->models = evas_list_remove(VM->models, m);
@ -39,7 +39,7 @@ e_view_machine_unregister_view_model(E_View_Model *m)
} }
void void
e_view_machine_register_view(E_View *v) e_view_machine_register_view(E_View * v)
{ {
D_ENTER; D_ENTER;
VM->views = evas_list_append(VM->views, v); VM->views = evas_list_append(VM->views, v);
@ -47,7 +47,7 @@ e_view_machine_register_view(E_View *v)
} }
void void
e_view_machine_unregister_view(E_View *v) e_view_machine_unregister_view(E_View * v)
{ {
D_ENTER; D_ENTER;
VM->views = evas_list_remove(VM->views, v); VM->views = evas_list_remove(VM->views, v);
@ -58,12 +58,14 @@ void
e_view_machine_close_all_views(void) e_view_machine_close_all_views(void)
{ {
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
/* Copy the list of views and unregister them */ /* Copy the list of views and unregister them */
for (l=VM->views;l;l=l->next) for (l = VM->views; l; l = l->next)
{ {
E_View *v = l->data; E_View *v = l->data;
e_object_unref (E_OBJECT(v->model));
e_object_unref(E_OBJECT(v->model));
} }
D_RETURN; D_RETURN;
} }
@ -82,7 +84,7 @@ e_view_machine_model_lookup(char *path)
realpath = e_file_realpath(path); realpath = e_file_realpath(path);
for (l=VM->models; l; l = l->next) for (l = VM->models; l; l = l->next)
{ {
m = l->data; m = l->data;
if (!strcmp(m->dir, realpath)) if (!strcmp(m->dir, realpath))
@ -102,10 +104,12 @@ E_View *
e_view_machine_get_view_by_main_window(Window win) e_view_machine_get_view_by_main_window(Window win)
{ {
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
for (l = VM->views; l; l = l->next) for (l = VM->views; l; l = l->next)
{ {
E_View *v = l->data; E_View *v = l->data;
if (v && win == v->win.main) if (v && win == v->win.main)
D_RETURN_(v); D_RETURN_(v);
} }
@ -116,13 +120,14 @@ E_View *
e_view_machine_get_view_by_base_window(Window win) e_view_machine_get_view_by_base_window(Window win)
{ {
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
for (l = VM->views; l; l = l->next) for (l = VM->views; l; l = l->next)
{ {
E_View *v = l->data; E_View *v = l->data;
if (v && win == v->win.base) if (v && win == v->win.base)
D_RETURN_(v); D_RETURN_(v);
} }
D_RETURN_(NULL); D_RETURN_(NULL);
} }

View File

@ -10,10 +10,10 @@ struct _e_view_machine
typedef struct _e_view_machine E_View_Machine; typedef struct _e_view_machine E_View_Machine;
void e_view_machine_init(void); void e_view_machine_init(void);
void e_view_machine_register_view(E_View *v); void e_view_machine_register_view(E_View * v);
void e_view_machine_unregister_view(E_View *v); void e_view_machine_unregister_view(E_View * v);
void e_view_machine_register_view_model(E_View_Model *m); void e_view_machine_register_view_model(E_View_Model * m);
void e_view_machine_unregister_view_model(E_View_Model *m); void e_view_machine_unregister_view_model(E_View_Model * m);
void e_view_machine_close_all_views(void); void e_view_machine_close_all_views(void);
E_View_Model *e_view_machine_model_lookup(char *path); E_View_Model *e_view_machine_model_lookup(char *path);

View File

@ -9,16 +9,19 @@
#include "globals.h" #include "globals.h"
static void e_view_model_handle_fs_restart(void *data); static void e_view_model_handle_fs_restart(void *data);
static void e_view_model_handle_fs(EfsdEvent *ev); static void e_view_model_handle_fs(EfsdEvent * ev);
static void e_view_model_handle_efsd_event_reply (EfsdEvent *ev); static void e_view_model_handle_efsd_event_reply(EfsdEvent * ev);
static void e_view_model_handle_efsd_event_reply_stat (EfsdEvent *ev); static void e_view_model_handle_efsd_event_reply_stat(EfsdEvent * ev);
static void e_view_model_handle_efsd_event_reply_readlink (EfsdEvent *ev); static void e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *
static void e_view_model_handle_efsd_event_reply_getfiletype (EfsdEvent *ev); ev);
static void e_view_model_handle_efsd_event_reply_getmeta (EfsdEvent *ev); static void e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *
ev);
static void e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *
ev);
static void e_view_model_cleanup(E_View_Model *m); static void e_view_model_cleanup(E_View_Model * m);
static void e_view_model_bg_reload_timeout(int val, void *data); static void e_view_model_bg_reload_timeout(int val, void *data);
static void e_view_model_set_default_background(E_View_Model *m); static void e_view_model_set_default_background(E_View_Model * m);
void void
e_view_model_init(void) e_view_model_init(void)
@ -29,7 +32,7 @@ e_view_model_init(void)
} }
static void static void
e_view_model_cleanup(E_View_Model *m) e_view_model_cleanup(E_View_Model * m)
{ {
D_ENTER; D_ENTER;
@ -49,49 +52,49 @@ e_view_model_cleanup(E_View_Model *m)
} }
E_View_Model * E_View_Model *
e_view_model_new (void) e_view_model_new(void)
{ {
E_View_Model *m; E_View_Model *m;
D_ENTER; D_ENTER;
m = NEW (E_View_Model, 1); m = NEW(E_View_Model, 1);
ZERO(m, E_View_Model, 1); ZERO(m, E_View_Model, 1);
m->dir = NULL; m->dir = NULL;
m->views = NULL; m->views = NULL;
e_object_init(E_OBJECT(m), e_object_init(E_OBJECT(m), (E_Cleanup_Func) e_view_model_cleanup);
(E_Cleanup_Func) e_view_model_cleanup);
e_view_machine_register_view_model(m); e_view_machine_register_view_model(m);
D_RETURN_(m); D_RETURN_(m);
} }
void void
e_view_model_register_view(E_View_Model *m, E_View *v) e_view_model_register_view(E_View_Model * m, E_View * v)
{ {
D_ENTER; D_ENTER;
v->model = m; v->model = m;
m->views = evas_list_append(m->views, v); m->views = evas_list_append(m->views, v);
/* dont ref the first time */ /* dont ref the first time */
if (m->views->next) if (m->views->next)
e_object_ref (E_OBJECT(v->model)); e_object_ref(E_OBJECT(v->model));
D_RETURN; D_RETURN;
} }
void void
e_view_model_unregister_view(E_View *v) e_view_model_unregister_view(E_View * v)
{ {
D_ENTER; D_ENTER;
v->model->views = evas_list_remove(v->model->views, v); v->model->views = evas_list_remove(v->model->views, v);
e_object_unref (E_OBJECT(v->model)); e_object_unref(E_OBJECT(v->model));
D_RETURN; D_RETURN;
} }
static void static void
e_view_model_set_default_background(E_View_Model *m) e_view_model_set_default_background(E_View_Model * m)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
D_ENTER; D_ENTER;
if (!m) if (!m)
@ -107,8 +110,7 @@ e_view_model_set_default_background(E_View_Model *m)
e_strdup(m->bg_file, buf); e_strdup(m->bg_file, buf);
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir); snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5, ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, m);
e_view_model_bg_reload_timeout, 0, m);
D_RETURN; D_RETURN;
} }
@ -124,23 +126,24 @@ e_view_model_handle_fs_restart(void *data)
if (e_fs_get_connection()) if (e_fs_get_connection())
{ {
EfsdOptions *ops; EfsdOptions *ops;
/* FIXME restart with metadata pending for views */ /* FIXME restart with metadata pending for views */
ops = efsd_ops(3, ops = efsd_ops(3,
efsd_op_get_stat(), efsd_op_get_stat(),
efsd_op_get_filetype(), efsd_op_get_filetype(), efsd_op_list_all());
efsd_op_list_all());
m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir, m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir,
ops, TRUE); ops, TRUE);
} }
D("restarted monitor id (connection = %p), %i for %s\n", e_fs_get_connection(), m->monitor_id, m->dir); D("restarted monitor id (connection = %p), %i for %s\n",
e_fs_get_connection(), m->monitor_id, m->dir);
D_RETURN; D_RETURN;
} }
void void
e_view_model_set_dir(E_View_Model *m, char *dir) e_view_model_set_dir(E_View_Model * m, char *dir)
{ {
D_ENTER; D_ENTER;
@ -165,8 +168,7 @@ e_view_model_set_dir(E_View_Model *m, char *dir)
ops = efsd_ops(3, ops = efsd_ops(3,
efsd_op_get_stat(), efsd_op_get_stat(),
efsd_op_get_filetype(), efsd_op_get_filetype(), efsd_op_list_all());
efsd_op_list_all());
m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir, m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir,
ops, TRUE); ops, TRUE);
D("monitor id for %s = %i\n", m->dir, m->monitor_id); D("monitor id for %s = %i\n", m->dir, m->monitor_id);
@ -175,7 +177,7 @@ e_view_model_set_dir(E_View_Model *m, char *dir)
} }
static void static void
e_view_model_handle_fs(EfsdEvent *ev) e_view_model_handle_fs(EfsdEvent * ev)
{ {
D_ENTER; D_ENTER;
@ -214,7 +216,7 @@ e_view_model_handle_fs(EfsdEvent *ev)
} }
break; break;
case EFSD_EVENT_REPLY: case EFSD_EVENT_REPLY:
e_view_model_handle_efsd_event_reply (ev); e_view_model_handle_efsd_event_reply(ev);
break; break;
default: default:
break; break;
@ -222,9 +224,8 @@ e_view_model_handle_fs(EfsdEvent *ev)
D_RETURN; D_RETURN;
} }
static void static void
e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev) e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
{ {
E_File *f; E_File *f;
char *file = NULL; char *file = NULL;
@ -233,6 +234,7 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
char *m, *p; char *m, *p;
char mime[PATH_MAX], base[PATH_MAX]; char mime[PATH_MAX], base[PATH_MAX];
D_ENTER; D_ENTER;
if (!ev) if (!ev)
@ -241,7 +243,7 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
if (!ev->efsd_reply_event.errorcode == 0) if (!ev->efsd_reply_event.errorcode == 0)
D_RETURN; D_RETURN;
if ( (file = efsd_event_filename(ev)) ) if ((file = efsd_event_filename(ev)))
{ {
file = e_file_get_file(file); file = e_file_get_file(file);
} }
@ -249,7 +251,7 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
f = e_file_get_by_name(model->files, file); f = e_file_get_by_name(model->files, file);
/* if its not in the list we care about, its filetype is meaningless */ /* if its not in the list we care about, its filetype is meaningless */
if(!f) if (!f)
D_RETURN; D_RETURN;
m = ev->efsd_reply_event.data; m = ev->efsd_reply_event.data;
@ -268,13 +270,14 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
} }
e_file_set_mime(f, base, mime); e_file_set_mime(f, base, mime);
for (l=model->views;l;l=l->next) for (l = model->views; l; l = l->next)
{ {
E_View *v = (E_View *)l->data; E_View *v = (E_View *) l->data;
E_Icon *ic = e_icon_find_by_file(v, f->file); E_Icon *ic = e_icon_find_by_file(v, f->file);
/* Try to update the GUI. /* Try to update the GUI.
It's just a try because we need to have the file's stat * It's just a try because we need to have the file's stat
info as well. --cK. * info as well. --cK.
*/ */
e_icon_update_state(ic); e_icon_update_state(ic);
e_icon_initial_show(ic); e_icon_initial_show(ic);
@ -283,7 +286,7 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
} }
static void static void
e_view_model_handle_efsd_event_reply_stat(EfsdEvent *ev) e_view_model_handle_efsd_event_reply_stat(EfsdEvent * ev)
{ {
E_View_Model *m; E_View_Model *m;
E_File *f; E_File *f;
@ -300,18 +303,19 @@ e_view_model_handle_efsd_event_reply_stat(EfsdEvent *ev)
m = e_view_model_find_by_monitor_id(efsd_event_id(ev)); m = e_view_model_find_by_monitor_id(efsd_event_id(ev));
f = e_file_get_by_name(m->files, e_file_get_file(efsd_event_filename(ev))); f = e_file_get_by_name(m->files, e_file_get_file(efsd_event_filename(ev)));
/* if its not in the list we care about, return */ /* if its not in the list we care about, return */
if(!f) if (!f)
D_RETURN; D_RETURN;
/* When everything went okay and we can find a model, /* When everything went okay and we can find a model,
set the file stat data for the file and try to update the gui. * set the file stat data for the file and try to update the gui.
It's just a try because we need to have received the filetype * It's just a try because we need to have received the filetype
info too. --cK. */ * info too. --cK. */
f->stat = *((struct stat*)efsd_event_data(ev)); f->stat = *((struct stat *)efsd_event_data(ev));
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
E_View *v = (E_View *)l->data; E_View *v = (E_View *) l->data;
E_Icon *ic = e_icon_find_by_file(v, f->file); E_Icon *ic = e_icon_find_by_file(v, f->file);
e_icon_update_state(ic); e_icon_update_state(ic);
e_icon_initial_show(ic); e_icon_initial_show(ic);
} }
@ -320,11 +324,12 @@ e_view_model_handle_efsd_event_reply_stat(EfsdEvent *ev)
} }
static void static void
e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *ev) e_view_model_handle_efsd_event_reply_readlink(EfsdEvent * ev)
{ {
E_View_Model *m; E_View_Model *m;
E_File *f; E_File *f;
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
if (!ev) if (!ev)
@ -337,12 +342,13 @@ e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *ev)
f = e_file_get_by_name(m->files, e_file_get_file(efsd_event_filename(ev))); f = e_file_get_by_name(m->files, e_file_get_file(efsd_event_filename(ev)));
if (f) if (f)
{ {
e_file_set_link(f, (char*)efsd_event_data(ev)); e_file_set_link(f, (char *)efsd_event_data(ev));
} }
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
E_View *v = (E_View *)l->data; E_View *v = (E_View *) l->data;
E_Icon *ic = e_icon_find_by_file(v, f->file); E_Icon *ic = e_icon_find_by_file(v, f->file);
e_icon_update_state(ic); e_icon_update_state(ic);
e_icon_initial_show(ic); e_icon_initial_show(ic);
} }
@ -351,22 +357,25 @@ e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *ev)
} }
static void static void
e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *ev) e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent * ev)
{ {
Evas_List l; Evas_List l;
EfsdCmdId cmd; EfsdCmdId cmd;
D_ENTER; D_ENTER;
if (!ev) if (!ev)
D_RETURN; D_RETURN;
cmd = efsd_event_id(ev); cmd = efsd_event_id(ev);
for (l=VM->views;l;l=l->next) for (l = VM->views; l; l = l->next)
{ {
E_View *v; E_View *v;
v = l->data; v = l->data;
/* ignore metadata for desktops */ /* ignore metadata for desktops */
if(v->model->is_desktop) continue; if (v->model->is_desktop)
continue;
if (v->geom_get.x == cmd) if (v->geom_get.x == cmd)
{ {
v->geom_get.x = 0; v->geom_get.x = 0;
@ -409,7 +418,7 @@ e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *ev)
if (ev->efsd_reply_event.errorcode == 0) if (ev->efsd_reply_event.errorcode == 0)
efsd_metadata_get_int(ev, &(v->size.h)); efsd_metadata_get_int(ev, &(v->size.h));
else else
v->size.h = 400; v->size.h = 401;
} }
} }
/* FIXME currently, the bg info is not set via metadata */ /* FIXME currently, the bg info is not set via metadata */
@ -433,35 +442,33 @@ e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *ev)
* } * }
* } * }
*/ */
ecore_window_move(v->win.base, v->location.x, v->location.y);
ecore_window_resize(v->win.base, v->size.w, v->size.h);
v->size.force = 1;
v->changed = 1;
/* We have received all metadata we need, display the view */ /* We have received all metadata we need, display the view */
if ((!v->geom_get.x) && if ((!v->geom_get.x) &&
(!v->geom_get.y) && (!v->geom_get.y) &&
(!v->geom_get.w) && (!v->geom_get.w) && (!v->geom_get.h) && (v->geom_get.busy))
(!v->geom_get.h) &&
(v->geom_get.busy))
{ {
E_Border *b; E_Border *b;
ecore_window_move_resize(v->win.base, v->location.x, v->location.y,
v->size.w, v->size.h);
ecore_window_set_xy_hints(v->win.base, v->location.x,
v->location.y);
v->size.force = 1;
v->geom_get.busy = 0; v->geom_get.busy = 0;
if (v->bg) if (v->bg)
e_bg_resize(v->bg, v->size.w, v->size.h); e_bg_resize(v->bg, v->size.w, v->size.h);
if (v->options.back_pixmap) e_view_update(v); if (v->options.back_pixmap)
e_view_update(v);
b = e_border_adopt(v->win.base, 1); b = e_border_adopt(v->win.base, 1);
b->client.internal = 1; b->client.internal = 1;
e_border_remove_click_grab(b); e_border_remove_click_grab(b);
} }
} }
D_RETURN; D_RETURN;
} }
static void static void
e_view_model_handle_efsd_event_reply(EfsdEvent *ev) e_view_model_handle_efsd_event_reply(EfsdEvent * ev)
{ {
D_ENTER; D_ENTER;
@ -521,9 +528,9 @@ e_view_model_ib_reload_timeout(int val, void *data)
D_ENTER; D_ENTER;
m = data; m = data;
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
v = (E_View*) l->data; v = (E_View *) l->data;
e_view_ib_reload(v); e_view_ib_reload(v);
} }
D_RETURN; D_RETURN;
@ -540,9 +547,9 @@ e_view_model_bg_reload_timeout(int val, void *data)
D_ENTER; D_ENTER;
m = data; m = data;
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
v = (E_View*) l->data; v = (E_View *) l->data;
e_view_bg_reload(v); e_view_bg_reload(v);
} }
D_RETURN; D_RETURN;
@ -561,7 +568,8 @@ e_view_model_file_added(int id, char *file)
D_ENTER; D_ENTER;
/* if we get a path - ignore it - its not a file in the dir */ /* if we get a path - ignore it - its not a file in the dir */
if (!file || file[0] == '/') D_RETURN; if (!file || file[0] == '/')
D_RETURN;
m = e_view_model_find_by_monitor_id(id); m = e_view_model_find_by_monitor_id(id);
if (!strcmp(file, ".e_background.bg.db")) if (!strcmp(file, ".e_background.bg.db"))
@ -570,22 +578,20 @@ e_view_model_file_added(int id, char *file)
snprintf(buf, PATH_MAX, "%s/%s", m->dir, file); snprintf(buf, PATH_MAX, "%s/%s", m->dir, file);
e_strdup(m->bg_file, buf); e_strdup(m->bg_file, buf);
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir); snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5, ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, m);
e_view_model_bg_reload_timeout, 0, m);
} }
else if ((!strcmp (".e_iconbar.db", file)) || else if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp (".e_iconbar.bits.db", file))) (!strcmp(".e_iconbar.bits.db", file)))
{ {
snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir); snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5, ecore_add_event_timer(buf, 0.5, e_view_model_ib_reload_timeout, 0, m);
e_view_model_ib_reload_timeout, 0, m);
} }
else if (file[0] != '.') else if (file[0] != '.')
{ {
f = e_file_new(file); f = e_file_new(file);
m->files = evas_list_append(m->files, f); m->files = evas_list_append(m->files, f);
/* tell all views for this dir about the new file */ /* tell all views for this dir about the new file */
for (l= m->views;l ;l = l->next) for (l = m->views; l; l = l->next)
{ {
v = l->data; v = l->data;
e_view_file_add(v, f); e_view_file_add(v, f);
@ -600,6 +606,7 @@ e_view_model_file_deleted(int id, char *file)
Evas_List l; Evas_List l;
E_File *f; E_File *f;
E_View_Model *m; E_View_Model *m;
D_ENTER; D_ENTER;
if (!file || file[0] == '/') if (!file || file[0] == '/')
@ -613,21 +620,23 @@ e_view_model_file_deleted(int id, char *file)
{ {
e_view_model_set_default_background(m); e_view_model_set_default_background(m);
} }
else if ((!strcmp (".e_iconbar.db", file)) || else if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp (".e_iconbar.bits.db", file))) (!strcmp(".e_iconbar.bits.db", file)))
{ {
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
E_View *v = (E_View*) l->data; E_View *v = (E_View *) l->data;
e_object_unref(E_OBJECT(v->iconbar)); e_object_unref(E_OBJECT(v->iconbar));
v->iconbar = NULL; v->iconbar = NULL;
} }
} }
else if(file[0] != '.') else if (file[0] != '.')
{ {
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
E_View *v = (E_View*) l->data; E_View *v = (E_View *) l->data;
e_view_file_delete(v, f); e_view_file_delete(v, f);
} }
} }
@ -645,7 +654,8 @@ e_view_model_file_changed(int id, char *file)
D_ENTER; D_ENTER;
if (!file || file[0] == '/') D_RETURN; if (!file || file[0] == '/')
D_RETURN;
m = e_view_model_find_by_monitor_id(id); m = e_view_model_find_by_monitor_id(id);
f = e_file_get_by_name(m->files, file); f = e_file_get_by_name(m->files, file);
if (!strcmp(file, ".e_background.bg.db")) if (!strcmp(file, ".e_background.bg.db"))
@ -654,19 +664,17 @@ e_view_model_file_changed(int id, char *file)
snprintf(buf, PATH_MAX, "%s/%s", m->dir, file); snprintf(buf, PATH_MAX, "%s/%s", m->dir, file);
e_strdup(m->bg_file, buf); e_strdup(m->bg_file, buf);
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir); snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5, ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, m);
e_view_model_bg_reload_timeout, 0, m);
} }
else if ((!strcmp (".e_iconbar.db", file)) || else if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp (".e_iconbar.bits.db", file))) (!strcmp(".e_iconbar.bits.db", file)))
{ {
snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir); snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5, ecore_add_event_timer(buf, 0.5, e_view_model_ib_reload_timeout, 0, m);
e_view_model_ib_reload_timeout, 0, m);
} }
else if (file[0] != '.') else if (file[0] != '.')
{ {
for (l= m->views;l ;l = l->next) for (l = m->views; l; l = l->next)
{ {
v = l->data; v = l->data;
e_view_file_changed(v, f); e_view_file_changed(v, f);
@ -683,11 +691,12 @@ e_view_model_file_moved(int id, char *file)
D_ENTER; D_ENTER;
if (!file || file[0] == '/') D_RETURN; if (!file || file[0] == '/')
D_RETURN;
m = e_view_model_find_by_monitor_id(id); m = e_view_model_find_by_monitor_id(id);
for (l=m->views;l;l=l->next) for (l = m->views; l; l = l->next)
{ {
E_View *v = (E_View*) l->data; E_View *v = (E_View *) l->data;
E_Icon *ic; E_Icon *ic;
ic = e_icon_find_by_file(v, file); ic = e_icon_find_by_file(v, file);
@ -703,6 +712,7 @@ e_view_model_find_by_monitor_id(int id)
{ {
E_View_Model *m; E_View_Model *m;
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
for (l = VM->models; l; l = l->next) for (l = VM->models; l; l = l->next)

View File

@ -50,14 +50,14 @@ struct _E_View_Model
* *
* Set the directory for a view_model and starts monitoring it via efsd. * Set the directory for a view_model and starts monitoring it via efsd.
*/ */
void e_view_model_set_dir(E_View_Model *m, char *dir); void e_view_model_set_dir(E_View_Model * m, char *dir);
E_View_Model * e_view_model_new(void); E_View_Model *e_view_model_new(void);
void e_view_model_init(void); void e_view_model_init(void);
void e_view_model_register_view(E_View_Model *m,E_View *v); void e_view_model_register_view(E_View_Model * m, E_View * v);
void e_view_model_unregister_view(E_View *v); void e_view_model_unregister_view(E_View * v);
E_View_Model * e_view_model_find_by_monitor_id(int id); E_View_Model *e_view_model_find_by_monitor_id(int id);
/* Deal with incoming file events */ /* Deal with incoming file events */
void e_view_model_file_added(int id, char *file); void e_view_model_file_added(int id, char *file);

View File

@ -22,7 +22,8 @@ e_embed_text_func_show(void *_data)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_show(em->evas, em->clip_obj); if (em->clip_obj)
evas_show(em->evas, em->clip_obj);
e_text_show(em->text_obj); e_text_show(em->text_obj);
D_RETURN; D_RETURN;
@ -36,7 +37,8 @@ e_embed_text_func_hide(void *_data)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_hide(em->evas, em->clip_obj); if (em->clip_obj)
evas_hide(em->evas, em->clip_obj);
e_text_hide(em->text_obj); e_text_hide(em->text_obj);
D_RETURN; D_RETURN;
@ -50,7 +52,8 @@ e_embed_text_func_move(void *_data, double x, double y)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_move(em->evas, em->clip_obj, x, y); if (em->clip_obj)
evas_move(em->evas, em->clip_obj, x, y);
e_text_move(em->text_obj, x, y); e_text_move(em->text_obj, x, y);
D_RETURN; D_RETURN;
@ -64,7 +67,8 @@ e_embed_text_func_resize(void *_data, double w, double h)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_resize(em->evas, em->clip_obj, w, h); if (em->clip_obj)
evas_resize(em->evas, em->clip_obj, w, h);
e_text_resize(em->text_obj, w, h); e_text_resize(em->text_obj, w, h);
D_RETURN; D_RETURN;
@ -78,7 +82,8 @@ e_embed_text_func_raise(void *_data)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_raise(em->evas, em->clip_obj); if (em->clip_obj)
evas_raise(em->evas, em->clip_obj);
e_text_raise(em->text_obj); e_text_raise(em->text_obj);
D_RETURN; D_RETURN;
@ -92,7 +97,8 @@ e_embed_text_func_lower(void *_data)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_lower(em->evas, em->clip_obj); if (em->clip_obj)
evas_lower(em->evas, em->clip_obj);
e_text_lower(em->text_obj); e_text_lower(em->text_obj);
D_RETURN; D_RETURN;
@ -106,7 +112,8 @@ e_embed_text_func_set_layer(void *_data, int l)
D_ENTER; D_ENTER;
em = _data; em = _data;
if (em->clip_obj) evas_set_layer(em->evas, em->clip_obj, l); if (em->clip_obj)
evas_set_layer(em->evas, em->clip_obj, l);
e_text_set_layer(em->text_obj, l); e_text_set_layer(em->text_obj, l);
D_RETURN; D_RETURN;
@ -139,7 +146,8 @@ e_embed_text_func_set_clip(void *_data, Evas_Object clip)
} }
static void static void
e_embed_text_func_set_color_class(void *_data, char *cc, int r, int g, int b, int a) e_embed_text_func_set_color_class(void *_data, char *cc, int r, int g, int b,
int a)
{ {
D_ENTER; D_ENTER;
@ -162,8 +170,10 @@ e_embed_text_func_get_min_size(void *_data, double *w, double *h)
em = _data; em = _data;
e_text_get_min_size(em->text_obj, w, h); e_text_get_min_size(em->text_obj, w, h);
if (em->clip_x) *w = 0; if (em->clip_x)
if (em->clip_y) *h = 0; *w = 0;
if (em->clip_y)
*h = 0;
D_RETURN; D_RETURN;
} }
@ -177,8 +187,10 @@ e_embed_text_func_get_max_size(void *_data, double *w, double *h)
em = _data; em = _data;
e_text_get_max_size(em->text_obj, w, h); e_text_get_max_size(em->text_obj, w, h);
if (em->clip_x) *w = 999999999; if (em->clip_x)
if (em->clip_y) *h = 999999999; *w = 999999999;
if (em->clip_y)
*h = 999999999;
D_RETURN; D_RETURN;
} }
@ -186,7 +198,8 @@ e_embed_text_func_get_max_size(void *_data, double *w, double *h)
/***/ /***/
Embed Embed
e_embed_text(Ebits_Object o, char *bit_name, Evas evas, E_Text *text_obj, int clip_x, int clip_y) e_embed_text(Ebits_Object o, char *bit_name, Evas evas, E_Text * text_obj,
int clip_x, int clip_y)
{ {
Embed_Private *em; Embed_Private *em;
@ -217,8 +230,7 @@ e_embed_text(Ebits_Object o, char *bit_name, Evas evas, E_Text *text_obj, int cl
e_embed_text_func_set_clip, e_embed_text_func_set_clip,
e_embed_text_func_set_color_class, e_embed_text_func_set_color_class,
e_embed_text_func_get_min_size, e_embed_text_func_get_min_size,
e_embed_text_func_get_max_size, e_embed_text_func_get_max_size, em);
em);
D_RETURN_(em); D_RETURN_(em);
} }
@ -333,7 +345,8 @@ e_embed_image_func_set_clip(void *_data, Evas_Object clip)
} }
static void static void
e_embed_image_func_set_color_class(void *_data, char *cc, int r, int g, int b, int a) e_embed_image_func_set_color_class(void *_data, char *cc, int r, int g, int b,
int a)
{ {
Embed_Private *em; Embed_Private *em;
@ -358,8 +371,10 @@ e_embed_image_func_get_min_size(void *_data, double *w, double *h)
iw = 0; iw = 0;
ih = 0; ih = 0;
evas_get_image_size(em->evas, em->image_obj, &iw, &ih); evas_get_image_size(em->evas, em->image_obj, &iw, &ih);
if (w) *w = iw; if (w)
if (h) *h = ih; *w = iw;
if (h)
*h = ih;
D_RETURN; D_RETURN;
} }
@ -374,8 +389,10 @@ e_embed_image_func_get_max_size(void *_data, double *w, double *h)
em = _data; em = _data;
evas_get_image_size(em->evas, em->image_obj, &iw, &ih); evas_get_image_size(em->evas, em->image_obj, &iw, &ih);
if (w) *w = iw; if (w)
if (h) *h = ih; *w = iw;
if (h)
*h = ih;
D_RETURN; D_RETURN;
} }
@ -383,7 +400,8 @@ e_embed_image_func_get_max_size(void *_data, double *w, double *h)
/***/ /***/
Embed Embed
e_embed_image_object(Ebits_Object o, char *bit_name, Evas evas, Evas_Object image_obj) e_embed_image_object(Ebits_Object o, char *bit_name, Evas evas,
Evas_Object image_obj)
{ {
Embed_Private *em; Embed_Private *em;
@ -405,8 +423,7 @@ e_embed_image_object(Ebits_Object o, char *bit_name, Evas evas, Evas_Object imag
e_embed_image_func_set_clip, e_embed_image_func_set_clip,
e_embed_image_func_set_color_class, e_embed_image_func_set_color_class,
e_embed_image_func_get_min_size, e_embed_image_func_get_min_size,
e_embed_image_func_get_max_size, e_embed_image_func_get_max_size, em);
em);
D_RETURN_(em); D_RETURN_(em);
} }
@ -420,7 +437,8 @@ e_embed_free(Embed emb)
D_ENTER; D_ENTER;
em = emb; em = emb;
if (em->clip_obj) evas_del_object(em->evas, em->clip_obj); if (em->clip_obj)
evas_del_object(em->evas, em->clip_obj);
FREE(em); FREE(em);
D_RETURN; D_RETURN;

View File

@ -4,10 +4,12 @@
#include "e.h" #include "e.h"
#include "text.h" #include "text.h"
typedef void * Embed; typedef void *Embed;
Embed e_embed_text(Ebits_Object o, char *bit_name, Evas evas, E_Text *text_obj, int clip_x, int clip_y); Embed e_embed_text(Ebits_Object o, char *bit_name, Evas evas,
Embed e_embed_image_object(Ebits_Object o, char *bit_name, Evas evas, Evas_Object image_obj); E_Text * text_obj, int clip_x, int clip_y);
Embed e_embed_image_object(Ebits_Object o, char *bit_name,
Evas evas, Evas_Object image_obj);
void e_embed_free(Embed em); void e_embed_free(Embed em);
#endif #endif

View File

@ -8,12 +8,15 @@ static Evas_List entries;
static void e_clear_selection(Ecore_Event * ev); static void e_clear_selection(Ecore_Event * ev);
static void e_paste_request(Ecore_Event * ev); static void e_paste_request(Ecore_Event * ev);
static void e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); static void e_entry_down_cb(void *_data, Evas _e, Evas_Object _o,
static void e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); int _b, int _x, int _y);
static void e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); static void e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b,
static void e_entry_realize(E_Entry *entry); int _x, int _y);
static void e_entry_unrealize(E_Entry *entry); static void e_entry_move_cb(void *_data, Evas _e, Evas_Object _o,
static void e_entry_configure(E_Entry *entry); int _b, int _x, int _y);
static void e_entry_realize(E_Entry * entry);
static void e_entry_unrealize(E_Entry * entry);
static void e_entry_configure(E_Entry * entry);
static void static void
e_clear_selection(Ecore_Event * ev) e_clear_selection(Ecore_Event * ev)
@ -80,7 +83,8 @@ e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
entry = _data; entry = _data;
if ((_b == 2) && (!entry->mouse_down)) if ((_b == 2) && (!entry->mouse_down))
{ {
if (entry->paste_win) ecore_window_destroy(entry->paste_win); if (entry->paste_win)
ecore_window_destroy(entry->paste_win);
entry->paste_win = ecore_selection_request(); entry->paste_win = ecore_selection_request();
} }
else if (!entry->mouse_down) else if (!entry->mouse_down)
@ -119,12 +123,14 @@ static void
e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{ {
E_Entry *entry; E_Entry *entry;
/* int pos; */ /* int pos; */
D_ENTER; D_ENTER;
entry = _data; entry = _data;
if (_b == entry->mouse_down) entry->mouse_down = 0; if (_b == entry->mouse_down)
entry->mouse_down = 0;
e_entry_configure(entry); e_entry_configure(entry);
D_RETURN; D_RETURN;
@ -175,13 +181,13 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{ {
entry->select.down = ppos; entry->select.down = ppos;
entry->select.start = ppos; entry->select.start = ppos;
entry->select.length = entry->cursor_pos - ppos +1; entry->select.length = entry->cursor_pos - ppos + 1;
} }
else else
{ {
entry->select.down = ppos; entry->select.down = ppos;
entry->select.start = entry->cursor_pos; entry->select.start = entry->cursor_pos;
entry->select.length = ppos - entry->cursor_pos +1; entry->select.length = ppos - entry->cursor_pos + 1;
} }
} }
else if (entry->select.start >= 0) else if (entry->select.start >= 0)
@ -189,12 +195,14 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
if (entry->cursor_pos < entry->select.down) if (entry->cursor_pos < entry->select.down)
{ {
entry->select.start = entry->cursor_pos; entry->select.start = entry->cursor_pos;
entry->select.length = entry->select.down - entry->cursor_pos + 1; entry->select.length =
entry->select.down - entry->cursor_pos + 1;
} }
else else
{ {
entry->select.start = entry->select.down; entry->select.start = entry->select.down;
entry->select.length = entry->cursor_pos - entry->select.down + 1; entry->select.length =
entry->cursor_pos - entry->select.down + 1;
} }
} }
if (entry->select.start >= 0) if (entry->select.start >= 0)
@ -204,7 +212,8 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
str2 = e_entry_get_selection(entry); str2 = e_entry_get_selection(entry);
if (str2) if (str2)
{ {
if (entry->selection_win) ecore_window_destroy(entry->selection_win); if (entry->selection_win)
ecore_window_destroy(entry->selection_win);
entry->selection_win = ecore_selection_set(str2); entry->selection_win = ecore_selection_set(str2);
free(str2); free(str2);
} }
@ -219,7 +228,7 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
} }
static void static void
e_entry_realize(E_Entry *entry) e_entry_realize(E_Entry * entry)
{ {
char *entries; char *entries;
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -261,24 +270,33 @@ e_entry_realize(E_Entry *entry)
evas_set_color(entry->evas, entry->text, 0, 0, 0, 255); evas_set_color(entry->evas, entry->text, 0, 0, 0, 255);
evas_set_clip(entry->evas, entry->text, entry->clip_box); evas_set_clip(entry->evas, entry->text, entry->clip_box);
evas_set_clip(entry->evas, entry->event_box, entry->clip_box); evas_set_clip(entry->evas, entry->event_box, entry->clip_box);
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_DOWN, e_entry_down_cb, entry); evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_DOWN,
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_UP, e_entry_up_cb, entry); e_entry_down_cb, entry);
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_MOVE, e_entry_move_cb, entry); evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_UP,
e_entry_up_cb, entry);
evas_callback_add(entry->evas, entry->event_box, CALLBACK_MOUSE_MOVE,
e_entry_move_cb, entry);
D_RETURN; D_RETURN;
} }
static void static void
e_entry_unrealize(E_Entry *entry) e_entry_unrealize(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
if (entry->event_box) evas_del_object(entry->evas, entry->event_box); if (entry->event_box)
if (entry->text) evas_del_object(entry->evas, entry->text); evas_del_object(entry->evas, entry->event_box);
if (entry->clip_box) evas_del_object(entry->evas, entry->clip_box); if (entry->text)
if (entry->obj_base) ebits_free(entry->obj_base); evas_del_object(entry->evas, entry->text);
if (entry->obj_cursor) ebits_free(entry->obj_cursor); if (entry->clip_box)
if (entry->obj_selection) ebits_free(entry->obj_selection); evas_del_object(entry->evas, entry->clip_box);
if (entry->obj_base)
ebits_free(entry->obj_base);
if (entry->obj_cursor)
ebits_free(entry->obj_cursor);
if (entry->obj_selection)
ebits_free(entry->obj_selection);
entry->event_box = NULL; entry->event_box = NULL;
entry->text = NULL; entry->text = NULL;
entry->clip_box = NULL; entry->clip_box = NULL;
@ -290,40 +308,49 @@ e_entry_unrealize(E_Entry *entry)
} }
static void static void
e_entry_configure(E_Entry *entry) e_entry_configure(E_Entry * entry)
{ {
int p1l, p1r, p1t, p1b; int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b; int p2l, p2r, p2t, p2b;
D_ENTER; D_ENTER;
if (!entry->evas) D_RETURN; if (!entry->evas)
if (!entry->event_box) D_RETURN; D_RETURN;
if (!entry->event_box)
D_RETURN;
p1l = p1r = p1t = p1b = 0; p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b); if (entry->obj_base)
ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0; p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b); if (entry->obj_cursor)
ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (entry->obj_base) if (entry->obj_base)
{ {
ebits_move(entry->obj_base, entry->x, entry->y); ebits_move(entry->obj_base, entry->x, entry->y);
ebits_resize(entry->obj_base, entry->w, entry->h); ebits_resize(entry->obj_base, entry->w, entry->h);
} }
evas_move(entry->evas, entry->clip_box, entry->x + p1l, entry->y + p1t); evas_move(entry->evas, entry->clip_box, entry->x + p1l, entry->y + p1t);
evas_resize(entry->evas, entry->clip_box, entry->w - p1l - p1r, entry->h - p1t - p1b); evas_resize(entry->evas, entry->clip_box, entry->w - p1l - p1r,
evas_move(entry->evas, entry->event_box, entry->x + p1l + p2l, entry->y + p1t + p2t); entry->h - p1t - p1b);
evas_resize(entry->evas, entry->event_box, entry->w - p1l - p1r - p2l - p2r, entry->h - p1t - p1b - p2t - p2b); evas_move(entry->evas, entry->event_box, entry->x + p1l + p2l,
entry->y + p1t + p2t);
evas_resize(entry->evas, entry->event_box, entry->w - p1l - p1r - p2l - p2r,
entry->h - p1t - p1b - p2t - p2b);
if ((entry->buffer) && (entry->buffer[0] != 0) && (entry->focused)) if ((entry->buffer) && (entry->buffer[0] != 0) && (entry->focused))
{ {
double tx, ty, tw, th; double tx, ty, tw, th;
if (entry->cursor_pos < (int)strlen(entry->buffer)) if (entry->cursor_pos < (int)strlen(entry->buffer))
{ {
evas_text_at(entry->evas, entry->text, entry->cursor_pos, &tx, &ty, &tw, &th); evas_text_at(entry->evas, entry->text, entry->cursor_pos, &tx, &ty,
&tw, &th);
} }
else else
{ {
entry->cursor_pos = strlen(entry->buffer); entry->cursor_pos = strlen(entry->buffer);
evas_text_at(entry->evas, entry->text, entry->cursor_pos - 1, &tx, &ty, &tw, &th); evas_text_at(entry->evas, entry->text, entry->cursor_pos - 1, &tx,
&ty, &tw, &th);
tx += tw; tx += tw;
tw = entry->end_width; tw = entry->end_width;
} }
@ -334,7 +361,9 @@ e_entry_configure(E_Entry *entry)
entry->scroll_pos = 0 - tx; entry->scroll_pos = 0 - tx;
if (entry->obj_cursor) if (entry->obj_cursor)
{ {
ebits_move(entry->obj_cursor, entry->x + tx + entry->scroll_pos + p1l, entry->y + ty + p1t); ebits_move(entry->obj_cursor,
entry->x + tx + entry->scroll_pos + p1l,
entry->y + ty + p1t);
ebits_resize(entry->obj_cursor, tw + p2l + p2r, th + p2t + p2b); ebits_resize(entry->obj_cursor, tw + p2l + p2r, th + p2t + p2b);
ebits_show(entry->obj_cursor); ebits_show(entry->obj_cursor);
} }
@ -349,8 +378,11 @@ e_entry_configure(E_Entry *entry)
th = evas_get_text_height(entry->evas, entry->text); th = evas_get_text_height(entry->evas, entry->text);
if (entry->obj_cursor) if (entry->obj_cursor)
{ {
ebits_move(entry->obj_cursor, entry->x + tx + entry->scroll_pos + p1l, entry->y + p1t); ebits_move(entry->obj_cursor,
ebits_resize(entry->obj_cursor, entry->end_width + p2l + p2r, th + p2t + p2b); entry->x + tx + entry->scroll_pos + p1l,
entry->y + p1t);
ebits_resize(entry->obj_cursor, entry->end_width + p2l + p2r,
th + p2t + p2b);
ebits_show(entry->obj_cursor); ebits_show(entry->obj_cursor);
} }
} }
@ -359,24 +391,34 @@ e_entry_configure(E_Entry *entry)
if (entry->obj_cursor) if (entry->obj_cursor)
ebits_hide(entry->obj_cursor); ebits_hide(entry->obj_cursor);
} }
evas_move(entry->evas, entry->text, entry->x + entry->scroll_pos + p1l + p2l, entry->y + p1t + p2t); evas_move(entry->evas, entry->text, entry->x + entry->scroll_pos + p1l + p2l,
entry->y + p1t + p2t);
if (entry->select.start >= 0) if (entry->select.start >= 0)
{ {
double x1, y1, x2, tw, th; double x1, y1, x2, tw, th;
evas_text_at(entry->evas, entry->text, entry->select.start, &x1, &y1, NULL, NULL); evas_text_at(entry->evas, entry->text, entry->select.start, &x1, &y1,
if (entry->select.start + entry->select.length <= (int)strlen(entry->buffer)) NULL, NULL);
evas_text_at(entry->evas, entry->text, entry->select.start + entry->select.length - 1, &x2, NULL, &tw, &th); if (entry->select.start + entry->select.length <=
(int)strlen(entry->buffer))
evas_text_at(entry->evas, entry->text,
entry->select.start + entry->select.length - 1, &x2,
NULL, &tw, &th);
else else
{ {
evas_text_at(entry->evas, entry->text, entry->select.start + entry->select.length - 2, &x2, NULL, &tw, &th); evas_text_at(entry->evas, entry->text,
entry->select.start + entry->select.length - 2, &x2,
NULL, &tw, &th);
tw += entry->end_width; tw += entry->end_width;
} }
th = evas_get_text_height(entry->evas, entry->text); th = evas_get_text_height(entry->evas, entry->text);
if (entry->obj_selection) if (entry->obj_selection)
{ {
ebits_move(entry->obj_selection, entry->x + x1 + entry->scroll_pos + p1l, entry->y + y1 + p1t); ebits_move(entry->obj_selection,
ebits_resize(entry->obj_selection, x2 + tw - x1 + p2l + p2r, th + p2t + p2b); entry->x + x1 + entry->scroll_pos + p1l,
entry->y + y1 + p1t);
ebits_resize(entry->obj_selection, x2 + tw - x1 + p2l + p2r,
th + p2t + p2b);
ebits_show(entry->obj_selection); ebits_show(entry->obj_selection);
} }
} }
@ -395,13 +437,14 @@ e_entry_init(void)
D_ENTER; D_ENTER;
ecore_event_filter_handler_add(ECORE_EVENT_PASTE_REQUEST, e_paste_request); ecore_event_filter_handler_add(ECORE_EVENT_PASTE_REQUEST, e_paste_request);
ecore_event_filter_handler_add(ECORE_EVENT_CLEAR_SELECTION, e_clear_selection); ecore_event_filter_handler_add(ECORE_EVENT_CLEAR_SELECTION,
e_clear_selection);
D_RETURN; D_RETURN;
} }
void void
e_entry_free(E_Entry *entry) e_entry_free(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
@ -431,11 +474,12 @@ e_entry_new(void)
} }
void void
e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e) e_entry_handle_keypress(E_Entry * entry, Ecore_Event_Key_Down * e)
{ {
D_ENTER; D_ENTER;
if (!entry->focused) D_RETURN; if (!entry->focused)
D_RETURN;
if (!strcmp(e->key, "Up")) if (!strcmp(e->key, "Up"))
{ {
} }
@ -462,19 +506,24 @@ e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
{ {
/* char *str2; */ /* char *str2; */
if (entry->select.start >= 0) e_entry_clear_selection(entry); if (entry->select.start >= 0)
else if (entry->cursor_pos > 0) e_entry_delete_to_left(entry); e_entry_clear_selection(entry);
else if (entry->cursor_pos > 0)
e_entry_delete_to_left(entry);
} }
else if (!strcmp(e->key, "Delete")) else if (!strcmp(e->key, "Delete"))
{ {
/* char *str2; */ /* char *str2; */
if (entry->select.start >= 0) e_entry_clear_selection(entry); if (entry->select.start >= 0)
else if (entry->cursor_pos < (int)strlen(entry->buffer)) e_entry_delete_to_right(entry); e_entry_clear_selection(entry);
else if (entry->cursor_pos < (int)strlen(entry->buffer))
e_entry_delete_to_right(entry);
} }
else if (!strcmp(e->key, "Insert")) else if (!strcmp(e->key, "Insert"))
{ {
if (entry->paste_win) ecore_window_destroy(entry->paste_win); if (entry->paste_win)
ecore_window_destroy(entry->paste_win);
entry->paste_win = ecore_selection_request(); entry->paste_win = ecore_selection_request();
} }
else if (!strcmp(e->key, "Home")) else if (!strcmp(e->key, "Home"))
@ -533,7 +582,8 @@ e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
else if ((strlen(type) == 1) && (type[0] == 0x02)) /* ctrl+b */ else if ((strlen(type) == 1) && (type[0] == 0x02)) /* ctrl+b */
{ {
entry->cursor_pos--; entry->cursor_pos--;
if (entry->cursor_pos < 0) entry->cursor_pos = 0; if (entry->cursor_pos < 0)
entry->cursor_pos = 0;
} }
else if (strlen(type) > 0) else if (strlen(type) > 0)
{ {
@ -548,11 +598,12 @@ e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
} }
void void
e_entry_set_evas(E_Entry *entry, Evas evas) e_entry_set_evas(E_Entry * entry, Evas evas)
{ {
D_ENTER; D_ENTER;
if (entry->evas) e_entry_unrealize(entry); if (entry->evas)
e_entry_unrealize(entry);
entry->evas = evas; entry->evas = evas;
e_entry_realize(entry); e_entry_realize(entry);
e_entry_configure(entry); e_entry_configure(entry);
@ -566,16 +617,21 @@ e_entry_set_evas(E_Entry *entry, Evas evas)
} }
void void
e_entry_show(E_Entry *entry) e_entry_show(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
if (entry->visible) D_RETURN; if (entry->visible)
D_RETURN;
entry->visible = 1; entry->visible = 1;
if (!entry->evas) D_RETURN; if (!entry->evas)
if (entry->obj_base) ebits_show(entry->obj_base); D_RETURN;
if (entry->obj_cursor) ebits_show(entry->obj_cursor); if (entry->obj_base)
if (entry->obj_selection) ebits_show(entry->obj_selection); ebits_show(entry->obj_base);
if (entry->obj_cursor)
ebits_show(entry->obj_cursor);
if (entry->obj_selection)
ebits_show(entry->obj_selection);
evas_show(entry->evas, entry->event_box); evas_show(entry->evas, entry->event_box);
evas_show(entry->evas, entry->clip_box); evas_show(entry->evas, entry->clip_box);
evas_show(entry->evas, entry->text); evas_show(entry->evas, entry->text);
@ -584,16 +640,21 @@ e_entry_show(E_Entry *entry)
} }
void void
e_entry_hide(E_Entry *entry) e_entry_hide(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
if (!entry->visible) D_RETURN; if (!entry->visible)
D_RETURN;
entry->visible = 0; entry->visible = 0;
if (!entry->evas) D_RETURN; if (!entry->evas)
if (entry->obj_base) ebits_hide(entry->obj_base); D_RETURN;
if (entry->obj_cursor) ebits_hide(entry->obj_cursor); if (entry->obj_base)
if (entry->obj_selection) ebits_hide(entry->obj_selection); ebits_hide(entry->obj_base);
if (entry->obj_cursor)
ebits_hide(entry->obj_cursor);
if (entry->obj_selection)
ebits_hide(entry->obj_selection);
evas_hide(entry->evas, entry->event_box); evas_hide(entry->evas, entry->event_box);
evas_hide(entry->evas, entry->clip_box); evas_hide(entry->evas, entry->clip_box);
evas_hide(entry->evas, entry->text); evas_hide(entry->evas, entry->text);
@ -602,52 +663,61 @@ e_entry_hide(E_Entry *entry)
} }
void void
e_entry_raise(E_Entry *entry) e_entry_raise(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
if (entry->obj_base) ebits_raise(entry->obj_base); if (entry->obj_base)
ebits_raise(entry->obj_base);
evas_raise(entry->evas, entry->clip_box); evas_raise(entry->evas, entry->clip_box);
evas_raise(entry->evas, entry->text); evas_raise(entry->evas, entry->text);
if (entry->obj_selection) ebits_raise(entry->obj_selection); if (entry->obj_selection)
if (entry->obj_cursor) ebits_raise(entry->obj_cursor); ebits_raise(entry->obj_selection);
if (entry->obj_cursor)
ebits_raise(entry->obj_cursor);
evas_raise(entry->evas, entry->event_box); evas_raise(entry->evas, entry->event_box);
D_RETURN; D_RETURN;
} }
void void
e_entry_lower(E_Entry *entry) e_entry_lower(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
evas_lower(entry->evas, entry->event_box); evas_lower(entry->evas, entry->event_box);
if (entry->obj_cursor) ebits_lower(entry->obj_cursor); if (entry->obj_cursor)
if (entry->obj_selection) ebits_lower(entry->obj_selection); ebits_lower(entry->obj_cursor);
if (entry->obj_selection)
ebits_lower(entry->obj_selection);
evas_lower(entry->evas, entry->text); evas_lower(entry->evas, entry->text);
evas_lower(entry->evas, entry->clip_box); evas_lower(entry->evas, entry->clip_box);
if (entry->obj_base) ebits_lower(entry->obj_base); if (entry->obj_base)
ebits_lower(entry->obj_base);
D_RETURN; D_RETURN;
} }
void void
e_entry_set_layer(E_Entry *entry, int l) e_entry_set_layer(E_Entry * entry, int l)
{ {
D_ENTER; D_ENTER;
if (entry->obj_base) ebits_set_layer(entry->obj_base, l); if (entry->obj_base)
ebits_set_layer(entry->obj_base, l);
evas_set_layer(entry->evas, entry->clip_box, l); evas_set_layer(entry->evas, entry->clip_box, l);
evas_set_layer(entry->evas, entry->text, l); evas_set_layer(entry->evas, entry->text, l);
if (entry->obj_selection) ebits_set_layer(entry->obj_selection, l); if (entry->obj_selection)
if (entry->obj_cursor) ebits_set_layer(entry->obj_cursor, l); ebits_set_layer(entry->obj_selection, l);
if (entry->obj_cursor)
ebits_set_layer(entry->obj_cursor, l);
evas_set_layer(entry->evas, entry->event_box, l); evas_set_layer(entry->evas, entry->event_box, l);
D_RETURN; D_RETURN;
} }
void void
e_entry_set_clip(E_Entry *entry, Evas_Object clip) e_entry_set_clip(E_Entry * entry, Evas_Object clip)
{ {
D_ENTER; D_ENTER;
@ -659,7 +729,7 @@ e_entry_set_clip(E_Entry *entry, Evas_Object clip)
} }
void void
e_entry_unset_clip(E_Entry *entry) e_entry_unset_clip(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
@ -671,7 +741,7 @@ e_entry_unset_clip(E_Entry *entry)
} }
void void
e_entry_move(E_Entry *entry, int x, int y) e_entry_move(E_Entry * entry, int x, int y)
{ {
D_ENTER; D_ENTER;
@ -683,7 +753,7 @@ e_entry_move(E_Entry *entry, int x, int y)
} }
void void
e_entry_resize(E_Entry *entry, int w, int h) e_entry_resize(E_Entry * entry, int w, int h)
{ {
D_ENTER; D_ENTER;
@ -695,7 +765,7 @@ e_entry_resize(E_Entry *entry, int w, int h)
} }
void void
e_entry_query_max_size(E_Entry *entry, int *w, int *h) e_entry_query_max_size(E_Entry * entry, int *w, int *h)
{ {
int p1l, p1r, p1t, p1b; int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b; int p2l, p2r, p2t, p2b;
@ -703,18 +773,24 @@ e_entry_query_max_size(E_Entry *entry, int *w, int *h)
D_ENTER; D_ENTER;
p1l = p1r = p1t = p1b = 0; p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b); if (entry->obj_base)
ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0; p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b); if (entry->obj_cursor)
ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (w) *w = evas_get_text_width(entry->evas, entry->text) + p1l + p1r + p2l + p2r; if (w)
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b; *w =
evas_get_text_width(entry->evas, entry->text) + p1l + p1r + p2l + p2r;
if (h)
*h =
evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN; D_RETURN;
} }
void void
e_entry_max_size(E_Entry *entry, int *w, int *h) e_entry_max_size(E_Entry * entry, int *w, int *h)
{ {
int p1l, p1r, p1t, p1b; int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b; int p2l, p2r, p2t, p2b;
@ -722,17 +798,22 @@ e_entry_max_size(E_Entry *entry, int *w, int *h)
D_ENTER; D_ENTER;
p1l = p1r = p1t = p1b = 0; p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b); if (entry->obj_base)
ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0; p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b); if (entry->obj_cursor)
if (w) *w = 8000; ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b; if (w)
*w = 8000;
if (h)
*h =
evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN; D_RETURN;
} }
void void
e_entry_min_size(E_Entry *entry, int *w, int *h) e_entry_min_size(E_Entry * entry, int *w, int *h)
{ {
int p1l, p1r, p1t, p1b; int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b; int p2l, p2r, p2t, p2b;
@ -740,17 +821,22 @@ e_entry_min_size(E_Entry *entry, int *w, int *h)
D_ENTER; D_ENTER;
p1l = p1r = p1t = p1b = 0; p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b); if (entry->obj_base)
ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0; p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b); if (entry->obj_cursor)
if (w) *w = p1l + p1r + p2l + p2r + entry->min_size; ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b; if (w)
*w = p1l + p1r + p2l + p2r + entry->min_size;
if (h)
*h =
evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN; D_RETURN;
} }
void void
e_entry_set_size(E_Entry *entry, int w, int h) e_entry_set_size(E_Entry * entry, int w, int h)
{ {
int p1l, p1r, p1t, p1b; int p1l, p1r, p1t, p1b;
int p2l, p2r, p2t, p2b; int p2l, p2r, p2t, p2b;
@ -758,9 +844,11 @@ e_entry_set_size(E_Entry *entry, int w, int h)
D_ENTER; D_ENTER;
p1l = p1r = p1t = p1b = 0; p1l = p1r = p1t = p1b = 0;
if (entry->obj_base) ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b); if (entry->obj_base)
ebits_get_insets(entry->obj_base, &p1l, &p1r, &p1t, &p1b);
p2l = p2r = p2t = p2b = 0; p2l = p2r = p2t = p2b = 0;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b); if (entry->obj_cursor)
ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (p1l + p1r + p2l + p2r + w > entry->w) if (p1l + p1r + p2l + p2r + w > entry->w)
{ {
entry->min_size = w; entry->min_size = w;
@ -772,11 +860,12 @@ e_entry_set_size(E_Entry *entry, int w, int h)
} }
void void
e_entry_set_focus(E_Entry *entry, int focused) e_entry_set_focus(E_Entry * entry, int focused)
{ {
D_ENTER; D_ENTER;
if (entry->focused == focused) D_RETURN; if (entry->focused == focused)
D_RETURN;
entry->focused = focused; entry->focused = focused;
e_entry_configure(entry); e_entry_configure(entry);
if (entry->focused) if (entry->focused)
@ -794,7 +883,7 @@ e_entry_set_focus(E_Entry *entry, int focused)
} }
void void
e_entry_set_text(E_Entry *entry, const char *text) e_entry_set_text(E_Entry * entry, const char *text)
{ {
D_ENTER; D_ENTER;
@ -811,7 +900,7 @@ e_entry_set_text(E_Entry *entry, const char *text)
} }
const char * const char *
e_entry_get_text(E_Entry *entry) e_entry_get_text(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
@ -819,7 +908,7 @@ e_entry_get_text(E_Entry *entry)
} }
void void
e_entry_set_cursor(E_Entry *entry, int cursor_pos) e_entry_set_cursor(E_Entry * entry, int cursor_pos)
{ {
D_ENTER; D_ENTER;
@ -830,7 +919,7 @@ e_entry_set_cursor(E_Entry *entry, int cursor_pos)
} }
int int
e_entry_get_cursor(E_Entry *entry) e_entry_get_cursor(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
@ -838,7 +927,9 @@ e_entry_get_cursor(E_Entry *entry)
} }
void void
e_entry_set_changed_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data) e_entry_set_changed_callback(E_Entry * entry,
void (*func) (E_Entry * _entry, void *_data),
void *data)
{ {
D_ENTER; D_ENTER;
@ -849,7 +940,9 @@ e_entry_set_changed_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void
} }
void void
e_entry_set_enter_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data) e_entry_set_enter_callback(E_Entry * entry,
void (*func) (E_Entry * _entry, void *_data),
void *data)
{ {
D_ENTER; D_ENTER;
@ -860,7 +953,9 @@ e_entry_set_enter_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *
} }
void void
e_entry_set_focus_in_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data) e_entry_set_focus_in_callback(E_Entry * entry,
void (*func) (E_Entry * _entry, void *_data),
void *data)
{ {
D_ENTER; D_ENTER;
@ -871,7 +966,9 @@ e_entry_set_focus_in_callback(E_Entry *entry, void (*func) (E_Entry *_entry, voi
} }
void void
e_entry_set_focus_out_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data) e_entry_set_focus_out_callback(E_Entry * entry,
void (*func) (E_Entry * _entry, void *_data),
void *data)
{ {
D_ENTER; D_ENTER;
@ -882,13 +979,14 @@ e_entry_set_focus_out_callback(E_Entry *entry, void (*func) (E_Entry *_entry, vo
} }
void void
e_entry_insert_text(E_Entry *entry, char *text) e_entry_insert_text(E_Entry * entry, char *text)
{ {
char *str2; char *str2;
D_ENTER; D_ENTER;
if (!text) D_RETURN; if (!text)
D_RETURN;
str2 = malloc(strlen(e_entry_get_text(entry)) + 1 + strlen(text)); str2 = malloc(strlen(e_entry_get_text(entry)) + 1 + strlen(text));
str2[0] = 0; str2[0] = 0;
strncat(str2, entry->buffer, entry->cursor_pos); strncat(str2, entry->buffer, entry->cursor_pos);
@ -896,14 +994,14 @@ e_entry_insert_text(E_Entry *entry, char *text)
strcat(str2, &(entry->buffer[entry->cursor_pos])); strcat(str2, &(entry->buffer[entry->cursor_pos]));
e_entry_set_text(entry, str2); e_entry_set_text(entry, str2);
free(str2); free(str2);
entry->cursor_pos+=strlen(text); entry->cursor_pos += strlen(text);
e_entry_configure(entry); e_entry_configure(entry);
D_RETURN; D_RETURN;
} }
void void
e_entry_clear_selection(E_Entry *entry) e_entry_clear_selection(E_Entry * entry)
{ {
char *str2; char *str2;
@ -912,9 +1010,11 @@ e_entry_clear_selection(E_Entry *entry)
if (entry->select.start >= 0) if (entry->select.start >= 0)
{ {
e_strdup(str2, e_entry_get_text(entry)); e_strdup(str2, e_entry_get_text(entry));
if (entry->select.start + entry->select.length > (int)strlen(entry->buffer)) if (entry->select.start + entry->select.length >
(int)strlen(entry->buffer))
entry->select.length = strlen(entry->buffer) - entry->select.start; entry->select.length = strlen(entry->buffer) - entry->select.start;
strcpy(&(str2[entry->select.start]), &(entry->buffer[entry->select.start + entry->select.length])); strcpy(&(str2[entry->select.start]),
&(entry->buffer[entry->select.start + entry->select.length]));
e_entry_set_text(entry, str2); e_entry_set_text(entry, str2);
free(str2); free(str2);
entry->cursor_pos = entry->select.start; entry->cursor_pos = entry->select.start;
@ -926,7 +1026,7 @@ e_entry_clear_selection(E_Entry *entry)
} }
void void
e_entry_delete_to_left(E_Entry *entry) e_entry_delete_to_left(E_Entry * entry)
{ {
char *str2; char *str2;
@ -942,7 +1042,7 @@ e_entry_delete_to_left(E_Entry *entry)
} }
void void
e_entry_delete_to_right(E_Entry *entry) e_entry_delete_to_right(E_Entry * entry)
{ {
char *str2; char *str2;
@ -958,7 +1058,7 @@ e_entry_delete_to_right(E_Entry *entry)
} }
char * char *
e_entry_get_selection(E_Entry *entry) e_entry_get_selection(E_Entry * entry)
{ {
D_ENTER; D_ENTER;
@ -968,7 +1068,8 @@ e_entry_get_selection(E_Entry *entry)
int len; int len;
len = entry->select.length; len = entry->select.length;
if (entry->select.start + entry->select.length >= (int)strlen(entry->buffer)) if (entry->select.start + entry->select.length >=
(int)strlen(entry->buffer))
len = strlen(entry->buffer) - entry->select.start; len = strlen(entry->buffer) - entry->select.start;
str2 = e_util_memdup(&(entry->buffer[entry->select.start]), len + 1); str2 = e_util_memdup(&(entry->buffer[entry->select.start]), len + 1);
str2[len] = 0; str2[len] = 0;

View File

@ -10,9 +10,11 @@ struct _E_Entry
Evas evas; Evas evas;
char *buffer; char *buffer;
int cursor_pos; int cursor_pos;
struct { struct
{
int start, length, down; int start, length, down;
} select; }
select;
int mouse_down; int mouse_down;
int visible; int visible;
int focused; int focused;
@ -28,17 +30,16 @@ struct _E_Entry
Window paste_win; Window paste_win;
Window selection_win; Window selection_win;
int end_width; int end_width;
void (*func_changed) (E_Entry *entry, void *data); void (*func_changed) (E_Entry * entry, void *data);
void *data_changed; void *data_changed;
void (*func_enter) (E_Entry *entry, void *data); void (*func_enter) (E_Entry * entry, void *data);
void *data_enter; void *data_enter;
void (*func_focus_in) (E_Entry *entry, void *data); void (*func_focus_in) (E_Entry * entry, void *data);
void *data_focus_in; void *data_focus_in;
void (*func_focus_out) (E_Entry *entry, void *data); void (*func_focus_out) (E_Entry * entry, void *data);
void *data_focus_out; void *data_focus_out;
}; };
/** /**
* e_entry_init - Text entry widget event handler initialization. * e_entry_init - Text entry widget event handler initialization.
* *
@ -47,36 +48,51 @@ struct _E_Entry
*/ */
void e_entry_init(void); void e_entry_init(void);
void e_entry_free(E_Entry *entry); void e_entry_free(E_Entry * entry);
E_Entry *e_entry_new(void); E_Entry *e_entry_new(void);
void e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e); void e_entry_handle_keypress(E_Entry * entry,
void e_entry_set_evas(E_Entry *entry, Evas evas); Ecore_Event_Key_Down * e);
void e_entry_show(E_Entry *entry); void e_entry_set_evas(E_Entry * entry, Evas evas);
void e_entry_hide(E_Entry *entry); void e_entry_show(E_Entry * entry);
void e_entry_raise(E_Entry *entry); void e_entry_hide(E_Entry * entry);
void e_entry_lower(E_Entry *entry); void e_entry_raise(E_Entry * entry);
void e_entry_set_layer(E_Entry *entry, int l); void e_entry_lower(E_Entry * entry);
void e_entry_set_clip(E_Entry *entry, Evas_Object clip); void e_entry_set_layer(E_Entry * entry, int l);
void e_entry_unset_clip(E_Entry *entry); void e_entry_set_clip(E_Entry * entry, Evas_Object clip);
void e_entry_move(E_Entry *entry, int x, int y); void e_entry_unset_clip(E_Entry * entry);
void e_entry_resize(E_Entry *entry, int w, int h); void e_entry_move(E_Entry * entry, int x, int y);
void e_entry_query_max_size(E_Entry *entry, int *w, int *h); void e_entry_resize(E_Entry * entry, int w, int h);
void e_entry_max_size(E_Entry *entry, int *w, int *h); void e_entry_query_max_size(E_Entry * entry, int *w, int *h);
void e_entry_min_size(E_Entry *entry, int *w, int *h); void e_entry_max_size(E_Entry * entry, int *w, int *h);
void e_entry_set_size(E_Entry *entry, int w, int h); void e_entry_min_size(E_Entry * entry, int *w, int *h);
void e_entry_set_focus(E_Entry *entry, int focused); void e_entry_set_size(E_Entry * entry, int w, int h);
void e_entry_set_text(E_Entry *entry, const char *text); void e_entry_set_focus(E_Entry * entry, int focused);
const char *e_entry_get_text(E_Entry *entry); void e_entry_set_text(E_Entry * entry, const char *text);
void e_entry_set_cursor(E_Entry *entry, int cursor_pos); const char *e_entry_get_text(E_Entry * entry);
int e_entry_get_cursor(E_Entry *entry); void e_entry_set_cursor(E_Entry * entry, int cursor_pos);
void e_entry_set_changed_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data); int e_entry_get_cursor(E_Entry * entry);
void e_entry_set_enter_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data); void e_entry_set_changed_callback(E_Entry * entry,
void e_entry_set_focus_in_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data); void (*func) (E_Entry * _entry,
void e_entry_set_focus_out_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data); void *_data),
void e_entry_insert_text(E_Entry *entry, char *text); void *data);
void e_entry_clear_selection(E_Entry *entry); void e_entry_set_enter_callback(E_Entry * entry,
void e_entry_delete_to_left(E_Entry *entry); void (*func) (E_Entry * _entry,
void e_entry_delete_to_right(E_Entry *entry); void *_data),
char *e_entry_get_selection(E_Entry *entry); void *data);
void e_entry_set_focus_in_callback(E_Entry * entry,
void (*func) (E_Entry *
_entry,
void *_data),
void *data);
void e_entry_set_focus_out_callback(E_Entry * entry,
void (*func) (E_Entry *
_entry,
void *_data),
void *data);
void e_entry_insert_text(E_Entry * entry, char *text);
void e_entry_clear_selection(E_Entry * entry);
void e_entry_delete_to_left(E_Entry * entry);
void e_entry_delete_to_right(E_Entry * entry);
char *e_entry_get_selection(E_Entry * entry);
#endif #endif

View File

@ -6,20 +6,20 @@
#include "e_ferite.h" #include "e_ferite.h"
static void e_epplet_cleanup(E_Epplet *epp); static void e_epplet_cleanup(E_Epplet * epp);
static void e_epplet_mouse_down_cb (void *_data, Ebits_Object _o, static void e_epplet_mouse_down_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh); int _ox, int _oy, int _ow, int _oh);
static void e_epplet_mouse_up_cb (void *_data, Ebits_Object _o, static void e_epplet_mouse_up_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh); int _ox, int _oy, int _ow, int _oh);
static void e_epplet_mouse_move_cb (void *_data, Ebits_Object _o, static void e_epplet_mouse_move_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh); int _ox, int _oy, int _ow, int _oh);
static void e_epplet_observer_cleanup(E_Object *o); static void e_epplet_observer_cleanup(E_Object * o);
E_Epplet * E_Epplet *
e_epplet_new(void *scr) e_epplet_new(void *scr)
@ -31,7 +31,7 @@ e_epplet_new(void *scr)
D_ENTER; D_ENTER;
script = (FeriteScript *)scr; script = (FeriteScript *) scr;
epp = NEW(E_Epplet, 1); epp = NEW(E_Epplet, 1);
ZERO(epp, E_Epplet, 1); ZERO(epp, E_Epplet, 1);
@ -71,7 +71,7 @@ e_epplet_new(void *scr)
} }
static void static void
e_epplet_cleanup(E_Epplet *epp) e_epplet_cleanup(E_Epplet * epp)
{ {
Evas_List l; Evas_List l;
@ -81,25 +81,29 @@ e_epplet_cleanup(E_Epplet *epp)
for (l = epp->ebits; l; l = l->next) for (l = epp->ebits; l; l = l->next)
{ {
Ebits_Object o = l->data; Ebits_Object o = l->data;
ebits_free(o); ebits_free(o);
} }
for (l = epp->evas_objects; l; l = l->next) for (l = epp->evas_objects; l; l = l->next)
{ {
Evas_Object_Wrapper *o = l->data; Evas_Object_Wrapper *o = l->data;
evas_del_object(o->evas, o->obj); evas_del_object(o->evas, o->obj);
free(o); free(o);
} }
if (epp->layout) ebits_free(epp->layout); if (epp->layout)
if (epp->ui) ebits_free(epp->ui); ebits_free(epp->layout);
if (epp->ui)
ebits_free(epp->ui);
#endif #endif
D_RETURN; D_RETURN;
} }
void void
e_epplet_load_from_layout (E_View * v) e_epplet_load_from_layout(E_View * v)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
Evas_List bit_names, l; Evas_List bit_names, l;
@ -107,27 +111,27 @@ e_epplet_load_from_layout (E_View * v)
D_ENTER; D_ENTER;
#ifdef USE_FERITE #ifdef USE_FERITE
snprintf (buf, PATH_MAX, "%s/.e_epplets.bits.db", v->dir); snprintf(buf, PATH_MAX, "%s/.e_epplets.bits.db", v->dir);
v->epplet_layout = ebits_load (buf); v->epplet_layout = ebits_load(buf);
if (!v->epplet_layout) if (!v->epplet_layout)
D_RETURN; D_RETURN;
ebits_add_to_evas (v->epplet_layout, v->evas); ebits_add_to_evas(v->epplet_layout, v->evas);
ebits_resize (v->epplet_layout, v->size.w, v->size.h); ebits_resize(v->epplet_layout, v->size.w, v->size.h);
ebits_move (v->epplet_layout, 0, 0); ebits_move(v->epplet_layout, 0, 0);
bit_names = ebits_get_bit_names (v->epplet_layout); bit_names = ebits_get_bit_names(v->epplet_layout);
for (l = bit_names; l; l = l->next) for (l = bit_names; l; l = l->next)
{ {
double x, y, w, h; double x, y, w, h;
E_Epplet_Context *context; E_Epplet_Context *context;
context = NEW (E_Epplet_Context, 1); context = NEW(E_Epplet_Context, 1);
ZERO (context, E_Epplet_Context, 1); ZERO(context, E_Epplet_Context, 1);
context->name = l->data; context->name = l->data;
ebits_get_named_bit_geometry (v->epplet_layout, context->name, &x, &y, ebits_get_named_bit_geometry(v->epplet_layout, context->name, &x, &y,
&w, &h); &w, &h);
context->geom.x = x; context->geom.x = x;
@ -135,33 +139,31 @@ e_epplet_load_from_layout (E_View * v)
context->geom.w = w; context->geom.w = w;
context->geom.h = h; context->geom.h = h;
context->view = v; context->view = v;
D ("epplet has following info:\n"); D("epplet has following info:\n");
D ("x: %f, y: %f, w: %f, h: %f\n", x, y, w, h); D("x: %f, y: %f, w: %f, h: %f\n", x, y, w, h);
v->epplet_contexts = evas_list_append (v->epplet_contexts, context); v->epplet_contexts = evas_list_append(v->epplet_contexts, context);
snprintf (buf, PATH_MAX, "%s/.e_epplets/%s/%s.fe", v->dir, context->name, snprintf(buf, PATH_MAX, "%s/.e_epplets/%s/%s.fe", v->dir, context->name,
context->name); context->name);
if (e_file_exists (buf)) if (e_file_exists(buf))
e_epplet_script_load (context, buf); e_epplet_script_load(context, buf);
else else
D ("Error: Can't find epplet `%s'\n", buf); D("Error: Can't find epplet `%s'\n", buf);
} }
#endif #endif
D_RETURN; D_RETURN;
} }
E_Epplet_Context * E_Epplet_Context *
e_epplet_get_context_from_script (FeriteScript * script) e_epplet_get_context_from_script(FeriteScript * script)
{ {
Evas_List l, ll; Evas_List l, ll;
D_ENTER; D_ENTER;
D ("script address: %p\n", script); D("script address: %p\n", script);
#ifdef USE_FERITE #ifdef USE_FERITE
for (l = views; l; l = l->next) for (l = views; l; l = l->next)
@ -169,58 +171,57 @@ e_epplet_get_context_from_script (FeriteScript * script)
E_View *v; E_View *v;
v = l->data; v = l->data;
D ("searching view: %s\n", v->dir); D("searching view: %s\n", v->dir);
if (v->epplet_contexts == NULL) if (v->epplet_contexts == NULL)
D ("no scripts in view\n"); D("no scripts in view\n");
for (ll = v->epplet_contexts; ll; ll = ll->next) for (ll = v->epplet_contexts; ll; ll = ll->next)
{ {
E_Epplet_Context *context = ll->data; E_Epplet_Context *context = ll->data;
D ("found script: %p\n", context->script);
D("found script: %p\n", context->script);
if (context->script == script) if (context->script == script)
D_RETURN_ (context); D_RETURN_(context);
} }
} }
#endif #endif
D_RETURN_ (NULL); D_RETURN_(NULL);
} }
void void
e_epplet_script_load (E_Epplet_Context * context, char *path) e_epplet_script_load(E_Epplet_Context * context, char *path)
{ {
FeriteScript *script = NULL; FeriteScript *script = NULL;
D_ENTER; D_ENTER;
#ifdef USE_FERITE #ifdef USE_FERITE
D ("Ferite: Compiling epplet script `%s'\n", path); D("Ferite: Compiling epplet script `%s'\n", path);
script = ferite_script_compile (path); script = ferite_script_compile(path);
if (!script) if (!script)
{ {
D ("Error compiling script... aborting\n"); D("Error compiling script... aborting\n");
D_RETURN; D_RETURN;
} }
context->script = script; context->script = script;
e_ferite_register (script, script->mainns); e_ferite_register(script, script->mainns);
script->error_cb = e_ferite_script_error; script->error_cb = e_ferite_script_error;
script->warning_cb = e_ferite_script_warning; script->warning_cb = e_ferite_script_warning;
D ("Ferite: executing epplet.\n"); D("Ferite: executing epplet.\n");
ferite_script_execute (script); ferite_script_execute(script);
D ("Ferite: epplet executed.\n"); D("Ferite: epplet executed.\n");
/*ferite_script_delete(script); */ /*ferite_script_delete(script); */
#endif #endif
D_RETURN; D_RETURN;
} }
void void
e_epplet_set_common_callbacks (E_Epplet * epp) e_epplet_set_common_callbacks(E_Epplet * epp)
{ {
/* /*
D ("setting callbacks\n"); D ("setting callbacks\n");
@ -232,7 +233,6 @@ e_epplet_set_common_callbacks (E_Epplet * epp)
D_RETURN; D_RETURN;
} }
ebits_set_classed_bit_callback (epp->bits, "Title_Bar", ebits_set_classed_bit_callback (epp->bits, "Title_Bar",
CALLBACK_MOUSE_DOWN, e_epplet_mouse_down_cb, CALLBACK_MOUSE_DOWN, e_epplet_mouse_down_cb,
epp); epp);
@ -276,7 +276,7 @@ e_epplet_set_common_callbacks (E_Epplet * epp)
} }
static void static void
e_epplet_mouse_down_cb (void *_data, Ebits_Object _o, e_epplet_mouse_down_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh) int _ox, int _oy, int _ow, int _oh)
{ {
@ -287,14 +287,14 @@ e_epplet_mouse_down_cb (void *_data, Ebits_Object _o,
#ifdef USE_FERITE #ifdef USE_FERITE
epp = _data; epp = _data;
if (!strcmp (_c, "Title_Bar")) if (!strcmp(_c, "Title_Bar"))
{ {
epp->state.moving = 1; epp->state.moving = 1;
epp->offset.x = _x - epp->current.x; epp->offset.x = _x - epp->current.x;
epp->offset.y = _y - epp->current.y; epp->offset.y = _y - epp->current.y;
} }
if (!strcmp (_c, "Resize")) if (!strcmp(_c, "Resize"))
{ {
if (_x < epp->current.x + (epp->current.w / 2)) if (_x < epp->current.x + (epp->current.w / 2))
{ {
@ -319,7 +319,7 @@ e_epplet_mouse_down_cb (void *_data, Ebits_Object _o,
} }
if (!strcmp (_c, "Resize_Horizontal")) if (!strcmp(_c, "Resize_Horizontal"))
{ {
if (_x < epp->current.x + (epp->current.w / 2)) if (_x < epp->current.x + (epp->current.w / 2))
{ {
@ -333,7 +333,7 @@ e_epplet_mouse_down_cb (void *_data, Ebits_Object _o,
} }
} }
if (!strcmp (_c, "Resize_Vertical")) if (!strcmp(_c, "Resize_Vertical"))
{ {
if (_y < epp->current.y + (epp->current.h / 2)) if (_y < epp->current.y + (epp->current.h / 2))
{ {
@ -351,10 +351,8 @@ e_epplet_mouse_down_cb (void *_data, Ebits_Object _o,
D_RETURN; D_RETURN;
} }
static void static void
e_epplet_mouse_up_cb (void *_data, Ebits_Object _o, e_epplet_mouse_up_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh) int _ox, int _oy, int _ow, int _oh)
{ {
@ -365,12 +363,12 @@ e_epplet_mouse_up_cb (void *_data, Ebits_Object _o,
#ifdef USE_FERITE #ifdef USE_FERITE
epp = _data; epp = _data;
if (!strcmp (_c, "Title_Bar")) if (!strcmp(_c, "Title_Bar"))
{ {
epp->state.moving = 0; epp->state.moving = 0;
} }
if (!strncmp (_c, "Resize", 6)) if (!strncmp(_c, "Resize", 6))
{ {
epp->state.resizing.up = 0; epp->state.resizing.up = 0;
epp->state.resizing.down = 0; epp->state.resizing.down = 0;
@ -382,7 +380,7 @@ e_epplet_mouse_up_cb (void *_data, Ebits_Object _o,
} }
static void static void
e_epplet_mouse_move_cb (void *_data, Ebits_Object _o, e_epplet_mouse_move_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh) int _ox, int _oy, int _ow, int _oh)
{ {
@ -490,9 +488,9 @@ e_epplet_mouse_move_cb (void *_data, Ebits_Object _o,
D_RETURN; D_RETURN;
} }
E_Epplet_CB_Info * E_Epplet_CB_Info *
e_epplet_cb_new( FeriteScript *script, char *func_name, FeriteObject *data, FeriteObject *data2 ) e_epplet_cb_new(FeriteScript * script, char *func_name, FeriteObject * data,
FeriteObject * data2)
{ {
E_Epplet_CB_Info *cb; E_Epplet_CB_Info *cb;
FeriteNamespaceBucket *nsb; FeriteNamespaceBucket *nsb;
@ -503,7 +501,7 @@ e_epplet_cb_new( FeriteScript *script, char *func_name, FeriteObject *data, Feri
cb = NEW(E_Epplet_CB_Info, 1); cb = NEW(E_Epplet_CB_Info, 1);
ZERO(cb, E_Epplet_CB_Info, 1); ZERO(cb, E_Epplet_CB_Info, 1);
nsb = __ferite_find_namespace( script, script->mainns, func_name, FENS_FNC); nsb = __ferite_find_namespace(script, script->mainns, func_name, FENS_FNC);
if (nsb != NULL) if (nsb != NULL)
{ {
cb->func = nsb->data; cb->func = nsb->data;
@ -525,7 +523,7 @@ e_epplet_cb_new( FeriteScript *script, char *func_name, FeriteObject *data, Feri
} }
void void
e_epplet_cb_cleanup(E_Epplet_CB_Info *cb) e_epplet_cb_cleanup(E_Epplet_CB_Info * cb)
{ {
#ifdef USE_FERITE #ifdef USE_FERITE
if (cb->data) if (cb->data)
@ -543,7 +541,7 @@ e_epplet_cb_cleanup(E_Epplet_CB_Info *cb)
} }
void void
e_epplet_bits_cb (void *_data, Ebits_Object _o, e_epplet_bits_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y, char *_c, int _b, int _x, int _y,
int _ox, int _oy, int _ow, int _oh) int _ox, int _oy, int _ow, int _oh)
{ {
@ -555,12 +553,17 @@ e_epplet_bits_cb (void *_data, Ebits_Object _o,
#ifdef USE_FERITE #ifdef USE_FERITE
cb = _data; cb = _data;
if (cb->script) { if (cb->script)
{
D("creating params and calling func\n"); D("creating params and calling func\n");
params = __ferite_create_parameter_list_from_data( cb->script, "osnnnnnnn", params =
cb->data, _c, _b, _x, _y, _ox, _oy, _ow, _oh ); __ferite_create_parameter_list_from_data(cb->script, "osnnnnnnn",
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params)); cb->data, _c, _b, _x, _y,
__ferite_delete_parameter_list( cb->script, params ); _ox, _oy, _ow, _oh);
__ferite_variable_destroy(cb->script,
__ferite_call_function(cb->script, cb->func,
params));
__ferite_delete_parameter_list(cb->script, params);
D("func called, params deleted\n"); D("func called, params deleted\n");
} }
else else
@ -573,9 +576,7 @@ e_epplet_bits_cb (void *_data, Ebits_Object _o,
} }
void void
e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o, e_epplet_evas_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
int _b, int _x, int _y)
{ {
E_Epplet_CB_Info *cb; E_Epplet_CB_Info *cb;
FeriteVariable **params; FeriteVariable **params;
@ -587,13 +588,19 @@ e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o,
D("d1: %s, d2: %s\n", cb->data->name, cb->data2->name); D("d1: %s, d2: %s\n", cb->data->name, cb->data2->name);
if (cb->script) { if (cb->script)
{
D("creating params\n"); D("creating params\n");
params = __ferite_create_parameter_list_from_data( cb->script, "oonnn", params = __ferite_create_parameter_list_from_data(cb->script, "oonnn",
cb->data, cb->data2, (double)_b, (double)_x, (double)_y ); cb->data, cb->data2,
(double)_b,
(double)_x,
(double)_y);
D("calling func: %s\n", cb->func->name); D("calling func: %s\n", cb->func->name);
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params)); __ferite_variable_destroy(cb->script,
__ferite_delete_parameter_list( cb->script, params ); __ferite_call_function(cb->script, cb->func,
params));
__ferite_delete_parameter_list(cb->script, params);
D("func called, params deleted\n"); D("func called, params deleted\n");
} }
else else
@ -617,13 +624,16 @@ e_epplet_timer_func(int val, void *data)
/* D("in timer func\n"); */ /* D("in timer func\n"); */
cb = data; cb = data;
if (cb->script) { if (cb->script)
{
/* D("creating params\n"); */ /* D("creating params\n"); */
params = __ferite_create_parameter_list_from_data( cb->script, "on", params = __ferite_create_parameter_list_from_data(cb->script, "on",
cb->data, (float)val ); cb->data, (float)val);
/* D("calling func\n"); */ /* D("calling func\n"); */
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params)); __ferite_variable_destroy(cb->script,
__ferite_delete_parameter_list( cb->script, params ); __ferite_call_function(cb->script, cb->func,
params));
__ferite_delete_parameter_list(cb->script, params);
/* D("func called, params deleted\n"); */ /* D("func called, params deleted\n"); */
} }
else else
@ -637,7 +647,8 @@ e_epplet_timer_func(int val, void *data)
} }
E_Epplet_Observer * E_Epplet_Observer *
e_epplet_observer_new(FeriteScript *script, char *func_name, FeriteObject *data, char *event_type) e_epplet_observer_new(FeriteScript * script, char *func_name,
FeriteObject * data, char *event_type)
{ {
E_Epplet_Observer *obs = NULL; E_Epplet_Observer *obs = NULL;
FeriteNamespaceBucket *nsb; FeriteNamespaceBucket *nsb;
@ -651,30 +662,30 @@ e_epplet_observer_new(FeriteScript *script, char *func_name, FeriteObject *data,
if (!strcmp(event_type, "DESKTOP_SWITCH")) if (!strcmp(event_type, "DESKTOP_SWITCH"))
e_observer_init(E_OBSERVER(obs), E_EVENT_DESKTOP_SWITCH, e_observer_init(E_OBSERVER(obs), E_EVENT_DESKTOP_SWITCH,
e_epplet_desktop_observer_func, e_epplet_desktop_observer_func,
(E_Cleanup_Func)e_epplet_observer_cleanup); (E_Cleanup_Func) e_epplet_observer_cleanup);
#if 0 #if 0
else if (!strcmp(event_type, "ICONIFY")) else if (!strcmp(event_type, "ICONIFY"))
e_observer_init(E_OBSERVER(obs), E_EVENT_BORDER_ICONIFY, e_observer_init(E_OBSERVER(obs), E_EVENT_BORDER_ICONIFY,
e_epplet_border_observer_func, e_epplet_border_observer_func,
(E_Cleanup_Func)e_epplet_observer_cleanup); (E_Cleanup_Func) e_epplet_observer_cleanup);
else if (!strcmp(event_type, "UNICONIFY")) else if (!strcmp(event_type, "UNICONIFY"))
e_observer_init(E_OBSERVER(obs), E_EVENT_BORDER_UNICONIFY, e_observer_init(E_OBSERVER(obs), E_EVENT_BORDER_UNICONIFY,
e_epplet_border_observer_func, e_epplet_border_observer_func,
(E_Cleanup_Func)e_epplet_observer_cleanup); (E_Cleanup_Func) e_epplet_observer_cleanup);
else else
e_observer_init(E_OBSERVER(obs), E_EVENT_MAX, e_observer_init(E_OBSERVER(obs), E_EVENT_MAX,
e_epplet_desktop_observer_func, e_epplet_desktop_observer_func,
(E_Cleanup_Func)e_epplet_observer_cleanup); (E_Cleanup_Func) e_epplet_observer_cleanup);
#endif #endif
nsb = __ferite_find_namespace( script, script->mainns, func_name, FENS_FNC); nsb = __ferite_find_namespace(script, script->mainns, func_name, FENS_FNC);
if (nsb != NULL) if (nsb != NULL)
{ {
obs->script = script; obs->script = script;
obs->func = nsb->data; obs->func = nsb->data;
if (data) if (data)
{ {
((E_Epplet_Observer *)obs)->data = data; ((E_Epplet_Observer *) obs)->data = data;
data->refcount++; data->refcount++;
} }
} }
@ -684,7 +695,7 @@ e_epplet_observer_new(FeriteScript *script, char *func_name, FeriteObject *data,
} }
static void static void
e_epplet_observer_cleanup(E_Object *o) e_epplet_observer_cleanup(E_Object * o)
{ {
#ifdef USE_FERITE #ifdef USE_FERITE
/*FIXME: we need something here!!! Leeeeaky! */ /*FIXME: we need something here!!! Leeeeaky! */
@ -692,7 +703,7 @@ e_epplet_observer_cleanup(E_Object *o)
} }
void void
e_epplet_observer_register_desktops(E_Epplet_Observer *obs) e_epplet_observer_register_desktops(E_Epplet_Observer * obs)
{ {
Evas_List l; Evas_List l;
@ -703,16 +714,16 @@ e_epplet_observer_register_desktops(E_Epplet_Observer *obs)
for (l = e_desktops_get_desktops_list(); l; l = l->next) for (l = e_desktops_get_desktops_list(); l; l = l->next)
{ {
E_Desktop *d = l->data; E_Desktop *d = l->data;
D("registering desktop...\n") D("registering desktop...\n")
e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(d)); e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(d));
D("desktop registered\n") D("desktop registered\n")}
}
#endif #endif
D_RETURN; D_RETURN;
} }
#if 0 #if 0
void void
e_epplet_observer_register_borders(E_Epplet_Observer *obs) e_epplet_observer_register_borders(E_Epplet_Observer * obs)
{ {
Evas_List l; Evas_List l;
@ -721,17 +732,18 @@ e_epplet_observer_register_borders(E_Epplet_Observer *obs)
for (l = e_border_get_borders_list(); l; l = l->next) for (l = e_border_get_borders_list(); l; l = l->next)
{ {
E_Border *b = l->data; E_Border *b = l->data;
D("registering desktop...\n") D("registering desktop...\n")
e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(b)); e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(b));
D("desktop registered\n") D("desktop registered\n")}
}
#endif #endif
D_RETURN; D_RETURN;
} }
#endif #endif
void void
e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee, E_Event_Type event) e_epplet_desktop_observer_func(E_Observer * observer, E_Observee * observee,
E_Event_Type event)
{ {
E_Epplet_Observer *obs; E_Epplet_Observer *obs;
E_Desktop *desk; E_Desktop *desk;
@ -740,8 +752,8 @@ e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee, E_Eve
D_ENTER; D_ENTER;
#ifdef USE_FERITE #ifdef USE_FERITE
obs = (E_Epplet_Observer *)observer; obs = (E_Epplet_Observer *) observer;
desk = (E_Desktop *)observee; desk = (E_Desktop *) observee;
D("desktop: %i\n", desk->desk.desk); D("desktop: %i\n", desk->desk.desk);
D("current: %i\n", e_desktops_get_current()); D("current: %i\n", e_desktops_get_current());
@ -749,13 +761,16 @@ e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee, E_Eve
{ {
D("creating params\n"); D("creating params\n");
params = __ferite_create_parameter_list_from_data( obs->script, "on", params = __ferite_create_parameter_list_from_data(obs->script, "on",
obs->data, (float)(desk->desk.desk) ); obs->data,
(float)(desk->desk.
desk));
D("calling func: %s\n", obs->func->name); D("calling func: %s\n", obs->func->name);
__ferite_variable_destroy( obs->script, __ferite_call_function( __ferite_variable_destroy(obs->script,
obs->script, obs->func, params)); __ferite_call_function(obs->script, obs->func,
params));
D("function called\n"); D("function called\n");
__ferite_delete_parameter_list( obs->script, params ); __ferite_delete_parameter_list(obs->script, params);
D("func called, params deleted\n"); D("func called, params deleted\n");
} }
else else
@ -768,7 +783,7 @@ e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee, E_Eve
#if 0 /* don't use this, its currently broken */ #if 0 /* don't use this, its currently broken */
void void
e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee) e_epplet_border_observer_func(E_Observer * observer, E_Observee * observee)
{ {
E_Epplet_Observer *obs; E_Epplet_Observer *obs;
E_Border *b; E_Border *b;
@ -777,23 +792,24 @@ e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee)
D_ENTER; D_ENTER;
#ifdef USE_FERITE #ifdef USE_FERITE
obs = (E_Epplet_Observer *)observer; obs = (E_Epplet_Observer *) observer;
b = (E_Border *)observee; b = (E_Border *) observee;
obs->data->odata = b; obs->data->odata = b;
if (obs->script) if (obs->script)
{ {
/*D("creating params\n");*/ /*D("creating params\n"); */
params = __ferite_create_parameter_list_from_data( obs->script, "o", params = __ferite_create_parameter_list_from_data(obs->script, "o",
obs->data ); obs->data);
/*D("calling func: %s\n", obs->func->name);*/ /*D("calling func: %s\n", obs->func->name); */
__ferite_variable_destroy( obs->script, __ferite_call_function( __ferite_variable_destroy(obs->script,
obs->script, obs->func, params)); __ferite_call_function(obs->script, obs->func,
/*D("function called\n");*/ params));
__ferite_delete_parameter_list( obs->script, params ); /*D("function called\n"); */
/*D("func called, params deleted\n");*/ __ferite_delete_parameter_list(obs->script, params);
/*D("func called, params deleted\n"); */
} }
else else
{ {
@ -803,4 +819,3 @@ e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee)
D_RETURN; D_RETURN;
} }
#endif #endif

View File

@ -37,13 +37,14 @@ struct _E_Epplet_Context
E_Epplet *epp; E_Epplet *epp;
struct { struct
{
double x, y; double x, y;
double w, h; double w, h;
} geom; }
geom;
}; };
struct _E_Epplet struct _E_Epplet
{ {
E_Object o; E_Object o;
@ -56,19 +57,24 @@ struct _E_Epplet
Ebits_Object layout; Ebits_Object layout;
Ebits_Object ui; Ebits_Object ui;
struct
struct { {
double x, y; double x, y;
double w, h; double w, h;
} current, requested, offset; }
current , requested, offset;
struct { struct
{
int changed; int changed;
int moving; int moving;
struct { struct
{
int up, down, left, right; int up, down, left, right;
}resizing; }
} state; resizing;
}
state;
Evas_List evas_objects; Evas_List evas_objects;
Evas_List ebits; Evas_List ebits;
@ -83,33 +89,34 @@ struct _Evas_Object_Wrapper
/* epplet loading / cleanup */ /* epplet loading / cleanup */
E_Epplet *e_epplet_new(); E_Epplet *e_epplet_new();
void e_epplet_load_from_layout(E_View *v); void e_epplet_load_from_layout(E_View * v);
void e_epplet_script_load(E_Epplet_Context *v, char *script_path); void e_epplet_script_load(E_Epplet_Context * v,
E_Epplet_Context *e_epplet_get_context_from_script(FeriteScript *script); char *script_path);
E_Epplet_Context *e_epplet_get_context_from_script(FeriteScript * script);
/* probably won't use this... */ /* probably won't use this... */
void e_epplet_set_common_callbacks(E_Epplet *epp); void e_epplet_set_common_callbacks(E_Epplet * epp);
/* callbacks */ /* callbacks */
E_Epplet_CB_Info *e_epplet_cb_new( FeriteScript *script, char *func_name, E_Epplet_CB_Info *e_epplet_cb_new(FeriteScript * script, char *func_name,
FeriteObject *data, FeriteObject *data2 ); FeriteObject * data, FeriteObject * data2);
void e_epplet_cb_cleanup( E_Epplet_CB_Info *cb); void e_epplet_cb_cleanup(E_Epplet_CB_Info * cb);
void e_epplet_bits_cb (void *_data, Ebits_Object _o, char *_c, void e_epplet_bits_cb(void *_data, Ebits_Object _o, char *_c,
int _b, int _x, int _y, int _ox, int _oy, int _b, int _x, int _y, int _ox, int _oy,
int _ow, int _oh); int _ow, int _oh);
void e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o, void e_epplet_evas_cb(void *_data, Evas _e, Evas_Object _o,
int _b, int _x, int _y); int _b, int _x, int _y);
/* timers */ /* timers */
void e_epplet_timer_func(int val, void *data); void e_epplet_timer_func(int val, void *data);
/* Observers */ /* Observers */
E_Epplet_Observer *e_epplet_observer_new( FeriteScript *script, E_Epplet_Observer *e_epplet_observer_new(FeriteScript * script,
char *func_name, FeriteObject *data, char *func_name, FeriteObject * data,
char *event_type); char *event_type);
void e_epplet_observer_register_desktops(E_Epplet_Observer *obs); void e_epplet_observer_register_desktops(E_Epplet_Observer *
void e_epplet_desktop_observer_func(E_Observer *observer, obs);
E_Observee *observee, void e_epplet_desktop_observer_func(E_Observer * observer,
E_Observee * observee,
E_Event_Type event); E_Event_Type event);
/*void e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee);*/ /*void e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee);*/

View File

@ -35,7 +35,7 @@ e_exec_broadcast_cb_del(void *cbp)
{ {
E_Hack_Found_CB *cb; E_Hack_Found_CB *cb;
cb = (E_Hack_Found_CB *)cbp; cb = (E_Hack_Found_CB *) cbp;
cb->dirty = 1; cb->dirty = 1;
} }
@ -152,7 +152,8 @@ e_exec_run_in_dir(char *exe, char *dir)
} }
pid_t pid_t
e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, char *launch_path) e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env,
char *launch_path)
{ {
static int launch_id = 0; static int launch_id = 0;
char preload_paths[PATH_MAX]; char preload_paths[PATH_MAX];
@ -163,9 +164,11 @@ e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, cha
D_ENTER; D_ENTER;
launch_id++; launch_id++;
if (launch_id_ret) *launch_id_ret = launch_id; if (launch_id_ret)
*launch_id_ret = launch_id;
pid = fork(); pid = fork();
if (pid) D_RETURN_(pid); if (pid)
D_RETURN_(pid);
chdir(dir); chdir(dir);
setsid(); setsid();
if (env) if (env)
@ -179,13 +182,13 @@ e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, cha
/* launch Id hack - if it's an X program the windows popped up should */ /* launch Id hack - if it's an X program the windows popped up should */
/* have this launch Id number set on them - as well as process ID */ /* have this launch Id number set on them - as well as process ID */
/* machine name, and user name */ /* machine name, and user name */
if (launch_path) e_util_set_env("E_HACK_LAUNCH_PATH", launch_path); if (launch_path)
e_util_set_env("E_HACK_LAUNCH_PATH", launch_path);
snprintf(preload_paths, PATH_MAX, "E_HACK_LAUNCH_ID=%i LD_PRELOAD_PATH='%s'", snprintf(preload_paths, PATH_MAX, "E_HACK_LAUNCH_ID=%i LD_PRELOAD_PATH='%s'",
launch_id, PACKAGE_LIB_DIR); launch_id, PACKAGE_LIB_DIR);
snprintf(preload, PATH_MAX, "LD_PRELOAD='libehack.so libX11.so libdl.so'"); snprintf(preload, PATH_MAX, "LD_PRELOAD='libehack.so libX11.so libdl.so'");
exe2 = malloc(strlen(exe) + 1 + exe2 = malloc(strlen(exe) + 1 +
strlen(preload_paths) + 1 + strlen(preload_paths) + 1 + strlen(preload) + 1);
strlen(preload) + 1);
snprintf(exe2, PATH_MAX, "%s %s %s", preload_paths, preload, exe); snprintf(exe2, PATH_MAX, "%s %s %s", preload_paths, preload, exe);
execl("/bin/sh", "/bin/sh", "-c", exe2, NULL); execl("/bin/sh", "/bin/sh", "-c", exe2, NULL);

View File

@ -3,13 +3,16 @@
#include "e.h" #include "e.h"
void *e_exec_broadcast_cb_add(void (*func) (Window win, void *data), void *data); void
*e_exec_broadcast_cb_add(void (*func) (Window win, void *data), void *data);
void e_exec_broadcast_cb_del(void *cb); void e_exec_broadcast_cb_del(void *cb);
void e_exec_broadcast_e_hack_found(Window win); void e_exec_broadcast_e_hack_found(Window win);
void e_exec_set_args(int argc, char **argv); void e_exec_set_args(int argc, char **argv);
void e_exec_restart(void); void e_exec_restart(void);
pid_t e_exec_run(char *exe); pid_t e_exec_run(char *exe);
pid_t e_exec_run_in_dir(char *exe, char *dir); pid_t e_exec_run_in_dir(char *exe, char *dir);
pid_t e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env, char *launch_path); pid_t e_exec_in_dir_with_env(char *exe, char *dir,
int *launch_id_ret, char **env,
char *launch_path);
#endif #endif

View File

@ -10,7 +10,8 @@ e_file_mod_time(char *file)
D_ENTER; D_ENTER;
if (stat(file, &st) < 0) D_RETURN_(0); if (stat(file, &st) < 0)
D_RETURN_(0);
D_RETURN_(st.st_mtime); D_RETURN_(st.st_mtime);
} }
@ -22,7 +23,8 @@ e_file_exists(char *file)
D_ENTER; D_ENTER;
if (stat(file, &st) < 0) D_RETURN_(0); if (stat(file, &st) < 0)
D_RETURN_(0);
D_RETURN_(1); D_RETURN_(1);
} }
@ -34,20 +36,24 @@ e_file_is_dir(char *file)
D_ENTER; D_ENTER;
if (stat(file, &st) < 0) D_RETURN_(0); if (stat(file, &st) < 0)
if (S_ISDIR(st.st_mode)) D_RETURN_(1); D_RETURN_(0);
if (S_ISDIR(st.st_mode))
D_RETURN_(1);
D_RETURN_(0); D_RETURN_(0);
} }
static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; static mode_t default_mode =
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
int int
e_file_mkdir(char *dir) e_file_mkdir(char *dir)
{ {
D_ENTER; D_ENTER;
if (mkdir(dir, default_mode) < 0) D_RETURN_(0); if (mkdir(dir, default_mode) < 0)
D_RETURN_(0);
D_RETURN_(1); D_RETURN_(1);
} }
@ -62,14 +68,16 @@ e_file_cp(char *src, char *dst)
D_ENTER; D_ENTER;
f1 = fopen(src, "rb"); f1 = fopen(src, "rb");
if (!f1) D_RETURN_(0); if (!f1)
D_RETURN_(0);
f2 = fopen(dst, "wb"); f2 = fopen(dst, "wb");
if (!f2) if (!f2)
{ {
fclose(f1); fclose(f1);
D_RETURN_(0); D_RETURN_(0);
} }
while ((num = fread(buf, 1, 16384, f1)) > 0) fwrite(buf, 1, num, f2); while ((num = fread(buf, 1, 16384, f1)) > 0)
fwrite(buf, 1, num, f2);
fclose(f1); fclose(f1);
fclose(f2); fclose(f2);
@ -84,7 +92,8 @@ e_file_realpath(char *file)
D_ENTER; D_ENTER;
if (!realpath(file, buf)) D_RETURN_(strdup("")); if (!realpath(file, buf))
D_RETURN_(strdup(""));
e_strdup(f, buf); e_strdup(f, buf);
D_RETURN_(f); D_RETURN_(f);
@ -108,7 +117,6 @@ e_file_get_file(char *path)
D_RETURN_(result); D_RETURN_(result);
} }
char * char *
e_file_get_dir(char *file) e_file_get_dir(char *file)
{ {
@ -141,22 +149,28 @@ e_file_can_exec(struct stat *st)
D_ENTER; D_ENTER;
if (!st) D_RETURN_(0); if (!st)
D_RETURN_(0);
ok = 0; ok = 0;
if (!have_uid) uid = getuid(); if (!have_uid)
if (!have_uid) gid = getgid(); uid = getuid();
if (!have_uid)
gid = getgid();
have_uid = 1; have_uid = 1;
if (st->st_uid == uid) if (st->st_uid == uid)
{ {
if (st->st_mode & S_IXUSR) ok = 1; if (st->st_mode & S_IXUSR)
ok = 1;
} }
else if (st->st_gid == gid) else if (st->st_gid == gid)
{ {
if (st->st_mode & S_IXGRP) ok = 1; if (st->st_mode & S_IXGRP)
ok = 1;
} }
else else
{ {
if (st->st_mode & S_IXOTH) ok = 1; if (st->st_mode & S_IXOTH)
ok = 1;
} }
D_RETURN_(ok); D_RETURN_(ok);
@ -171,7 +185,8 @@ e_file_readlink(char *link)
D_ENTER; D_ENTER;
if ((count = readlink(link, buf, sizeof(buf))) < 0) D_RETURN_(NULL); if ((count = readlink(link, buf, sizeof(buf))) < 0)
D_RETURN_(NULL);
buf[count] = 0; buf[count] = 0;
e_strdup(f, buf); e_strdup(f, buf);
@ -188,12 +203,12 @@ e_file_ls(char *dir)
D_ENTER; D_ENTER;
dirp = opendir(dir); dirp = opendir(dir);
if (!dirp) D_RETURN_(NULL); if (!dirp)
D_RETURN_(NULL);
list = NULL; list = NULL;
while ((dp = readdir(dirp))) while ((dp = readdir(dirp)))
{ {
if ((strcmp(dp->d_name, ".")) && if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, "..")))
(strcmp(dp->d_name, "..")))
{ {
Evas_List l; Evas_List l;
char *f; char *f;
@ -210,7 +225,8 @@ e_file_ls(char *dir)
} }
/* nowhwre to go? just append it */ /* nowhwre to go? just append it */
e_strdup(f, dp->d_name); e_strdup(f, dp->d_name);
if (!l) list = evas_list_append(list, f); if (!l)
list = evas_list_append(list, f);
} }
} }
closedir(dirp); closedir(dirp);

View File

@ -7,7 +7,7 @@
static Evas_List focus_list = NULL; static Evas_List focus_list = NULL;
void void
e_focus_set_focus(E_Border *b) e_focus_set_focus(E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -17,7 +17,7 @@ e_focus_set_focus(E_Border *b)
} }
int int
e_focus_can_focus(E_Border *b) e_focus_can_focus(E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -25,7 +25,7 @@ e_focus_can_focus(E_Border *b)
} }
void void
e_focus_list_border_add(E_Border *b) e_focus_list_border_add(E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -34,7 +34,7 @@ e_focus_list_border_add(E_Border *b)
} }
void void
e_focus_list_border_del(E_Border *b) e_focus_list_border_del(E_Border * b)
{ {
D_ENTER; D_ENTER;

View File

@ -3,11 +3,10 @@
#include "border.h" #include "border.h"
void e_focus_set_focus(E_Border *b); void e_focus_set_focus(E_Border * b);
int e_focus_can_focus(E_Border *b); int e_focus_can_focus(E_Border * b);
void e_focus_list_border_add(E_Border *b); void e_focus_list_border_add(E_Border * b);
void e_focus_list_border_del(E_Border *b); void e_focus_list_border_del(E_Border * b);
void e_focus_list_clear(void); void e_focus_list_clear(void);
#endif #endif

View File

@ -8,7 +8,7 @@ static Evas_List fs_handlers = NULL;
static Evas_List fs_restart_handlers = NULL; static Evas_List fs_restart_handlers = NULL;
static pid_t efsd_pid = 0; static pid_t efsd_pid = 0;
static void e_fs_child_handle(Ecore_Event *ev); static void e_fs_child_handle(Ecore_Event * ev);
static void e_fs_fd_handle(int fd); static void e_fs_fd_handle(int fd);
static void e_fs_restarter(int val, void *data); static void e_fs_restarter(int val, void *data);
static void e_fs_idle(void *data); static void e_fs_idle(void *data);
@ -19,7 +19,8 @@ e_fs_flush_timeout(int val, void *data)
{ {
D_ENTER; D_ENTER;
if (!ec) D_RETURN; if (!ec)
D_RETURN;
if (efsd_commands_pending(ec) > 0) if (efsd_commands_pending(ec) > 0)
{ {
if (efsd_flush(ec) > 0) if (efsd_flush(ec) > 0)
@ -44,7 +45,7 @@ e_fs_idle(void *data)
} }
static void static void
e_fs_child_handle(Ecore_Event *ev) e_fs_child_handle(Ecore_Event * ev)
{ {
Ecore_Event_Child *e; Ecore_Event_Child *e;
@ -55,7 +56,8 @@ e_fs_child_handle(Ecore_Event *ev)
if (e->pid == efsd_pid) if (e->pid == efsd_pid)
{ {
D("it was efsd!\n"); D("it was efsd!\n");
if (ec) efsd_close(ec); if (ec)
efsd_close(ec);
ec = NULL; ec = NULL;
efsd_pid = 0; efsd_pid = 0;
e_fs_restarter(1, NULL); e_fs_restarter(1, NULL);
@ -82,7 +84,7 @@ e_fs_fd_handle(int fd)
for (l = fs_handlers; l; l = l->next) for (l = fs_handlers; l; l = l->next)
{ {
void (*func) (EfsdEvent *ev); void (*func) (EfsdEvent * ev);
func = l->data; func = l->data;
func(&ev); func(&ev);
@ -117,7 +119,8 @@ e_fs_restarter(int val, void *data)
{ {
D_ENTER; D_ENTER;
if (ec) D_RETURN; if (ec)
D_RETURN;
ec = efsd_open(); ec = efsd_open();
@ -128,7 +131,8 @@ e_fs_restarter(int val, void *data)
efsd_pid = e_exec_run("efsd -f"); efsd_pid = e_exec_run("efsd -f");
D("launch efsd... %i\n", efsd_pid); D("launch efsd... %i\n", efsd_pid);
} }
if (efsd_pid > 0) ec = efsd_open(); if (efsd_pid > 0)
ec = efsd_open();
} }
if (ec) if (ec)
{ {
@ -148,8 +152,10 @@ e_fs_restarter(int val, void *data)
double gap; double gap;
gap = (double)val / 10; gap = (double)val / 10;
if (gap > 10.0) gap = 10.0; if (gap > 10.0)
ecore_add_event_timer("e_fs_restarter", gap, e_fs_restarter, val + 1, NULL); gap = 10.0;
ecore_add_event_timer("e_fs_restarter", gap, e_fs_restarter, val + 1,
NULL);
} }
D_RETURN; D_RETURN;
@ -173,7 +179,7 @@ e_fs_add_restart_handler(void (*func) (void *data), void *data)
} }
void void
e_fs_del_restart_handler(E_FS_Restarter *rs) e_fs_del_restart_handler(E_FS_Restarter * rs)
{ {
D_ENTER; D_ENTER;
@ -187,11 +193,12 @@ e_fs_del_restart_handler(E_FS_Restarter *rs)
} }
void void
e_fs_add_event_handler(void (*func) (EfsdEvent *ev)) e_fs_add_event_handler(void (*func) (EfsdEvent * ev))
{ {
D_ENTER; D_ENTER;
if (!func) D_RETURN; if (!func)
D_RETURN;
fs_handlers = evas_list_append(fs_handlers, func); fs_handlers = evas_list_append(fs_handlers, func);
D_RETURN; D_RETURN;
@ -203,16 +210,16 @@ e_fs_init(void)
D_ENTER; D_ENTER;
/* Hook in an fs handler that gets called whenever /* Hook in an fs handler that gets called whenever
a child of this process exits. * a child of this process exits.
*/ */
ecore_event_filter_handler_add(ECORE_EVENT_CHILD, e_fs_child_handle); ecore_event_filter_handler_add(ECORE_EVENT_CHILD, e_fs_child_handle);
/* Also hook in an idle handler to flush efsd's /* Also hook in an idle handler to flush efsd's
write queue. * write queue.
*
FIXME: This should be handled by letting ecore * FIXME: This should be handled by letting ecore
report when Efsd's file descriptor becomes * report when Efsd's file descriptor becomes
writeable, and then calling efsd_flush(). * writeable, and then calling efsd_flush().
*/ */
ecore_event_filter_idle_handler_add(e_fs_idle, NULL); ecore_event_filter_idle_handler_add(e_fs_idle, NULL);
e_fs_restarter(0, NULL); e_fs_restarter(0, NULL);
@ -231,7 +238,6 @@ e_fs_cleanup(void)
D_RETURN; D_RETURN;
} }
EfsdConnection * EfsdConnection *
e_fs_get_connection(void) e_fs_get_connection(void)
{ {

View File

@ -28,9 +28,10 @@ void e_fs_init(void);
*/ */
void e_fs_cleanup(void); void e_fs_cleanup(void);
E_FS_Restarter *e_fs_add_restart_handler(void (*func) (void *data), void *data); E_FS_Restarter *e_fs_add_restart_handler(void (*func) (void *data),
void e_fs_del_restart_handler(E_FS_Restarter *rs); void *data);
void e_fs_add_event_handler(void (*func) (EfsdEvent *ev)); void e_fs_del_restart_handler(E_FS_Restarter * rs);
void e_fs_add_event_handler(void (*func) (EfsdEvent * ev));
EfsdConnection *e_fs_get_connection(void); EfsdConnection *e_fs_get_connection(void);
#endif #endif

View File

@ -17,31 +17,41 @@ static struct
struct struct
{ {
double x, y; double x, y;
} align; }
align;
char *text; char *text;
char *icon; char *icon;
} display; }
display;
int x, y, w, h; int x, y, w, h;
int visible; int visible;
E_Guides_Mode mode; E_Guides_Mode mode;
} current, prev; }
current , prev;
struct { struct
{
Window display; Window display;
Window l, r, t, b; Window l, r, t, b;
} win; }
struct { win;
struct
{
Evas evas; Evas evas;
Ebits_Object bg; Ebits_Object bg;
E_Text *text; E_Text *text;
Evas_Object icon; Evas_Object icon;
Imlib_Image image; Imlib_Image image;
} disp; }
struct { disp;
struct
{
Embed icon; Embed icon;
Embed text; Embed text;
} embed; }
} guides; embed;
}
guides;
static void e_guides_idle(void *data); static void e_guides_idle(void *data);
static void e_guides_update(void); static void e_guides_update(void);
@ -67,7 +77,8 @@ e_guides_update(void)
D_ENTER; D_ENTER;
if (!guides.changed) D_RETURN; if (!guides.changed)
D_RETURN;
redraw = 0; redraw = 0;
if (guides.prev.visible != guides.current.visible) if (guides.prev.visible != guides.current.visible)
@ -124,12 +135,16 @@ e_guides_update(void)
} }
if (guides.disp.evas) if (guides.disp.evas)
{ {
if (guides.embed.icon) e_embed_free(guides.embed.icon); if (guides.embed.icon)
if (guides.embed.text) e_embed_free(guides.embed.text); e_embed_free(guides.embed.icon);
if (guides.embed.text)
e_embed_free(guides.embed.text);
guides.embed.icon = NULL; guides.embed.icon = NULL;
guides.embed.text = NULL; guides.embed.text = NULL;
if (guides.disp.bg) ebits_free(guides.disp.bg); if (guides.disp.bg)
if (guides.disp.text) e_text_free(guides.disp.text); ebits_free(guides.disp.bg);
if (guides.disp.text)
e_text_free(guides.disp.text);
if (guides.disp.image) if (guides.disp.image)
{ {
imlib_context_set_image(guides.disp.image); imlib_context_set_image(guides.disp.image);
@ -144,16 +159,26 @@ e_guides_update(void)
} }
} }
} }
if (guides.current.x != guides.prev.x) redraw = 1; if (guides.current.x != guides.prev.x)
if (guides.current.y != guides.prev.y) redraw = 1; redraw = 1;
if (guides.current.w != guides.prev.w) redraw = 1; if (guides.current.y != guides.prev.y)
if (guides.current.h != guides.prev.h) redraw = 1; redraw = 1;
if (guides.current.display.loc != guides.prev.display.loc) redraw = 1; if (guides.current.w != guides.prev.w)
if (guides.current.display.align.x != guides.prev.display.align.x) redraw = 1; redraw = 1;
if (guides.current.display.align.y != guides.prev.display.align.y) redraw = 1; if (guides.current.h != guides.prev.h)
if (guides.current.display.text != guides.prev.display.text) redraw = 1; redraw = 1;
if (guides.current.display.icon != guides.prev.display.icon) redraw = 1; if (guides.current.display.loc != guides.prev.display.loc)
if (guides.current.mode != guides.prev.mode) redraw = 1; redraw = 1;
if (guides.current.display.align.x != guides.prev.display.align.x)
redraw = 1;
if (guides.current.display.align.y != guides.prev.display.align.y)
redraw = 1;
if (guides.current.display.text != guides.prev.display.text)
redraw = 1;
if (guides.current.display.icon != guides.prev.display.icon)
redraw = 1;
if (guides.current.mode != guides.prev.mode)
redraw = 1;
if ((guides.win.display) && (redraw)) if ((guides.win.display) && (redraw))
{ {
@ -162,7 +187,9 @@ e_guides_update(void)
if (!guides.disp.text) if (!guides.disp.text)
{ {
guides.disp.text = e_text_new(guides.disp.evas, guides.current.display.text, "guides"); guides.disp.text =
e_text_new(guides.disp.evas, guides.current.display.text,
"guides");
e_text_set_layer(guides.disp.text, 100); e_text_set_layer(guides.disp.text, 100);
e_text_show(guides.disp.text); e_text_show(guides.disp.text);
} }
@ -173,11 +200,14 @@ e_guides_update(void)
} }
if ((guides.current.display.icon) && (!guides.disp.icon)) if ((guides.current.display.icon) && (!guides.disp.icon))
{ {
guides.disp.icon = evas_add_image_from_file(guides.disp.evas, guides.current.display.icon); guides.disp.icon =
evas_add_image_from_file(guides.disp.evas,
guides.current.display.icon);
evas_show(guides.disp.evas, guides.disp.icon); evas_show(guides.disp.evas, guides.disp.icon);
} }
if (guides.disp.icon) if (guides.disp.icon)
evas_set_image_file(guides.disp.evas, guides.disp.icon, guides.current.display.icon); evas_set_image_file(guides.disp.evas, guides.disp.icon,
guides.current.display.icon);
e_text_set_text(guides.disp.text, guides.current.display.text); e_text_set_text(guides.disp.text, guides.current.display.text);
if (!guides.disp.bg) if (!guides.disp.bg)
{ {
@ -201,10 +231,16 @@ e_guides_update(void)
{ {
if (!guides.embed.icon) if (!guides.embed.icon)
{ {
if (guides.embed.icon) e_embed_free(guides.embed.icon); if (guides.embed.icon)
if (guides.embed.text) e_embed_free(guides.embed.text); e_embed_free(guides.embed.icon);
guides.embed.icon = e_embed_image_object(guides.disp.bg, "Icon", guides.disp.evas, guides.disp.icon); if (guides.embed.text)
guides.embed.text = e_embed_text(guides.disp.bg, "Text", guides.disp.evas, guides.disp.text, 0, 0); e_embed_free(guides.embed.text);
guides.embed.icon =
e_embed_image_object(guides.disp.bg, "Icon",
guides.disp.evas, guides.disp.icon);
guides.embed.text =
e_embed_text(guides.disp.bg, "Text", guides.disp.evas,
guides.disp.text, 0, 0);
} }
ebits_get_real_min_size(guides.disp.bg, &mw, &mh); ebits_get_real_min_size(guides.disp.bg, &mw, &mh);
} }
@ -217,16 +253,28 @@ e_guides_update(void)
ebits_move(guides.disp.bg, 0, 0); ebits_move(guides.disp.bg, 0, 0);
ebits_resize(guides.disp.bg, dw, dh); ebits_resize(guides.disp.bg, dw, dh);
} }
if (guides.current.display.loc == E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE) if (guides.current.display.loc ==
E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE)
{ {
ecore_window_get_geometry(0, NULL, NULL, &sw, &sh); ecore_window_get_geometry(0, NULL, NULL, &sw, &sh);
dx = (int)(((double)sw - (double)dw) * guides.current.display.align.x); dx =
dy = (int)(((double)sh - (double)dh) * guides.current.display.align.y); (int)(((double)sw -
(double)dw) * guides.current.display.align.x);
dy =
(int)(((double)sh -
(double)dh) * guides.current.display.align.y);
} }
else if (guides.current.display.loc == E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE) else if (guides.current.display.loc ==
E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE)
{ {
dx = guides.current.x + (int)(((double)guides.current.w - (double)dw) * guides.current.display.align.x); dx =
dy = guides.current.y + (int)(((double)guides.current.h - (double)dh) * guides.current.display.align.y); guides.current.x +
(int)(((double)guides.current.w -
(double)dw) * guides.current.display.align.x);
dy =
guides.current.y +
(int)(((double)guides.current.h -
(double)dh) * guides.current.display.align.y);
} }
if (guides.disp.image) if (guides.disp.image)
@ -283,8 +331,14 @@ e_guides_update(void)
imlib_context_set_blend(1); imlib_context_set_blend(1);
imlib_context_set_color_modifier(NULL); imlib_context_set_color_modifier(NULL);
fr = 255; fg = 255; fb = 255; fa = 255; fr = 255;
br = 0 ; bg = 0 ; bb = 0 ; ba = 255; fg = 255;
fb = 255;
fa = 255;
br = 0;
bg = 0;
bb = 0;
ba = 255;
x = guides.current.x; x = guides.current.x;
y = guides.current.y + 3; y = guides.current.y + 3;
@ -495,7 +549,8 @@ e_guides_show(void)
{ {
D_ENTER; D_ENTER;
if (guides.current.visible) D_RETURN; if (guides.current.visible)
D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.visible = 1; guides.current.visible = 1;
@ -507,7 +562,8 @@ e_guides_hide(void)
{ {
D_ENTER; D_ENTER;
if (!guides.current.visible) D_RETURN; if (!guides.current.visible)
D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.visible = 0; guides.current.visible = 0;
@ -519,8 +575,8 @@ e_guides_move(int x, int y)
{ {
D_ENTER; D_ENTER;
if ((guides.current.x == x) && if ((guides.current.x == x) && (guides.current.y == y))
(guides.current.y == y)) D_RETURN; D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.x = x; guides.current.x = x;
guides.current.y = y; guides.current.y = y;
@ -533,8 +589,8 @@ e_guides_resize(int w, int h)
{ {
D_ENTER; D_ENTER;
if ((guides.current.w == w) && if ((guides.current.w == w) && (guides.current.h == h))
(guides.current.h == h)) D_RETURN; D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.w = w; guides.current.w = w;
guides.current.h = h; guides.current.h = h;
@ -548,7 +604,8 @@ e_guides_display_text(char *text)
D_ENTER; D_ENTER;
if ((guides.current.display.text) && (text) && if ((guides.current.display.text) && (text) &&
(!strcmp(guides.current.display.text, text))) D_RETURN; (!strcmp(guides.current.display.text, text)))
D_RETURN;
guides.changed = 1; guides.changed = 1;
IF_FREE(guides.current.display.text); IF_FREE(guides.current.display.text);
guides.current.display.text = NULL; guides.current.display.text = NULL;
@ -564,7 +621,8 @@ e_guides_display_icon(char *icon)
D_ENTER; D_ENTER;
if ((guides.current.display.icon) && (icon) && if ((guides.current.display.icon) && (icon) &&
(!strcmp(guides.current.display.icon, icon))) D_RETURN; (!strcmp(guides.current.display.icon, icon)))
D_RETURN;
guides.changed = 1; guides.changed = 1;
IF_FREE(guides.current.display.icon); IF_FREE(guides.current.display.icon);
guides.current.display.icon = NULL; guides.current.display.icon = NULL;
@ -579,7 +637,8 @@ e_guides_set_display_location(E_Guides_Location loc)
{ {
D_ENTER; D_ENTER;
if (guides.current.display.loc == loc) D_RETURN; if (guides.current.display.loc == loc)
D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.display.loc = loc; guides.current.display.loc = loc;
@ -592,7 +651,8 @@ e_guides_set_display_alignment(double x, double y)
D_ENTER; D_ENTER;
if ((guides.current.display.align.x == x) && if ((guides.current.display.align.x == x) &&
(guides.current.display.align.y == y)) D_RETURN; (guides.current.display.align.y == y))
D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.display.align.x = x; guides.current.display.align.x = x;
guides.current.display.align.y = y; guides.current.display.align.y = y;
@ -605,14 +665,16 @@ e_guides_set_mode(E_Guides_Mode mode)
{ {
D_ENTER; D_ENTER;
if (guides.current.mode == mode) D_RETURN; if (guides.current.mode == mode)
D_RETURN;
guides.changed = 1; guides.changed = 1;
guides.current.mode = mode; guides.current.mode = mode;
D_RETURN; D_RETURN;
} }
void e_guides_init(void) void
e_guides_init(void)
{ {
D_ENTER; D_ENTER;

View File

@ -2,22 +2,21 @@
#define E_GUIDES_H #define E_GUIDES_H
typedef enum e_guides_mode typedef enum e_guides_mode
{ {
E_GUIDES_OPAQUE, /* configure window border & client */ E_GUIDES_OPAQUE, /* configure window border & client */
E_GUIDES_BORDER, /* unmap client and configure window border */ E_GUIDES_BORDER, /* unmap client and configure window border */
E_GUIDES_BOX, /* box outline */ E_GUIDES_BOX, /* box outline */
E_GUIDES_TECHNICAL /* lots of lines & info */ E_GUIDES_TECHNICAL /* lots of lines & info */
} }
E_Guides_Mode; E_Guides_Mode;
typedef enum e_guides_location typedef enum e_guides_location
{ {
E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE, E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE,
E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE
} }
E_Guides_Location; E_Guides_Location;
/** /**
* e_guides_init - Guides initialization. * e_guides_init - Guides initialization.
* *

View File

@ -78,7 +78,8 @@ e_icccm_send_focus_to(Window win, int takes_focus)
num = size / sizeof(int); num = size / sizeof(int);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
if (props[i] == (int)a_wm_take_focus) msg_focus = 1; if (props[i] == (int)a_wm_take_focus)
msg_focus = 1;
} }
FREE(props); FREE(props);
} }
@ -118,7 +119,8 @@ e_icccm_delete(Window win)
num = size / sizeof(int); num = size / sizeof(int);
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
if (props[i] == (int)a_wm_delete_window) del_win = 1; if (props[i] == (int)a_wm_delete_window)
del_win = 1;
} }
FREE(props); FREE(props);
} }
@ -207,7 +209,7 @@ e_icccm_release(Window win)
} }
void void
e_icccm_get_pos_info(Window win, E_Border *b) e_icccm_get_pos_info(Window win, E_Border * b)
{ {
XSizeHints hint; XSizeHints hint;
int mask; int mask;
@ -240,9 +242,10 @@ e_icccm_get_pos_info(Window win, E_Border *b)
} }
void void
e_icccm_get_size_info(Window win, E_Border *b) e_icccm_get_size_info(Window win, E_Border * b)
{ {
int base_w, base_h, min_w, min_h, max_w, max_h, grav, step_w, step_h; int base_w, base_h, min_w, min_h, max_w, max_h, grav, step_w,
step_h;
double aspect_min, aspect_max; double aspect_min, aspect_max;
int mask; int mask;
XSizeHints hint; XSizeHints hint;
@ -272,22 +275,28 @@ e_icccm_get_size_info(Window win, E_Border *b)
{ {
max_w = hint.max_width; max_w = hint.max_width;
max_h = hint.max_height; max_h = hint.max_height;
if (max_w < min_w) max_w = min_w; if (max_w < min_w)
if (max_h < min_h) max_h = min_h; max_w = min_w;
if (max_h < min_h)
max_h = min_h;
} }
if (hint.flags & PResizeInc) if (hint.flags & PResizeInc)
{ {
step_w = hint.width_inc; step_w = hint.width_inc;
step_h = hint.height_inc; step_h = hint.height_inc;
if (step_w < 1) step_w = 1; if (step_w < 1)
if (step_h < 1) step_h = 1; step_w = 1;
if (step_h < 1)
step_h = 1;
} }
if (hint.flags & PBaseSize) if (hint.flags & PBaseSize)
{ {
base_w = hint.base_width; base_w = hint.base_width;
base_h = hint.base_height; base_h = hint.base_height;
if (base_w > max_w) max_w = base_w; if (base_w > max_w)
if (base_h > max_h) max_h = base_h; max_w = base_w;
if (base_h > max_h)
max_h = base_h;
} }
else else
{ {
@ -297,9 +306,11 @@ e_icccm_get_size_info(Window win, E_Border *b)
if (hint.flags & PAspect) if (hint.flags & PAspect)
{ {
if (hint.min_aspect.y > 0) if (hint.min_aspect.y > 0)
aspect_min = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y); aspect_min =
((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
if (hint.max_aspect.y > 0) if (hint.max_aspect.y > 0)
aspect_max = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y); aspect_max =
((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
} }
} }
b->client.min.w = min_w; b->client.min.w = min_w;
@ -318,7 +329,7 @@ e_icccm_get_size_info(Window win, E_Border *b)
} }
void void
e_icccm_get_mwm_hints(Window win, E_Border *b) e_icccm_get_mwm_hints(Window win, E_Border * b)
{ {
static Atom a_motif_wm_hints = 0; static Atom a_motif_wm_hints = 0;
MWMHints *mwmhints; MWMHints *mwmhints;
@ -328,7 +339,8 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
ECORE_ATOM(a_motif_wm_hints, "_MOTIF_WM_HINTS"); ECORE_ATOM(a_motif_wm_hints, "_MOTIF_WM_HINTS");
mwmhints = ecore_window_property_get(win, a_motif_wm_hints, a_motif_wm_hints, &size); mwmhints =
ecore_window_property_get(win, a_motif_wm_hints, a_motif_wm_hints, &size);
if (mwmhints) if (mwmhints)
{ {
int num; int num;
@ -350,9 +362,12 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
b->client.handles = 1; b->client.handles = 1;
b->client.titlebar = 1; b->client.titlebar = 1;
} }
if (mwmhints->decorations & MWM_DECOR_BORDER) b->client.border = 1; if (mwmhints->decorations & MWM_DECOR_BORDER)
if (mwmhints->decorations & MWM_DECOR_RESIZEH) b->client.handles = 1; b->client.border = 1;
if (mwmhints->decorations & MWM_DECOR_TITLE) b->client.titlebar = 1; if (mwmhints->decorations & MWM_DECOR_RESIZEH)
b->client.handles = 1;
if (mwmhints->decorations & MWM_DECOR_TITLE)
b->client.titlebar = 1;
} }
FREE(mwmhints); FREE(mwmhints);
} }
@ -361,7 +376,7 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
} }
void void
e_icccm_get_layer(Window win, E_Border *b) e_icccm_get_layer(Window win, E_Border * b)
{ {
static Atom a_win_layer = 0; static Atom a_win_layer = 0;
int *props; int *props;
@ -377,7 +392,8 @@ e_icccm_get_layer(Window win, E_Border *b)
int num; int num;
num = size / sizeof(int); num = size / sizeof(int);
if (num > 0) b->client.layer = props[0]; if (num > 0)
b->client.layer = props[0];
FREE(props); FREE(props);
} }
@ -385,7 +401,7 @@ e_icccm_get_layer(Window win, E_Border *b)
} }
void void
e_icccm_get_title(Window win, E_Border *b) e_icccm_get_title(Window win, E_Border * b)
{ {
char *title; char *title;
@ -404,15 +420,16 @@ e_icccm_get_title(Window win, E_Border *b)
FREE(b->client.title); FREE(b->client.title);
} }
b->client.title = NULL; b->client.title = NULL;
if (title) b->client.title = title; if (title)
else e_strdup(b->client.title, "No Title"); b->client.title = title;
else
e_strdup(b->client.title, "No Title");
D_RETURN; D_RETURN;
} }
void void
e_icccm_get_class(Window win, E_Border *b) e_icccm_get_class(Window win, E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -421,28 +438,29 @@ e_icccm_get_class(Window win, E_Border *b)
b->client.name = NULL; b->client.name = NULL;
b->client.class = NULL; b->client.class = NULL;
ecore_window_get_name_class(win, &(b->client.name), &(b->client.class)); ecore_window_get_name_class(win, &(b->client.name), &(b->client.class));
if (!b->client.name) e_strdup(b->client.name, "Unknown"); if (!b->client.name)
if (!b->client.class) e_strdup(b->client.class, "Unknown"); e_strdup(b->client.name, "Unknown");
if (!b->client.class)
e_strdup(b->client.class, "Unknown");
D_RETURN; D_RETURN;
} }
void void
e_icccm_get_hints(Window win, E_Border *b) e_icccm_get_hints(Window win, E_Border * b)
{ {
D_ENTER; D_ENTER;
ecore_window_get_hints(win, ecore_window_get_hints(win,
&(b->client.takes_focus), &(b->client.takes_focus),
&(b->client.initial_state), &(b->client.initial_state),
NULL, NULL, NULL, NULL, NULL, NULL, &(b->client.group));
&(b->client.group));
D_RETURN; D_RETURN;
} }
void void
e_icccm_get_machine(Window win, E_Border *b) e_icccm_get_machine(Window win, E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -454,7 +472,7 @@ e_icccm_get_machine(Window win, E_Border *b)
} }
void void
e_icccm_get_command(Window win, E_Border *b) e_icccm_get_command(Window win, E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -466,7 +484,7 @@ e_icccm_get_command(Window win, E_Border *b)
} }
void void
e_icccm_get_icon_name(Window win, E_Border *b) e_icccm_get_icon_name(Window win, E_Border * b)
{ {
D_ENTER; D_ENTER;
@ -478,11 +496,10 @@ e_icccm_get_icon_name(Window win, E_Border *b)
} }
void void
e_icccm_get_state(Window win, E_Border *b) e_icccm_get_state(Window win, E_Border * b)
{ {
D_ENTER; D_ENTER;
D_RETURN; D_RETURN;
UN(win); UN(win);
UN(b); UN(b);
@ -578,7 +595,7 @@ e_icccm_is_shaped(Window win)
} }
void void
e_icccm_get_e_hack_launch_id(Window win, E_Border *b) e_icccm_get_e_hack_launch_id(Window win, E_Border * b)
{ {
static Atom a_e_hack_launch_id = 0; static Atom a_e_hack_launch_id = 0;
int *props; int *props;
@ -595,6 +612,7 @@ e_icccm_get_e_hack_launch_id(Window win, E_Border *b)
str = NEW(char, size + 1); str = NEW(char, size + 1);
ZERO(str, char, size + 1); ZERO(str, char, size + 1);
memcpy(str, props, size); memcpy(str, props, size);
b->client.e.launch_id = atoi(str); b->client.e.launch_id = atoi(str);
FREE(str); FREE(str);
@ -607,7 +625,7 @@ e_icccm_get_e_hack_launch_id(Window win, E_Border *b)
} }
void void
e_icccm_handle_property_change(Atom a, E_Border *b) e_icccm_handle_property_change(Atom a, E_Border * b)
{ {
static Atom a_wm_normal_hints = 0; static Atom a_wm_normal_hints = 0;
static Atom a_motif_wm_hints = 0; static Atom a_motif_wm_hints = 0;
@ -633,22 +651,32 @@ e_icccm_handle_property_change(Atom a, E_Border *b)
ECORE_ATOM(a_wm_state, "WM_STATE"); ECORE_ATOM(a_wm_state, "WM_STATE");
ECORE_ATOM(a_e_hack_launch_id, "_E_HACK_LAUNCH_ID"); ECORE_ATOM(a_e_hack_launch_id, "_E_HACK_LAUNCH_ID");
if (a == a_wm_normal_hints) e_icccm_get_size_info(b->win.client, b); if (a == a_wm_normal_hints)
else if (a == a_motif_wm_hints) e_icccm_get_mwm_hints(b->win.client, b); e_icccm_get_size_info(b->win.client, b);
else if (a == a_wm_name) e_icccm_get_title(b->win.client, b); else if (a == a_motif_wm_hints)
else if (a == a_wm_class) e_icccm_get_class(b->win.client, b); e_icccm_get_mwm_hints(b->win.client, b);
else if (a == a_wm_hints) e_icccm_get_hints(b->win.client, b); else if (a == a_wm_name)
else if (a == a_wm_client_machine) e_icccm_get_machine(b->win.client, b); e_icccm_get_title(b->win.client, b);
else if (a == a_wm_command) e_icccm_get_command(b->win.client, b); else if (a == a_wm_class)
else if (a == a_wm_icon_name) e_icccm_get_icon_name(b->win.client, b); e_icccm_get_class(b->win.client, b);
else if (a == a_wm_state) e_icccm_get_state(b->win.client, b); else if (a == a_wm_hints)
else if (a == a_e_hack_launch_id) e_icccm_get_e_hack_launch_id(b->win.client, b); e_icccm_get_hints(b->win.client, b);
else if (a == a_wm_client_machine)
e_icccm_get_machine(b->win.client, b);
else if (a == a_wm_command)
e_icccm_get_command(b->win.client, b);
else if (a == a_wm_icon_name)
e_icccm_get_icon_name(b->win.client, b);
else if (a == a_wm_state)
e_icccm_get_state(b->win.client, b);
else if (a == a_e_hack_launch_id)
e_icccm_get_e_hack_launch_id(b->win.client, b);
D_RETURN; D_RETURN;
} }
void void
e_icccm_handle_client_message(Ecore_Event_Message *e) e_icccm_handle_client_message(Ecore_Event_Message * e)
{ {
D_ENTER; D_ENTER;
@ -661,7 +689,6 @@ e_icccm_advertise_e_compat(void)
{ {
D_ENTER; D_ENTER;
D_RETURN; D_RETURN;
} }
@ -700,15 +727,19 @@ e_icccm_advertise_gnome_compat(void)
ecore_window_property_set(0, a_win_protocols, XA_ATOM, 32, props, 1); ecore_window_property_set(0, a_win_protocols, XA_ATOM, 32, props, 1);
ECORE_ATOM(a_win_wm_name, "_WIN_WM_NAME"); ECORE_ATOM(a_win_wm_name, "_WIN_WM_NAME");
ecore_window_property_set(0, a_win_wm_name, XA_STRING, 8, "Enlightenment", strlen("Enlightenment")); ecore_window_property_set(0, a_win_wm_name, XA_STRING, 8, "Enlightenment",
strlen("Enlightenment"));
ECORE_ATOM(a_win_wm_version, "_WIN_WM_VERSION"); ECORE_ATOM(a_win_wm_version, "_WIN_WM_VERSION");
ecore_window_property_set(0, a_win_wm_version, XA_STRING, 8, "0.17.0", strlen("0.17.0")); ecore_window_property_set(0, a_win_wm_version, XA_STRING, 8, "0.17.0",
strlen("0.17.0"));
ECORE_ATOM(a_win_supporting_wm_check, "_WIN_SUPPORTING_WM_CHECK"); ECORE_ATOM(a_win_supporting_wm_check, "_WIN_SUPPORTING_WM_CHECK");
win = ecore_window_override_new(0, 0, 0, 7, 7); win = ecore_window_override_new(0, 0, 0, 7, 7);
props[0] = win; props[0] = win;
ecore_window_property_set(win, a_win_supporting_wm_check, XA_CARDINAL, 32, props, 1); ecore_window_property_set(win, a_win_supporting_wm_check, XA_CARDINAL, 32,
ecore_window_property_set(0, a_win_supporting_wm_check, XA_CARDINAL, 32, props, 1); props, 1);
ecore_window_property_set(0, a_win_supporting_wm_check, XA_CARDINAL, 32,
props, 1);
D_RETURN; D_RETURN;
} }
@ -718,7 +749,6 @@ e_icccm_advertise_kde_compat(void)
{ {
D_ENTER; D_ENTER;
D_RETURN; D_RETURN;
} }
@ -727,6 +757,5 @@ e_icccm_advertise_net_compat(void)
{ {
D_ENTER; D_ENTER;
D_RETURN; D_RETURN;
} }

View File

@ -11,25 +11,26 @@ void e_icccm_state_iconified(Window win);
void e_icccm_state_withdrawn(Window win); void e_icccm_state_withdrawn(Window win);
void e_icccm_adopt(Window win); void e_icccm_adopt(Window win);
void e_icccm_release(Window win); void e_icccm_release(Window win);
void e_icccm_get_pos_info(Window win, E_Border *b); void e_icccm_get_pos_info(Window win, E_Border * b);
void e_icccm_get_size_info(Window win, E_Border *b); void e_icccm_get_size_info(Window win, E_Border * b);
void e_icccm_get_mwm_hints(Window win, E_Border *b); void e_icccm_get_mwm_hints(Window win, E_Border * b);
void e_icccm_get_layer(Window win, E_Border *b); void e_icccm_get_layer(Window win, E_Border * b);
void e_icccm_get_title(Window win, E_Border *b); void e_icccm_get_title(Window win, E_Border * b);
void e_icccm_get_class(Window win, E_Border *b); void e_icccm_get_class(Window win, E_Border * b);
void e_icccm_get_hints(Window win, E_Border *b); void e_icccm_get_hints(Window win, E_Border * b);
void e_icccm_get_machine(Window win, E_Border *b); void e_icccm_get_machine(Window win, E_Border * b);
void e_icccm_get_command(Window win, E_Border *b); void e_icccm_get_command(Window win, E_Border * b);
void e_icccm_get_icon_name(Window win, E_Border *b); void e_icccm_get_icon_name(Window win, E_Border * b);
void e_icccm_get_state(Window win, E_Border *b); void e_icccm_get_state(Window win, E_Border * b);
void e_icccm_set_frame_size(Window win, int l, int r, int t, int b); void e_icccm_set_frame_size(Window win, int l, int r, int t,
int b);
void e_icccm_set_desk_area(Window win, int ax, int ay); void e_icccm_set_desk_area(Window win, int ax, int ay);
void e_icccm_set_desk_area_size(Window win, int ax, int ay); void e_icccm_set_desk_area_size(Window win, int ax, int ay);
void e_icccm_set_desk(Window win, int d); void e_icccm_set_desk(Window win, int d);
int e_icccm_is_shaped(Window win); int e_icccm_is_shaped(Window win);
void e_icccm_get_e_hack_launch_id(Window win, E_Border *b); void e_icccm_get_e_hack_launch_id(Window win, E_Border * b);
void e_icccm_handle_property_change(Atom a, E_Border *b); void e_icccm_handle_property_change(Atom a, E_Border * b);
void e_icccm_handle_client_message(Ecore_Event_Message *e); void e_icccm_handle_client_message(Ecore_Event_Message * e);
void e_icccm_advertise_e_compat(void); void e_icccm_advertise_e_compat(void);
void e_icccm_advertise_mwm_compat(void); void e_icccm_advertise_mwm_compat(void);
void e_icccm_advertise_gnome_compat(void); void e_icccm_advertise_gnome_compat(void);

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
#include "resist.h" #include "resist.h"
typedef struct _E_Iconbar_Icon E_Iconbar_Icon; typedef struct _E_Iconbar_Icon E_Iconbar_Icon;
#ifndef E_ICONBAR_TYPEDEF #ifndef E_ICONBAR_TYPEDEF
#define E_ICONBAR_TYPEDEF #define E_ICONBAR_TYPEDEF
typedef struct _E_Iconbar E_Iconbar; typedef struct _E_Iconbar E_Iconbar;
@ -34,13 +35,17 @@ struct _E_Iconbar
float scroll; float scroll;
Ebits_Object *bit; Ebits_Object *bit;
struct { struct
{
double x, y, w, h; double x, y, w, h;
} icon_area; }
icon_area;
struct { struct
{
int x, y; int x, y;
} dnd; }
dnd;
}; };
struct _E_Iconbar_Icon struct _E_Iconbar_Icon
@ -56,20 +61,26 @@ struct _E_Iconbar_Icon
char *exec; char *exec;
int hilited; int hilited;
struct { struct
{
Evas_Object image; Evas_Object image;
char *timer; char *timer;
double start; double start;
} hi; }
hi;
struct { struct
{
double x, y; double x, y;
} down, mouse; }
down , mouse;
struct { struct
{
double x, y; double x, y;
double w, h; double w, h;
} current; }
current;
int mouse_down; int mouse_down;
int moving; int moving;
@ -83,19 +94,19 @@ struct _E_Iconbar_Icon
}; };
void e_iconbar_init(void); void e_iconbar_init(void);
E_Iconbar *e_iconbar_new(E_View *v); E_Iconbar *e_iconbar_new(E_View * v);
void e_iconbar_icon_free(E_Iconbar_Icon *); void e_iconbar_icon_free(E_Iconbar_Icon *);
void e_iconbar_realize(E_Iconbar *ib); void e_iconbar_realize(E_Iconbar * ib);
void e_iconbar_fix(E_Iconbar *ib); void e_iconbar_fix(E_Iconbar * ib);
double e_iconbar_get_length(E_Iconbar *ib); double e_iconbar_get_length(E_Iconbar * ib);
void e_iconbar_file_add(E_View *v, char *file); void e_iconbar_file_add(E_View * v, char *file);
void e_iconbar_file_delete(E_View *v, char *file); void e_iconbar_file_delete(E_View * v, char *file);
void e_iconbar_file_change(E_View *v, char *file); void e_iconbar_file_change(E_View * v, char *file);
void e_iconbar_save_out_final(E_Iconbar *ib); void e_iconbar_save_out_final(E_Iconbar * ib);
E_Rect * e_iconbar_get_resist_rect(E_Iconbar *ib); E_Rect *e_iconbar_get_resist_rect(E_Iconbar * ib);
void e_iconbar_set_view_window_spacing(E_Iconbar *ib); void e_iconbar_set_view_window_spacing(E_Iconbar * ib);
void e_iconbar_icon_move(E_Iconbar_Icon *ic, int x, int y); void e_iconbar_icon_move(E_Iconbar_Icon * ic, int x, int y);
void e_iconbar_dnd_add_files (E_View * v, E_View * source, void e_iconbar_dnd_add_files(E_View * v, E_View * source,
int num_files, char **dnd_files); int num_files, char **dnd_files);
#endif #endif

View File

@ -9,12 +9,16 @@
#include "e_view_machine.h" #include "e_view_machine.h"
#include "globals.h" #include "globals.h"
static void e_icon_down_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,
static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); int _x, int _y);
static void e_icon_in_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,
static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); int _x, int _y);
static void e_icon_move_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);
static void e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void static void
e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
@ -26,7 +30,8 @@ e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
D_ENTER; D_ENTER;
ev = e_view_get_current_event(); ev = e_view_get_current_event();
if (!ev) D_RETURN; if (!ev)
D_RETURN;
e = ev->event; e = ev->event;
ic = _data; ic = _data;
ic->view->select.down.x = _x; ic->view->select.down.x = _x;
@ -79,7 +84,8 @@ e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
D_ENTER; D_ENTER;
ev = e_view_get_current_event(); ev = e_view_get_current_event();
if (!ev) D_RETURN; if (!ev)
D_RETURN;
e = ev->event; e = ev->event;
ic = _data; ic = _data;
if (ic->view->drag.started) if (ic->view->drag.started)
@ -92,7 +98,7 @@ e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
ecore_window_no_ignore(ic->view->drag.win); ecore_window_no_ignore(ic->view->drag.win);
ecore_window_destroy(ic->view->drag.win); ecore_window_destroy(ic->view->drag.win);
ic->view->drag.started = 0; ic->view->drag.started = 0;
if(e->mods & ECORE_EVENT_KEY_MODIFIER_SHIFT) if (e->mods & ECORE_EVENT_KEY_MODIFIER_SHIFT)
ecore_dnd_set_mode_copy(); ecore_dnd_set_mode_copy();
else else
ecore_dnd_set_mode_move(); ecore_dnd_set_mode_move();
@ -172,9 +178,11 @@ e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
} }
static void static void
_paint_selected_icons_onto_drag_window(E_View *v, Imlib_Image im, int wx, int wy) _paint_selected_icons_onto_drag_window(E_View * v, Imlib_Image im, int wx,
int wy)
{ {
Evas_List l; Evas_List l;
D_ENTER; D_ENTER;
if (!v || !im || v->select.count <= 0) if (!v || !im || v->select.count <= 0)
@ -193,9 +201,7 @@ _paint_selected_icons_onto_drag_window(E_View *v, Imlib_Image im, int wx, int wy
if (!ic->state.selected) if (!ic->state.selected)
continue; continue;
evas_get_geometry(ic->view->evas, evas_get_geometry(ic->view->evas, ic->obj.icon, &ix, &iy, NULL, NULL);
ic->obj.icon,
&ix, &iy, NULL, NULL);
icx = ix + v->location.x - wx; icx = ix + v->location.x - wx;
icy = iy + v->location.y - wy; icy = iy + v->location.y - wy;
if (!ic->file->info.icon) if (!ic->file->info.icon)
@ -225,8 +231,7 @@ _paint_selected_icons_onto_drag_window(E_View *v, Imlib_Image im, int wx, int wy
ih = imlib_image_get_height(); ih = imlib_image_get_height();
imlib_context_set_image(im); imlib_context_set_image(im);
imlib_blend_image_onto_image(im2, 1, imlib_blend_image_onto_image(im2, 1,
0, 0, iw, ih, 0, 0, iw, ih, icx, icy, iw, ih);
icx, icy, iw, ih);
imlib_context_set_image(im2); imlib_context_set_image(im2);
imlib_free_image(); imlib_free_image();
imlib_context_set_image(im); imlib_context_set_image(im);
@ -239,17 +244,16 @@ _paint_selected_icons_onto_drag_window(E_View *v, Imlib_Image im, int wx, int wy
D_RETURN; D_RETURN;
} }
static void static void
_start_drag(E_View *v, int _x, int _y) _start_drag(E_View * v, int _x, int _y)
{ {
Pixmap pmap, mask; Pixmap pmap, mask;
Evas_List l; Evas_List l;
int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh; int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh;
int dx, dy; int dx, dy;
if (!v) D_RETURN; if (!v)
D_RETURN;
dx = abs(v->select.down.x - _x); dx = abs(v->select.down.x - _x);
dy = abs(v->select.down.y - _y); dy = abs(v->select.down.y - _y);
@ -276,10 +280,14 @@ _start_drag(E_View *v, int _x, int _y)
iy = ic->view->scroll.y + ic->geom.y + v->location.y; iy = ic->view->scroll.y + ic->geom.y + v->location.y;
iw = ic->geom.w; iw = ic->geom.w;
ih = ic->geom.h; ih = ic->geom.h;
if (ix < x) x = ix; if (ix < x)
if (iy < y) y = iy; x = ix;
if ((ix + iw) > xx) xx = ix + iw; if (iy < y)
if ((iy + ih) > yy) yy = iy + ih; y = iy;
if ((ix + iw) > xx)
xx = ix + iw;
if ((iy + ih) > yy)
yy = iy + ih;
} }
} }
} }
@ -289,18 +297,18 @@ _start_drag(E_View *v, int _x, int _y)
wx = x; wx = x;
ww = xx - x; ww = xx - x;
if (wx < - (rw - downx)) if (wx < -(rw - downx))
{ {
wx = - (rw - downx); wx = -(rw - downx);
ww -= (wx - x); ww -= (wx - x);
} }
if ((wx + ww) > (rw + downx)) if ((wx + ww) > (rw + downx))
ww = (rw + downx) - wx; ww = (rw + downx) - wx;
wy = y; wy = y;
wh = yy - y; wh = yy - y;
if (wy < - (rh - downy)) if (wy < -(rh - downy))
{ {
wy = - (rh - downy); wy = -(rh - downy);
wh -= (wy - y); wh -= (wy - y);
} }
if ((wy + wh) > (rh + downy)) if ((wy + wh) > (rh + downy))
@ -311,7 +319,8 @@ _start_drag(E_View *v, int _x, int _y)
v->drag.offset.x = downx - v->drag.x; v->drag.offset.x = downx - v->drag.x;
v->drag.offset.y = downy - v->drag.y; v->drag.offset.y = downy - v->drag.y;
if ((ww < 1) || (wh < 1)) D_RETURN; if ((ww < 1) || (wh < 1))
D_RETURN;
v->drag.win = ecore_window_override_new(0, wx, wy, ww, wh); v->drag.win = ecore_window_override_new(0, wx, wy, ww, wh);
pmap = ecore_pixmap_new(v->drag.win, ww, wh, 0); pmap = ecore_pixmap_new(v->drag.win, ww, wh, 0);
@ -331,8 +340,10 @@ _start_drag(E_View *v, int _x, int _y)
_paint_selected_icons_onto_drag_window(v, im, wx, wy); _paint_selected_icons_onto_drag_window(v, im, wx, wy);
imlib_context_set_image(im); imlib_context_set_image(im);
if (ww * wh < (200 * 200)) imlib_context_set_dither_mask(1); if (ww * wh < (200 * 200))
else imlib_context_set_dither_mask(0); imlib_context_set_dither_mask(1);
else
imlib_context_set_dither_mask(0);
imlib_context_set_dither(1); imlib_context_set_dither(1);
imlib_context_set_drawable(pmap); imlib_context_set_drawable(pmap);
imlib_context_set_mask(mask); imlib_context_set_mask(mask);
@ -364,6 +375,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
E_Icon *ic; E_Icon *ic;
Ecore_Event *ev; Ecore_Event *ev;
Ecore_Event_Mouse_Move *e; Ecore_Event_Mouse_Move *e;
D_ENTER; D_ENTER;
ev = e_view_get_current_event(); ev = e_view_get_current_event();
@ -391,7 +403,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
ic->view->drag.update = 1; ic->view->drag.update = 1;
ic->view->changed = 1; ic->view->changed = 1;
if(e->mods & ECORE_EVENT_KEY_MODIFIER_SHIFT) if (e->mods & ECORE_EVENT_KEY_MODIFIER_SHIFT)
{ {
ecore_dnd_set_mode_copy(); ecore_dnd_set_mode_copy();
ic->view->drag.drop_mode = E_DND_COPY; ic->view->drag.drop_mode = E_DND_COPY;
@ -405,7 +417,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
/* Handle dnd motion - dragging==1 */ /* Handle dnd motion - dragging==1 */
ecore_pointer_xy_get(&x, &y); ecore_pointer_xy_get(&x, &y);
ecore_window_dnd_handle_motion( ic->view->win.base, x, y, 1); ecore_window_dnd_handle_motion(ic->view->win.base, x, y, 1);
} }
D_RETURN; D_RETURN;
UN(_e); UN(_e);
@ -413,9 +425,8 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
UN(_b); UN(_b);
} }
static void static void
e_icon_cleanup(E_Icon *ic) e_icon_cleanup(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
@ -428,10 +439,14 @@ e_icon_cleanup(E_Icon *ic)
evas_del_object(ic->view->evas, ic->obj.event2); evas_del_object(ic->view->evas, ic->obj.event2);
} }
if (ic->obj.sel.under.icon) ebits_free(ic->obj.sel.under.icon); if (ic->obj.sel.under.icon)
if (ic->obj.sel.under.text) ebits_free(ic->obj.sel.under.text); ebits_free(ic->obj.sel.under.icon);
if (ic->obj.sel.over.icon) ebits_free(ic->obj.sel.over.icon); if (ic->obj.sel.under.text)
if (ic->obj.sel.over.text) ebits_free(ic->obj.sel.over.text); ebits_free(ic->obj.sel.under.text);
if (ic->obj.sel.over.icon)
ebits_free(ic->obj.sel.over.icon);
if (ic->obj.sel.over.text)
ebits_free(ic->obj.sel.over.text);
e_object_cleanup(E_OBJECT(ic)); e_object_cleanup(E_OBJECT(ic));
@ -453,10 +468,8 @@ e_icon_new(void)
D_RETURN_(ic); D_RETURN_(ic);
} }
E_Icon * E_Icon *
e_icon_find_by_file(E_View *view, char *file) e_icon_find_by_file(E_View * view, char *file)
{ {
Evas_List l; Evas_List l;
@ -467,18 +480,20 @@ e_icon_find_by_file(E_View *view, char *file)
E_Icon *ic; E_Icon *ic;
ic = l->data; ic = l->data;
if ((ic) && (ic->file->file) && (file) && (!strcmp(ic->file->file, file))) if ((ic) && (ic->file->file) && (file)
&& (!strcmp(ic->file->file, file)))
D_RETURN_(ic); D_RETURN_(ic);
} }
D_RETURN_(NULL); D_RETURN_(NULL);
} }
void void
e_icon_show(E_Icon *ic) e_icon_show(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
if (ic->state.visible) D_RETURN; if (ic->state.visible)
D_RETURN;
ic->state.visible = 1; ic->state.visible = 1;
if (!ic->obj.event1) if (!ic->obj.event1)
{ {
@ -486,16 +501,26 @@ e_icon_show(E_Icon *ic)
ic->obj.event2 = evas_add_rectangle(ic->view->evas); ic->obj.event2 = evas_add_rectangle(ic->view->evas);
evas_set_color(ic->view->evas, ic->obj.event1, 0, 0, 0, 0); evas_set_color(ic->view->evas, ic->obj.event1, 0, 0, 0, 0);
evas_set_color(ic->view->evas, ic->obj.event2, 0, 0, 0, 0); evas_set_color(ic->view->evas, ic->obj.event2, 0, 0, 0, 0);
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic); evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_DOWN,
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_UP, e_icon_up_cb, ic); e_icon_down_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_IN, e_icon_in_cb, ic); evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_UP,
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic); e_icon_up_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic); evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_IN,
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_DOWN, e_icon_down_cb, ic); e_icon_in_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_UP, e_icon_up_cb, ic); evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_OUT,
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_IN, e_icon_in_cb, ic); e_icon_out_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_OUT, e_icon_out_cb, ic); evas_callback_add(ic->view->evas, ic->obj.event1, CALLBACK_MOUSE_MOVE,
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE, e_icon_move_cb, ic); e_icon_move_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_DOWN,
e_icon_down_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_UP,
e_icon_up_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_IN,
e_icon_in_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_OUT,
e_icon_out_cb, ic);
evas_callback_add(ic->view->evas, ic->obj.event2, CALLBACK_MOUSE_MOVE,
e_icon_move_cb, ic);
} }
evas_set_layer(ic->view->evas, ic->obj.icon, 200); evas_set_layer(ic->view->evas, ic->obj.icon, 200);
e_text_set_layer(ic->obj.text, 200); e_text_set_layer(ic->obj.text, 200);
@ -511,11 +536,12 @@ e_icon_show(E_Icon *ic)
} }
void void
e_icon_hide(E_Icon *ic) e_icon_hide(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
if (!ic->state.visible) D_RETURN; if (!ic->state.visible)
D_RETURN;
ic->state.visible = 0; ic->state.visible = 0;
evas_hide(ic->view->evas, ic->obj.icon); evas_hide(ic->view->evas, ic->obj.icon);
e_text_hide(ic->obj.text); e_text_hide(ic->obj.text);
@ -523,23 +549,28 @@ e_icon_hide(E_Icon *ic)
evas_hide(ic->view->evas, ic->obj.event2); evas_hide(ic->view->evas, ic->obj.event2);
/* Hide any selection in the view */ /* Hide any selection in the view */
if(ic->obj.sel.under.icon) ebits_hide(ic->obj.sel.under.icon); if (ic->obj.sel.under.icon)
if(ic->obj.sel.under.text) ebits_hide(ic->obj.sel.under.text); ebits_hide(ic->obj.sel.under.icon);
if(ic->obj.sel.over.icon) ebits_hide(ic->obj.sel.over.icon); if (ic->obj.sel.under.text)
if(ic->obj.sel.over.text) ebits_hide(ic->obj.sel.over.text); ebits_hide(ic->obj.sel.under.text);
if (ic->obj.sel.over.icon)
ebits_hide(ic->obj.sel.over.icon);
if (ic->obj.sel.over.text)
ebits_hide(ic->obj.sel.over.text);
D_RETURN; D_RETURN;
} }
void void
e_icon_hide_delete_pending(E_Icon *ic) e_icon_hide_delete_pending(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
if (!ic->state.visible) D_RETURN; if (!ic->state.visible)
if(ic->state.selected) D_RETURN;
if (ic->state.selected)
{ {
if( ic->view->drag.drop_mode == E_DND_MOVE) if (ic->view->drag.drop_mode == E_DND_MOVE)
{ {
evas_hide(ic->view->evas, ic->obj.icon); evas_hide(ic->view->evas, ic->obj.icon);
ic->state.drag_delete = 1; ic->state.drag_delete = 1;
@ -556,17 +587,19 @@ e_icon_hide_delete_pending(E_Icon *ic)
} }
void void
e_icon_show_delete_end(E_Icon *ic, E_dnd_enum dnd_pending_mode) e_icon_show_delete_end(E_Icon * ic, E_dnd_enum dnd_pending_mode)
{ {
D_ENTER; D_ENTER;
if (!ic->state.visible) D_RETURN; if (!ic->state.visible)
if(ic->state.drag_delete) D_RETURN;
if (ic->state.drag_delete)
{ {
if(dnd_pending_mode==E_DND_DELETED || dnd_pending_mode==E_DND_COPIED) if (dnd_pending_mode == E_DND_DELETED
|| dnd_pending_mode == E_DND_COPIED)
{ {
ic->state.drag_delete = 0; ic->state.drag_delete = 0;
if(dnd_pending_mode==E_DND_COPIED) if (dnd_pending_mode == E_DND_COPIED)
evas_show(ic->view->evas, ic->obj.icon); evas_show(ic->view->evas, ic->obj.icon);
} }
} }
@ -575,7 +608,7 @@ e_icon_show_delete_end(E_Icon *ic, E_dnd_enum dnd_pending_mode)
} }
void void
e_icon_apply_xy(E_Icon *ic) e_icon_apply_xy(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
@ -584,8 +617,10 @@ e_icon_apply_xy(E_Icon *ic)
/* Ig */ /* Ig */
/* [txt] */ /* [txt] */
if (ic->geom.text.w > ic->geom.icon.w) ic->geom.w = ic->geom.text.w; if (ic->geom.text.w > ic->geom.icon.w)
else ic->geom.w = ic->geom.icon.w; ic->geom.w = ic->geom.text.w;
else
ic->geom.w = ic->geom.icon.w;
ic->geom.h = ic->geom.icon.h + ic->geom.text.h + ic->view->spacing.icon.g; ic->geom.h = ic->geom.icon.h + ic->geom.text.h + ic->view->spacing.icon.g;
evas_resize(ic->view->evas, ic->obj.event1, evas_resize(ic->view->evas, ic->obj.event1,
@ -593,27 +628,34 @@ e_icon_apply_xy(E_Icon *ic)
evas_resize(ic->view->evas, ic->obj.event2, evas_resize(ic->view->evas, ic->obj.event2,
ic->geom.text.w, ic->geom.text.h); ic->geom.text.w, ic->geom.text.h);
evas_move(ic->view->evas, ic->obj.event1, evas_move(ic->view->evas, ic->obj.event1,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2), ic->view->scroll.x + ic->geom.x +
((ic->geom.w - ic->geom.icon.w) / 2),
ic->view->scroll.y + ic->geom.y); ic->view->scroll.y + ic->geom.y);
evas_move(ic->view->evas, ic->obj.event2, evas_move(ic->view->evas, ic->obj.event2,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2), ic->view->scroll.x + ic->geom.x +
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g); ((ic->geom.w - ic->geom.text.w) / 2),
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h +
ic->view->spacing.icon.g);
evas_move(ic->view->evas, ic->obj.icon, evas_move(ic->view->evas, ic->obj.icon,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2), ic->view->scroll.x + ic->geom.x +
((ic->geom.w - ic->geom.icon.w) / 2),
ic->view->scroll.y + ic->geom.y); ic->view->scroll.y + ic->geom.y);
e_text_move(ic->obj.text, e_text_move(ic->obj.text,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2), ic->view->scroll.x + ic->geom.x +
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g); ((ic->geom.w - ic->geom.text.w) / 2),
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h +
ic->view->spacing.icon.g);
if (ic->obj.sel.under.icon) if (ic->obj.sel.under.icon)
{ {
int pl, pr, pt, pb; int pl, pr, pt, pb;
ebits_get_insets(ic->obj.sel.under.icon, &pl, &pr, &pt, &pb); ebits_get_insets(ic->obj.sel.under.icon, &pl, &pr, &pt, &pb);
ebits_move(ic->obj.sel.under.icon, ebits_move(ic->obj.sel.under.icon,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl, ic->view->scroll.x + ic->geom.x +
((ic->geom.w - ic->geom.icon.w) / 2) - pl,
ic->view->scroll.y + ic->geom.y - pt); ic->view->scroll.y + ic->geom.y - pt);
ebits_resize(ic->obj.sel.under.icon, ebits_resize(ic->obj.sel.under.icon, ic->geom.icon.w + pl + pr,
ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb); ic->geom.icon.h + pt + pb);
ebits_show(ic->obj.sel.under.icon); ebits_show(ic->obj.sel.under.icon);
} }
if (ic->obj.sel.under.text) if (ic->obj.sel.under.text)
@ -622,10 +664,12 @@ e_icon_apply_xy(E_Icon *ic)
ebits_get_insets(ic->obj.sel.under.text, &pl, &pr, &pt, &pb); ebits_get_insets(ic->obj.sel.under.text, &pl, &pr, &pt, &pb);
ebits_move(ic->obj.sel.under.text, ebits_move(ic->obj.sel.under.text,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl, ic->view->scroll.x + ic->geom.x +
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt); ((ic->geom.w - ic->geom.text.w) / 2) - pl,
ebits_resize(ic->obj.sel.under.text, ic->view->scroll.y + ic->geom.y + ic->geom.icon.h +
ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb); ic->view->spacing.icon.g - pt);
ebits_resize(ic->obj.sel.under.text, ic->geom.text.w + pl + pr,
ic->geom.text.h + pt + pb);
ebits_show(ic->obj.sel.under.text); ebits_show(ic->obj.sel.under.text);
} }
if (ic->obj.sel.over.icon) if (ic->obj.sel.over.icon)
@ -634,10 +678,11 @@ e_icon_apply_xy(E_Icon *ic)
ebits_get_insets(ic->obj.sel.over.icon, &pl, &pr, &pt, &pb); ebits_get_insets(ic->obj.sel.over.icon, &pl, &pr, &pt, &pb);
ebits_move(ic->obj.sel.over.icon, ebits_move(ic->obj.sel.over.icon,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.icon.w) / 2) - pl, ic->view->scroll.x + ic->geom.x +
((ic->geom.w - ic->geom.icon.w) / 2) - pl,
ic->view->scroll.y + ic->geom.y - pt); ic->view->scroll.y + ic->geom.y - pt);
ebits_resize(ic->obj.sel.over.icon, ebits_resize(ic->obj.sel.over.icon, ic->geom.icon.w + pl + pr,
ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb); ic->geom.icon.h + pt + pb);
ebits_show(ic->obj.sel.over.icon); ebits_show(ic->obj.sel.over.icon);
} }
if (ic->obj.sel.over.text) if (ic->obj.sel.over.text)
@ -646,10 +691,12 @@ e_icon_apply_xy(E_Icon *ic)
ebits_get_insets(ic->obj.sel.over.text, &pl, &pr, &pt, &pb); ebits_get_insets(ic->obj.sel.over.text, &pl, &pr, &pt, &pb);
ebits_move(ic->obj.sel.over.text, ebits_move(ic->obj.sel.over.text,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2) - pl, ic->view->scroll.x + ic->geom.x +
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g - pt); ((ic->geom.w - ic->geom.text.w) / 2) - pl,
ebits_resize(ic->obj.sel.over.text, ic->view->scroll.y + ic->geom.y + ic->geom.icon.h +
ic->geom.text.w + pl + pr, ic->geom.text.h + pt + pb); ic->view->spacing.icon.g - pt);
ebits_resize(ic->obj.sel.over.text, ic->geom.text.w + pl + pr,
ic->geom.text.h + pt + pb);
ebits_show(ic->obj.sel.over.text); ebits_show(ic->obj.sel.over.text);
} }
if ((ic->geom.x != ic->prev_geom.x) || (ic->geom.y != ic->prev_geom.y)) if ((ic->geom.x != ic->prev_geom.x) || (ic->geom.y != ic->prev_geom.y))
@ -658,10 +705,14 @@ e_icon_apply_xy(E_Icon *ic)
/* FIXME */ /* FIXME */
//e_view_queue_icon_xy_record(ic->view); //e_view_queue_icon_xy_record(ic->view);
} }
if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0; if (ic->geom.x != ic->prev_geom.x)
else if (ic->geom.y != ic->prev_geom.y) ic->view->extents.valid = 0; ic->view->extents.valid = 0;
else if (ic->geom.w != ic->prev_geom.w) ic->view->extents.valid = 0; else if (ic->geom.y != ic->prev_geom.y)
else if (ic->geom.h != ic->prev_geom.h) ic->view->extents.valid = 0; ic->view->extents.valid = 0;
else if (ic->geom.w != ic->prev_geom.w)
ic->view->extents.valid = 0;
else if (ic->geom.h != ic->prev_geom.h)
ic->view->extents.valid = 0;
ic->prev_geom = ic->geom; ic->prev_geom = ic->geom;
ic->prev_geom.x = ic->geom.x; ic->prev_geom.x = ic->geom.x;
@ -672,9 +723,8 @@ e_icon_apply_xy(E_Icon *ic)
D_RETURN; D_RETURN;
} }
void void
e_icon_check_permissions(E_Icon *ic) e_icon_check_permissions(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
@ -692,15 +742,13 @@ e_icon_check_permissions(E_Icon *ic)
D_RETURN; D_RETURN;
} }
void void
e_icon_initial_show(E_Icon *ic) e_icon_initial_show(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
/* check if we have enuf info and we havent been shown yet */ /* check if we have enuf info and we havent been shown yet */
if ( !ic->file->info.icon || !ic->obj.icon if (!ic->file->info.icon || !ic->obj.icon || ic->state.visible)
|| ic->state.visible)
D_RETURN; D_RETURN;
/* first. lets figure out the size of the icon */ /* first. lets figure out the size of the icon */
@ -729,10 +777,11 @@ e_icon_initial_show(E_Icon *ic)
} }
void void
e_icon_update_state(E_Icon *ic) e_icon_update_state(E_Icon * ic)
{ {
char icon[PATH_MAX]; char icon[PATH_MAX];
int iw, ih; int iw, ih;
D_ENTER; D_ENTER;
if (!ic->file->info.icon) if (!ic->file->info.icon)
@ -753,8 +802,7 @@ e_icon_update_state(E_Icon *ic)
snprintf(icon, PATH_MAX, "%s:/icon/normal", ic->file->info.icon); snprintf(icon, PATH_MAX, "%s:/icon/normal", ic->file->info.icon);
} }
if ((ic->state.selected) && if ((ic->state.selected) &&
(!ic->obj.sel.under.icon) && (!ic->obj.sel.under.icon) && (!ic->obj.sel.over.icon))
(!ic->obj.sel.over.icon))
{ {
char file[PATH_MAX]; char file[PATH_MAX];
@ -790,13 +838,16 @@ e_icon_update_state(E_Icon *ic)
} }
} }
else if ((!ic->state.selected) && else if ((!ic->state.selected) &&
((ic->obj.sel.under.icon) || ((ic->obj.sel.under.icon) || (ic->obj.sel.over.icon)))
(ic->obj.sel.over.icon)))
{ {
if (ic->obj.sel.under.icon) ebits_free(ic->obj.sel.under.icon); if (ic->obj.sel.under.icon)
if (ic->obj.sel.under.text) ebits_free(ic->obj.sel.under.text); ebits_free(ic->obj.sel.under.icon);
if (ic->obj.sel.over.icon) ebits_free(ic->obj.sel.over.icon); if (ic->obj.sel.under.text)
if (ic->obj.sel.over.text) ebits_free(ic->obj.sel.over.text); ebits_free(ic->obj.sel.under.text);
if (ic->obj.sel.over.icon)
ebits_free(ic->obj.sel.over.icon);
if (ic->obj.sel.over.text)
ebits_free(ic->obj.sel.over.text);
ic->obj.sel.under.icon = NULL; ic->obj.sel.under.icon = NULL;
ic->obj.sel.under.text = NULL; ic->obj.sel.under.text = NULL;
ic->obj.sel.over.icon = NULL; ic->obj.sel.over.icon = NULL;
@ -817,20 +868,21 @@ e_icon_update_state(E_Icon *ic)
D_RETURN; D_RETURN;
} }
void void
e_icon_invert_selection(E_Icon *ic) e_icon_invert_selection(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
if (ic->state.selected) e_icon_deselect(ic); if (ic->state.selected)
else e_icon_select(ic); e_icon_deselect(ic);
else
e_icon_select(ic);
D_RETURN; D_RETURN;
} }
void void
e_icon_select(E_Icon *ic) e_icon_select(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
@ -845,7 +897,7 @@ e_icon_select(E_Icon *ic)
} }
void void
e_icon_deselect(E_Icon *ic) e_icon_deselect(E_Icon * ic)
{ {
D_ENTER; D_ENTER;
@ -859,7 +911,7 @@ e_icon_deselect(E_Icon *ic)
} }
void void
e_icon_exec(E_Icon *ic) e_icon_exec(E_Icon * ic)
{ {
D_ENTER; D_ENTER;

View File

@ -22,20 +22,27 @@ struct _E_Icon
E_File *file; E_File *file;
E_View *view; E_View *view;
struct { struct
{
Evas_Object icon; Evas_Object icon;
Evas_Object event1; Evas_Object event1;
Evas_Object event2; Evas_Object event2;
E_Text *text; E_Text *text;
struct { struct
struct { {
struct
{
Ebits_Object icon; Ebits_Object icon;
Ebits_Object text; Ebits_Object text;
} over, under; }
} sel; over , under;
} obj; }
sel;
}
obj;
struct { struct
{
int hilited; int hilited;
int clicked; int clicked;
int selected; int selected;
@ -45,31 +52,39 @@ struct _E_Icon
int just_selected; int just_selected;
int just_executed; int just_executed;
int drag_delete; int drag_delete;
} state; }
state;
struct { struct
{
int x, y, w, h; int x, y, w, h;
struct { struct
{
int w, h; int w, h;
} icon; }
struct { icon;
struct
{
int w, h; int w, h;
} text; }
} geom, prev_geom; text;
}
geom , prev_geom;
struct { struct
{
int write_xy; int write_xy;
} q; }
q;
int changed; int changed;
}; };
E_Icon *e_icon_new(void); E_Icon *e_icon_new(void);
void e_icon_update_state(E_Icon *ic); void e_icon_update_state(E_Icon * ic);
void e_icon_invert_selection(E_Icon *ic); void e_icon_invert_selection(E_Icon * ic);
void e_icon_select(E_Icon *ic); void e_icon_select(E_Icon * ic);
void e_icon_deselect(E_Icon *ic); void e_icon_deselect(E_Icon * ic);
/** /**
* e_icon_exec - handles execution paths when user activates an icon * e_icon_exec - handles execution paths when user activates an icon
@ -78,17 +93,18 @@ void e_icon_deselect(E_Icon *ic);
* This function takes care of opening views when the user activates a * This function takes care of opening views when the user activates a
* directory, launching commands when an executable is activated etc. * directory, launching commands when an executable is activated etc.
*/ */
void e_icon_exec(E_Icon *ic); void e_icon_exec(E_Icon * ic);
void e_icon_initial_show(E_Icon *ic); void e_icon_initial_show(E_Icon * ic);
void e_icon_set_mime(E_Icon *ic, char *base, char *mime); void e_icon_set_mime(E_Icon * ic, char *base, char *mime);
void e_icon_set_link(E_Icon *ic, char *link); void e_icon_set_link(E_Icon * ic, char *link);
E_Icon *e_icon_find_by_file(E_View *view, char *file); E_Icon *e_icon_find_by_file(E_View * view, char *file);
void e_icon_show(E_Icon *ic); void e_icon_show(E_Icon * ic);
void e_icon_hide(E_Icon *ic); void e_icon_hide(E_Icon * ic);
void e_icon_hide_delete_pending(E_Icon *ic); void e_icon_hide_delete_pending(E_Icon * ic);
void e_icon_show_delete_end(E_Icon *ic, E_dnd_enum dnd_pending_mode); void e_icon_show_delete_end(E_Icon * ic,
void e_icon_apply_xy(E_Icon *ic); E_dnd_enum dnd_pending_mode);
void e_icon_check_permissions(E_Icon *ic); void e_icon_apply_xy(E_Icon * ic);
void e_icon_check_permissions(E_Icon * ic);
#endif #endif

View File

@ -6,4 +6,3 @@
void e_ipc_init(void); void e_ipc_init(void);
#endif #endif

View File

@ -4,7 +4,9 @@
#include "e.h" #include "e.h"
void e_keys_init(void); void e_keys_init(void);
void e_keys_grab(char *key, Ecore_Event_Key_Modifiers mods, int anymod); void e_keys_grab(char *key, Ecore_Event_Key_Modifiers mods,
void e_keys_ungrab(char *key, Ecore_Event_Key_Modifiers mods, int anymod); int anymod);
void e_keys_ungrab(char *key, Ecore_Event_Key_Modifiers mods,
int anymod);
#endif #endif

View File

@ -32,7 +32,8 @@ static void cb_exit(void);
static void wm_running_error(Display * d, XErrorEvent * ev); static void wm_running_error(Display * d, XErrorEvent * ev);
static void setup(void); static void setup(void);
static void cb_exit(void) static void
cb_exit(void)
{ {
D_ENTER; D_ENTER;
@ -42,7 +43,6 @@ static void cb_exit(void)
D_RETURN; D_RETURN;
} }
static void static void
wm_running_error(Display * d, XErrorEvent * ev) wm_running_error(Display * d, XErrorEvent * ev)
{ {
@ -91,25 +91,23 @@ main(int argc, char **argv)
/* Check command line options here: */ /* Check command line options here: */
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
if (( (!strcmp("-d", argv[i])) if (((!strcmp("-d", argv[i]))
|| (!strcmp("-disp", argv[i])) || (!strcmp("-disp", argv[i]))
|| (!strcmp("-display", argv[i])) || (!strcmp("-display", argv[i]))
|| (!strcmp("--display", argv[i]))) || (!strcmp("--display", argv[i]))) && (argc - i > 1))
&& (argc - i > 1))
{ {
display = argv[++i]; display = argv[++i];
} }
else if ( (!strcmp("-h", argv[i])) else if ((!strcmp("-h", argv[i]))
|| (!strcmp("-?", argv[i])) || (!strcmp("-?", argv[i]))
|| (!strcmp("-help", argv[i])) || (!strcmp("-help", argv[i])) || (!strcmp("--help", argv[i])))
|| (!strcmp("--help", argv[i])))
{ {
printf("enlightenment options: \n" printf("enlightenment options: \n"
"\t[-d | -disp | -display --display] display_name \n" "\t[-d | -disp | -display --display] display_name \n"
"\t[-v | -version | --version] \n"); "\t[-v | -version | --version] \n");
exit(0); exit(0);
} }
else if ( (!strcmp("-v", argv[i])) else if ((!strcmp("-v", argv[i]))
|| (!strcmp("-version", argv[i])) || (!strcmp("-version", argv[i]))
|| (!strcmp("--version", argv[i]))) || (!strcmp("--version", argv[i])))
{ {

View File

@ -3,7 +3,7 @@
#include "config.h" #include "config.h"
void void
e_match_set_props(E_Border *b) e_match_set_props(E_Border * b)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
E_DB_File *db; E_DB_File *db;
@ -11,38 +11,61 @@ e_match_set_props(E_Border *b)
D_ENTER; D_ENTER;
if ((!b->client.name) || (!b->client.class)) D_RETURN; if ((!b->client.name) || (!b->client.class))
D_RETURN;
db = e_db_open(e_config_get("match")); db = e_db_open(e_config_get("match"));
snprintf(buf, PATH_MAX, "match/%s/%s/match", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/match", b->client.name,
b->client.class);
ok = e_db_int_get(db, buf, &(b->client.matched.matched)); ok = e_db_int_get(db, buf, &(b->client.matched.matched));
if (!ok) if (!ok)
{ {
e_db_close(db); e_db_close(db);
D_RETURN; D_RETURN;
} }
snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore", b->client.name,
b->client.matched.prog_location.matched = e_db_int_get(db, buf, &(b->client.matched.prog_location.ignore)); b->client.class);
snprintf(buf, PATH_MAX, "match/%s/%s/border/border", b->client.name, b->client.class); b->client.matched.prog_location.matched =
e_db_int_get(db, buf, &(b->client.matched.prog_location.ignore));
snprintf(buf, PATH_MAX, "match/%s/%s/border/border", b->client.name,
b->client.class);
b->client.matched.border.style = e_db_str_get(db, buf); b->client.matched.border.style = e_db_str_get(db, buf);
b->client.matched.border.matched = (int)b->client.matched.border.style; b->client.matched.border.matched = (int)b->client.matched.border.style;
snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name,
b->client.matched.location.matched = e_db_int_get(db, buf, &(b->client.matched.location.x)); b->client.class);
snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name, b->client.class); b->client.matched.location.matched =
b->client.matched.location.matched = e_db_int_get(db, buf, &(b->client.matched.location.y)); e_db_int_get(db, buf, &(b->client.matched.location.x));
snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/x", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name,
b->client.matched.desk_area.matched = e_db_int_get(db, buf, &(b->client.matched.desk_area.x)); b->client.class);
snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/y", b->client.name, b->client.class); b->client.matched.location.matched =
b->client.matched.desk_area.matched = e_db_int_get(db, buf, &(b->client.matched.desk_area.y)); e_db_int_get(db, buf, &(b->client.matched.location.y));
snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/x", b->client.name,
b->client.matched.size.matched = e_db_int_get(db, buf, &(b->client.matched.size.w)); b->client.class);
snprintf(buf, PATH_MAX, "match/%s/%s/size/h", b->client.name, b->client.class); b->client.matched.desk_area.matched =
b->client.matched.size.matched = e_db_int_get(db, buf, &(b->client.matched.size.h)); e_db_int_get(db, buf, &(b->client.matched.desk_area.x));
snprintf(buf, PATH_MAX, "match/%s/%s/desktop/desk", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/y", b->client.name,
b->client.matched.desktop.matched = e_db_int_get(db, buf, &(b->client.matched.desktop.desk)); b->client.class);
snprintf(buf, PATH_MAX, "match/%s/%s/sticky/sticky", b->client.name, b->client.class); b->client.matched.desk_area.matched =
b->client.matched.sticky.matched = e_db_int_get(db, buf, &(b->client.matched.sticky.sticky)); e_db_int_get(db, buf, &(b->client.matched.desk_area.y));
snprintf(buf, PATH_MAX, "match/%s/%s/layer/layer", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name,
b->client.matched.layer.matched = e_db_int_get(db, buf, &(b->client.matched.layer.layer)); b->client.class);
b->client.matched.size.matched =
e_db_int_get(db, buf, &(b->client.matched.size.w));
snprintf(buf, PATH_MAX, "match/%s/%s/size/h", b->client.name,
b->client.class);
b->client.matched.size.matched =
e_db_int_get(db, buf, &(b->client.matched.size.h));
snprintf(buf, PATH_MAX, "match/%s/%s/desktop/desk", b->client.name,
b->client.class);
b->client.matched.desktop.matched =
e_db_int_get(db, buf, &(b->client.matched.desktop.desk));
snprintf(buf, PATH_MAX, "match/%s/%s/sticky/sticky", b->client.name,
b->client.class);
b->client.matched.sticky.matched =
e_db_int_get(db, buf, &(b->client.matched.sticky.sticky));
snprintf(buf, PATH_MAX, "match/%s/%s/layer/layer", b->client.name,
b->client.class);
b->client.matched.layer.matched =
e_db_int_get(db, buf, &(b->client.matched.layer.layer));
if (b->client.matched.prog_location.matched) if (b->client.matched.prog_location.matched)
{ {
@ -63,8 +86,12 @@ e_match_set_props(E_Border *b)
} }
if (b->client.matched.desk_area.matched) if (b->client.matched.desk_area.matched)
{ {
b->client.pos.x += (b->client.matched.desk_area.x - b->desk->desk.area.x) * b->desk->real.w; b->client.pos.x +=
b->client.pos.y += (b->client.matched.desk_area.y - b->desk->desk.area.y) * b->desk->real.h; (b->client.matched.desk_area.x -
b->desk->desk.area.x) * b->desk->real.w;
b->client.pos.y +=
(b->client.matched.desk_area.y -
b->desk->desk.area.y) * b->desk->real.h;
b->client.area.x = b->client.matched.desk_area.x; b->client.area.x = b->client.matched.desk_area.x;
b->client.area.y = b->client.matched.desk_area.y; b->client.area.y = b->client.matched.desk_area.y;
} }
@ -72,13 +99,15 @@ e_match_set_props(E_Border *b)
{ {
b->current.requested.w = b->client.matched.size.w; b->current.requested.w = b->client.matched.size.w;
b->current.requested.h = b->client.matched.size.h; b->current.requested.h = b->client.matched.size.h;
ecore_window_resize(b->win.client, b->client.matched.size.w, b->client.matched.size.h); ecore_window_resize(b->win.client, b->client.matched.size.w,
b->client.matched.size.h);
} }
if (b->client.matched.desktop.matched) if (b->client.matched.desktop.matched)
{ {
b->client.desk = b->client.matched.desktop.desk; b->client.desk = b->client.matched.desktop.desk;
e_border_raise(b); e_border_raise(b);
if (b->client.desk != b->desk->desk.desk) b->current.requested.visible = 0; if (b->client.desk != b->desk->desk.desk)
b->current.requested.visible = 0;
b->client.no_place = 1; b->client.no_place = 1;
} }
if (b->client.matched.sticky.matched) if (b->client.matched.sticky.matched)
@ -96,35 +125,42 @@ e_match_set_props(E_Border *b)
} }
void void
e_match_save_props(E_Border *b) e_match_save_props(E_Border * b)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
E_DB_File *db; E_DB_File *db;
D_ENTER; D_ENTER;
if ((!b->client.name) || (!b->client.class)) D_RETURN; if ((!b->client.name) || (!b->client.class))
D_RETURN;
db = e_db_open(e_config_get("match")); db = e_db_open(e_config_get("match"));
if (!db) D_RETURN; if (!db)
D_RETURN;
snprintf(buf, PATH_MAX, "match/%s/%s/match", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/match", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.matched); e_db_int_set(db, buf, b->client.matched.matched);
if (b->client.matched.location.matched) if (b->client.matched.location.matched)
{ {
b->client.matched.location.x = b->current.x; b->client.matched.location.x = b->current.x;
b->client.matched.location.y = b->current.y; b->client.matched.location.y = b->current.y;
snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.location.x); e_db_int_set(db, buf, b->client.matched.location.x);
snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.location.y); e_db_int_set(db, buf, b->client.matched.location.y);
} }
else else
{ {
snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name,
b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name,
b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
} }
@ -132,51 +168,61 @@ e_match_save_props(E_Border *b)
{ {
b->client.matched.size.w = b->client.w; b->client.matched.size.w = b->client.w;
b->client.matched.size.h = b->client.h; b->client.matched.size.h = b->client.h;
snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.size.w); e_db_int_set(db, buf, b->client.matched.size.w);
snprintf(buf, PATH_MAX, "match/%s/%s/size/h", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/size/h", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.size.h); e_db_int_set(db, buf, b->client.matched.size.h);
} }
else else
{ {
snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name,
b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
snprintf(buf, PATH_MAX, "match/%s/%s/size/h", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/size/h", b->client.name,
b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
} }
if (b->client.matched.desktop.matched) if (b->client.matched.desktop.matched)
{ {
b->client.matched.desktop.desk = b->client.desk; b->client.matched.desktop.desk = b->client.desk;
snprintf(buf, PATH_MAX, "match/%s/%s/desktop/desk", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/desktop/desk", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.desktop.desk); e_db_int_set(db, buf, b->client.matched.desktop.desk);
} }
else else
{ {
snprintf(buf, PATH_MAX, "match/%s/%s/desktop/desk", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/desktop/desk", b->client.name,
b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
} }
if (b->client.matched.sticky.matched) if (b->client.matched.sticky.matched)
{ {
b->client.matched.sticky.sticky = b->client.sticky; b->client.matched.sticky.sticky = b->client.sticky;
snprintf(buf, PATH_MAX, "match/%s/%s/sticky/sticky", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/sticky/sticky", b->client.name,
b->client.class);
e_db_int_set(db, buf, b->client.matched.sticky.sticky); e_db_int_set(db, buf, b->client.matched.sticky.sticky);
} }
else else
{ {
snprintf(buf, PATH_MAX, "match/%s/%s/sticky/sticky", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/sticky/sticky", b->client.name,
b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
} }
if (b->client.matched.prog_location.matched) if (b->client.matched.prog_location.matched)
{ {
snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore",
b->client.name, b->client.class);
e_db_int_set(db, buf, b->client.matched.prog_location.ignore); e_db_int_set(db, buf, b->client.matched.prog_location.ignore);
} }
else else
{ {
snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore", b->client.name, b->client.class); snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore",
b->client.name, b->client.class);
e_db_data_del(db, buf); e_db_data_del(db, buf);
} }

View File

@ -5,8 +5,7 @@
#include "border.h" #include "border.h"
#include "desktops.h" #include "desktops.h"
void e_match_set_props(E_Border *b); void e_match_set_props(E_Border * b);
void e_match_save_props(E_Border *b); void e_match_save_props(E_Border * b);
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -11,16 +11,22 @@ struct _E_Menu
{ {
E_Object o; E_Object o;
struct { struct
{
int x, y, w, h; int x, y, w, h;
int visible; int visible;
} current, previous; }
struct { current , previous;
struct
{
int l, r, t, b; int l, r, t, b;
} border, sel_border; }
struct { border , sel_border;
struct
{
Window main, evas; Window main, evas;
} win; }
win;
Evas evas; Evas evas;
Ebits_Object bg; Ebits_Object bg;
Evas_List entries; Evas_List entries;
@ -34,30 +40,38 @@ struct _E_Menu
int delete_me; int delete_me;
struct { struct
{
int state, icon, text; int state, icon, text;
} size; }
struct { size;
struct
{
int icon, state; int icon, state;
} pad; }
pad;
E_Menu_Item *selected; E_Menu_Item *selected;
Time time; Time time;
void (*func_hide) (E_Menu *m, void *data); void (*func_hide) (E_Menu * m, void *data);
void *func_hide_data; void *func_hide_data;
}; };
struct _E_Menu_Item struct _E_Menu_Item
{ {
int x, y; int x, y;
struct { struct
struct { {
struct
{
int w, h; int w, h;
} min; }
min;
int w, h; int w, h;
} size; }
size;
Ebits_Object bg; Ebits_Object bg;
char *bg_file; char *bg_file;
@ -87,58 +101,64 @@ struct _E_Menu_Item
E_Menu *menu; E_Menu *menu;
E_Menu *submenu; E_Menu *submenu;
void (*func_select) (E_Menu *m, E_Menu_Item *mi, void *data); void (*func_select) (E_Menu * m, E_Menu_Item * mi,
void *data);
void *func_select_data; void *func_select_data;
}; };
/** /**
* e_menu_init - Menu event handling initalization. * e_menu_init - Menu event handling initalization.
* *
* This function hooks in the necessary event handlers for * This function hooks in the necessary event handlers for
* menu handling. * menu handling.
*/ */
void e_menu_init(void ); void e_menu_init(void);
void e_menu_callback_item(E_Menu *m, E_Menu_Item *mi); void e_menu_callback_item(E_Menu * m, E_Menu_Item * mi);
void e_menu_item_set_callback(E_Menu_Item *mi, void (*func) (E_Menu *m, E_Menu_Item *mi, void *data), void *data); void e_menu_item_set_callback(E_Menu_Item * mi,
void e_menu_hide_callback(E_Menu *m, void (*func) (E_Menu *m, void *data), void *data); void (*func) (E_Menu * m,
void e_menu_hide_submenus(E_Menu *menus_after); E_Menu_Item * mi,
void *data),
void *data);
void e_menu_hide_callback(E_Menu * m,
void (*func) (E_Menu * m, void *data),
void *data);
void e_menu_hide_submenus(E_Menu * menus_after);
void e_menu_select(int dx, int dy); void e_menu_select(int dx, int dy);
void e_menu_event_win_show(void ); void e_menu_event_win_show(void);
void e_menu_event_win_hide(void ); void e_menu_event_win_hide(void);
void e_menu_set_background(E_Menu *m); void e_menu_set_background(E_Menu * m);
void e_menu_set_sel(E_Menu *m, E_Menu_Item *mi); void e_menu_set_sel(E_Menu * m, E_Menu_Item * mi);
void e_menu_set_sep(E_Menu *m, E_Menu_Item *mi); void e_menu_set_sep(E_Menu * m, E_Menu_Item * mi);
void e_menu_set_state(E_Menu *m, E_Menu_Item *mi); void e_menu_set_state(E_Menu * m, E_Menu_Item * mi);
E_Menu *e_menu_new(void ); E_Menu *e_menu_new(void);
void e_menu_hide(E_Menu *m); void e_menu_hide(E_Menu * m);
void e_menu_show(E_Menu *m); void e_menu_show(E_Menu * m);
void e_menu_move_to(E_Menu *m, int x, int y); void e_menu_move_to(E_Menu * m, int x, int y);
void e_menu_show_at_mouse(E_Menu *m, int x, int y, Time t); void e_menu_show_at_mouse(E_Menu * m, int x, int y, Time t);
void e_menu_add_item(E_Menu *m, E_Menu_Item *mi); void e_menu_add_item(E_Menu * m, E_Menu_Item * mi);
void e_menu_del_item(E_Menu *m, E_Menu_Item *mi); void e_menu_del_item(E_Menu * m, E_Menu_Item * mi);
void e_menu_item_update(E_Menu *m, E_Menu_Item *mi); void e_menu_item_update(E_Menu * m, E_Menu_Item * mi);
void e_menu_item_unrealize(E_Menu *m, E_Menu_Item *mi); void e_menu_item_unrealize(E_Menu * m, E_Menu_Item * mi);
void e_menu_item_realize(E_Menu *m, E_Menu_Item *mi); void e_menu_item_realize(E_Menu * m, E_Menu_Item * mi);
E_Menu_Item *e_menu_item_new(char *str); E_Menu_Item *e_menu_item_new(char *str);
void e_menu_obscure_outside_screen(E_Menu *m); void e_menu_obscure_outside_screen(E_Menu * m);
void e_menu_scroll_all_by(int dx, int dy); void e_menu_scroll_all_by(int dx, int dy);
void e_menu_update_visibility(E_Menu *m); void e_menu_update_visibility(E_Menu * m);
void e_menu_update_base(E_Menu *m); void e_menu_update_base(E_Menu * m);
void e_menu_update_finish(E_Menu *m); void e_menu_update_finish(E_Menu * m);
void e_menu_update_shows(E_Menu *m); void e_menu_update_shows(E_Menu * m);
void e_menu_update_hides(E_Menu *m); void e_menu_update_hides(E_Menu * m);
void e_menu_update(E_Menu *m); void e_menu_update(E_Menu * m);
void e_menu_item_set_icon(E_Menu_Item *mi, char *icon); void e_menu_item_set_icon(E_Menu_Item * mi, char *icon);
void e_menu_item_set_text(E_Menu_Item *mi, char *text); void e_menu_item_set_text(E_Menu_Item * mi, char *text);
void e_menu_item_set_separator(E_Menu_Item *mi, int sep); void e_menu_item_set_separator(E_Menu_Item * mi, int sep);
void e_menu_item_set_radio(E_Menu_Item *mi, int radio); void e_menu_item_set_radio(E_Menu_Item * mi, int radio);
void e_menu_item_set_check(E_Menu_Item *mi, int check); void e_menu_item_set_check(E_Menu_Item * mi, int check);
void e_menu_item_set_state(E_Menu_Item *mi, int state); void e_menu_item_set_state(E_Menu_Item * mi, int state);
void e_menu_item_set_submenu(E_Menu_Item *mi, E_Menu *submenu); void e_menu_item_set_submenu(E_Menu_Item * mi, E_Menu * submenu);
void e_menu_item_set_scale_icon(E_Menu_Item *mi, int scale); void e_menu_item_set_scale_icon(E_Menu_Item * mi, int scale);
void e_menu_set_padding_icon(E_Menu *m, int pad); void e_menu_set_padding_icon(E_Menu * m, int pad);
void e_menu_set_padding_state(E_Menu *m, int pad); void e_menu_set_padding_state(E_Menu * m, int pad);
#endif #endif

View File

@ -13,25 +13,31 @@
Evas_List build_menus = NULL; Evas_List build_menus = NULL;
static void e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data); static void e_build_menu_cb_exec(E_Menu * m, E_Menu_Item * mi,
static void e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data); void *data);
static void e_build_menu_cb_exec(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_build_menu_unbuild(E_Build_Menu *bm); static void e_build_menu_unbuild(E_Build_Menu * bm);
static void e_build_menu_db_poll(int val, void *data); static void e_build_menu_db_poll(int val, void *data);
static E_Menu *e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num); static E_Menu *e_build_menu_db_build_number(E_Build_Menu * bm,
static void e_build_menu_db_build(E_Build_Menu *bm); E_DB_File * db, int num);
static void e_build_menu_db_build(E_Build_Menu * bm);
static void e_build_menu_gnome_apps_poll(int val, void *data); static void e_build_menu_gnome_apps_poll(int val, void *data);
static void e_build_menu_gnome_apps_build(E_Build_Menu *bm); static void e_build_menu_gnome_apps_build(E_Build_Menu * bm);
static E_Menu *e_build_menu_iconified_borders_build(E_Build_Menu *bm);
static void e_build_menu_iconified_borders_changed(E_Observer *observer, E_Observee *observee, E_Event_Type event);
static E_Menu *e_build_menu_iconified_borders_build(E_Build_Menu * bm);
static void e_build_menu_iconified_borders_changed(E_Observer *
observer,
E_Observee *
observee,
E_Event_Type event);
/* ------------ various callbacks ---------------------- */ /* ------------ various callbacks ---------------------- */
static void static void
e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data) e_build_menu_cb_exec(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
char *exe; char *exe;
@ -46,7 +52,7 @@ e_build_menu_cb_exec(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_build_menu_cb_uniconify(E_Menu *m, E_Menu_Item *mi, void *data) e_build_menu_cb_uniconify(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
E_Border *b; E_Border *b;
@ -61,7 +67,7 @@ e_build_menu_cb_uniconify(E_Menu *m, E_Menu_Item *mi, void *data)
} }
static void static void
e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data) e_build_menu_cb_script(E_Menu * m, E_Menu_Item * mi, void *data)
{ {
char *script; char *script;
@ -84,7 +90,7 @@ e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data)
/*--------------------------------------------------------*/ /*--------------------------------------------------------*/
static void static void
e_build_menu_unbuild(E_Build_Menu *bm) e_build_menu_unbuild(E_Build_Menu * bm)
{ {
Evas_List l; Evas_List l;
@ -119,10 +125,8 @@ e_build_menu_unbuild(E_Build_Menu *bm)
D_RETURN; D_RETURN;
} }
/* BUILDING from DB's */ /* BUILDING from DB's */
static void static void
e_build_menu_db_poll(int val, void *data) e_build_menu_db_poll(int val, void *data)
{ {
@ -142,7 +146,8 @@ e_build_menu_db_poll(int val, void *data)
e_build_menu_unbuild(bm); e_build_menu_unbuild(bm);
e_build_menu_db_build(bm); e_build_menu_db_build(bm);
if (!bm->menu) bm->mod_time = 0; if (!bm->menu)
bm->mod_time = 0;
ecore_add_event_timer(bm->file, 1.0, e_build_menu_db_poll, 0, data); ecore_add_event_timer(bm->file, 1.0, e_build_menu_db_poll, 0, data);
@ -162,14 +167,16 @@ e_build_menu_gnome_apps_poll(int val, void *data)
mod = e_file_mod_time(bm->file); mod = e_file_mod_time(bm->file);
if (mod <= bm->mod_time) if (mod <= bm->mod_time)
{ {
ecore_add_event_timer(bm->file, 1.0, e_build_menu_gnome_apps_poll, 0, data); ecore_add_event_timer(bm->file, 1.0, e_build_menu_gnome_apps_poll, 0,
data);
D_RETURN; D_RETURN;
} }
bm->mod_time = mod; bm->mod_time = mod;
e_build_menu_unbuild(bm); e_build_menu_unbuild(bm);
e_build_menu_gnome_apps_build(bm); e_build_menu_gnome_apps_build(bm);
if (!bm->menu) bm->mod_time = 0; if (!bm->menu)
bm->mod_time = 0;
ecore_add_event_timer(bm->file, 1.0, e_build_menu_gnome_apps_poll, 0, data); ecore_add_event_timer(bm->file, 1.0, e_build_menu_gnome_apps_poll, 0, data);
@ -178,7 +185,7 @@ e_build_menu_gnome_apps_poll(int val, void *data)
} }
static E_Menu * static E_Menu *
e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num) e_build_menu_db_build_number(E_Build_Menu * bm, E_DB_File * db, int num)
{ {
E_Menu *menu; E_Menu *menu;
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -187,7 +194,8 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
D_ENTER; D_ENTER;
snprintf(buf, PATH_MAX, "/menu/%i/count", num); snprintf(buf, PATH_MAX, "/menu/%i/count", num);
if (!e_db_int_get(db, buf, &num2)) D_RETURN_(NULL); if (!e_db_int_get(db, buf, &num2))
D_RETURN_(NULL);
menu = e_menu_new(); menu = e_menu_new();
e_menu_set_padding_icon(menu, 2); e_menu_set_padding_icon(menu, 2);
e_menu_set_padding_state(menu, 2); e_menu_set_padding_state(menu, 2);
@ -212,10 +220,12 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
e_db_int_get(db, buf, &sep); e_db_int_get(db, buf, &sep);
menuitem = e_menu_item_new(text); menuitem = e_menu_item_new(text);
e_menu_item_set_icon(menuitem, icon); e_menu_item_set_icon(menuitem, icon);
if ((icon) && (text)) e_menu_item_set_scale_icon(menuitem, 1); if ((icon) && (text))
e_menu_item_set_scale_icon(menuitem, 1);
IF_FREE(text); IF_FREE(text);
IF_FREE(icon); IF_FREE(icon);
if (sep) e_menu_item_set_separator(menuitem, 1); if (sep)
e_menu_item_set_separator(menuitem, 1);
else else
{ {
if (ok) if (ok)
@ -231,7 +241,7 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, exe); e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, exe);
bm->commands = evas_list_prepend(bm->commands, exe); bm->commands = evas_list_prepend(bm->commands, exe);
} }
if( script ) if (script)
{ {
e_menu_item_set_callback(menuitem, e_build_menu_cb_script, script); e_menu_item_set_callback(menuitem, e_build_menu_cb_script, script);
bm->commands = evas_list_prepend(bm->commands, script); bm->commands = evas_list_prepend(bm->commands, script);
@ -244,7 +254,7 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
} }
static void static void
e_build_menu_db_build(E_Build_Menu *bm) e_build_menu_db_build(E_Build_Menu * bm)
{ {
E_DB_File *db; E_DB_File *db;
int num; int num;
@ -253,22 +263,23 @@ e_build_menu_db_build(E_Build_Menu *bm)
e_db_flush(); e_db_flush();
db = e_db_open_read(bm->file); db = e_db_open_read(bm->file);
if (!db) D_RETURN; if (!db)
D_RETURN;
if (!e_db_int_get(db, "/menu/count", &num)) goto error; if (!e_db_int_get(db, "/menu/count", &num))
if (num > 0) bm->menu = e_build_menu_db_build_number(bm, db, 0); goto error;
if (num > 0)
bm->menu = e_build_menu_db_build_number(bm, db, 0);
error: error:
e_db_close(db); e_db_close(db);
D_RETURN; D_RETURN;
} }
/* BUILD from GNOME APPS directory structure */ /* BUILD from GNOME APPS directory structure */
static E_Menu * static E_Menu *
e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir) e_build_menu_gnome_apps_build_dir(E_Build_Menu * bm, char *dir)
{ {
E_Menu *menu = NULL; E_Menu *menu = NULL;
Evas_List l, entries = NULL; Evas_List l, entries = NULL;
@ -278,7 +289,7 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
menu = e_menu_new(); menu = e_menu_new();
e_menu_set_padding_icon(menu, 2); e_menu_set_padding_icon(menu, 2);
e_menu_set_padding_state(menu, 2); e_menu_set_padding_state(menu, 2);
/* build the order of things to scan ...*/ /* build the order of things to scan ... */
{ {
FILE *f; FILE *f;
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -330,7 +341,8 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
} }
free(s); free(s);
} }
if (dirlist) evas_list_free(dirlist); if (dirlist)
evas_list_free(dirlist);
} }
/* now go thru list... */ /* now go thru list... */
for (l = entries; l; l = l->next) for (l = entries; l; l = l->next)
@ -365,7 +377,8 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
f = fopen(buf, "rb"); f = fopen(buf, "rb");
} }
/* doesnt exist at all? next item */ /* doesnt exist at all? next item */
else continue; else
continue;
if (f) if (f)
{ {
while (fgets(buf, PATH_MAX, f)) while (fgets(buf, PATH_MAX, f))
@ -399,7 +412,8 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
{ {
char buf2[PATH_MAX]; char buf2[PATH_MAX];
snprintf(buf2, PATH_MAX, "/usr/share/pixmaps/%s", eq +1); snprintf(buf2, PATH_MAX,
"/usr/share/pixmaps/%s", eq + 1);
icon = strdup(buf2); icon = strdup(buf2);
} }
} }
@ -418,30 +432,35 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
fclose(f); fclose(f);
} }
if (!name) name = strdup(s); if (!name)
name = strdup(s);
menuitem = e_menu_item_new(name); menuitem = e_menu_item_new(name);
if (icon) e_menu_item_set_icon(menuitem, icon); if (icon)
if ((icon) && (name)) e_menu_item_set_scale_icon(menuitem, 1); e_menu_item_set_icon(menuitem, icon);
if ((icon) && (name))
e_menu_item_set_scale_icon(menuitem, 1);
if (exe) if (exe)
{ {
e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, exe); e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, exe);
bm->commands = evas_list_prepend(bm->commands, exe); bm->commands = evas_list_prepend(bm->commands, exe);
} }
if (sub) e_menu_item_set_submenu(menuitem, sub); if (sub)
e_menu_item_set_submenu(menuitem, sub);
e_menu_add_item(menu, menuitem); e_menu_add_item(menu, menuitem);
IF_FREE(name); IF_FREE(name);
IF_FREE(icon); IF_FREE(icon);
free(s); free(s);
} }
if (entries) evas_list_free(entries); if (entries)
evas_list_free(entries);
bm->menus = evas_list_prepend(bm->menus, menu); bm->menus = evas_list_prepend(bm->menus, menu);
D_RETURN_(menu); D_RETURN_(menu);
} }
static void static void
e_build_menu_gnome_apps_build(E_Build_Menu *bm) e_build_menu_gnome_apps_build(E_Build_Menu * bm)
{ {
E_Menu *menu; E_Menu *menu;
@ -454,7 +473,7 @@ e_build_menu_gnome_apps_build(E_Build_Menu *bm)
} }
static void static void
e_build_menu_cleanup(E_Build_Menu *bm) e_build_menu_cleanup(E_Build_Menu * bm)
{ {
D_ENTER; D_ENTER;
@ -476,7 +495,8 @@ e_build_menu_new_from_db(char *file)
D_ENTER; D_ENTER;
if (!file) D_RETURN_(NULL); if (!file)
D_RETURN_(NULL);
bm = NEW(E_Build_Menu, 1); bm = NEW(E_Build_Menu, 1);
ZERO(bm, E_Build_Menu, 1); ZERO(bm, E_Build_Menu, 1);
@ -497,7 +517,8 @@ e_build_menu_new_from_gnome_apps(char *dir)
D_ENTER; D_ENTER;
if (!dir) D_RETURN_(NULL); if (!dir)
D_RETURN_(NULL);
bm = NEW(E_Build_Menu, 1); bm = NEW(E_Build_Menu, 1);
ZERO(bm, E_Build_Menu, 1); ZERO(bm, E_Build_Menu, 1);
@ -525,11 +546,14 @@ e_build_menu_new_from_iconified_borders()
ZERO(bm, E_Build_Menu, 1); ZERO(bm, E_Build_Menu, 1);
/* e_observer_init(E_OBSERVER(bm), E_EVENT_BORDER_ICONIFY | E_EVENT_BORDER_UNICONIFY | E_EVENT_BORDER_NEW, e_build_menu_iconified_borders_changed, (E_Cleanup_Func) e_build_menu_cleanup);*/ /* e_observer_init(E_OBSERVER(bm), E_EVENT_BORDER_ICONIFY | E_EVENT_BORDER_UNICONIFY | E_EVENT_BORDER_NEW, e_build_menu_iconified_borders_changed, (E_Cleanup_Func) e_build_menu_cleanup);*/
e_observer_init(E_OBSERVER(bm), E_EVENT_BORDER_ALL, e_build_menu_iconified_borders_changed, (E_Cleanup_Func) e_build_menu_cleanup); e_observer_init(E_OBSERVER(bm), E_EVENT_BORDER_ALL,
e_build_menu_iconified_borders_changed,
(E_Cleanup_Func) e_build_menu_cleanup);
for (l = e_border_get_borders_list(); l; l = l->next) for (l = e_border_get_borders_list(); l; l = l->next)
{ {
E_Border *b = l->data; E_Border *b = l->data;
e_observer_register_observee(E_OBSERVER(bm), E_OBSERVEE(b)); e_observer_register_observee(E_OBSERVER(bm), E_OBSERVEE(b));
} }
bm->menu = e_build_menu_iconified_borders_build(bm); bm->menu = e_build_menu_iconified_borders_build(bm);
@ -540,7 +564,7 @@ e_build_menu_new_from_iconified_borders()
} }
void void
e_build_menu_iconified_borders_rebuild(E_Build_Menu *bm) e_build_menu_iconified_borders_rebuild(E_Build_Menu * bm)
{ {
D_ENTER; D_ENTER;
@ -552,7 +576,9 @@ e_build_menu_iconified_borders_rebuild(E_Build_Menu *bm)
} }
static void static void
e_build_menu_iconified_borders_changed(E_Observer *observer, E_Observee *observee, E_Event_Type event) e_build_menu_iconified_borders_changed(E_Observer * observer,
E_Observee * observee,
E_Event_Type event)
{ {
E_Build_Menu *bm; E_Build_Menu *bm;
@ -561,7 +587,8 @@ e_build_menu_iconified_borders_changed(E_Observer *observer, E_Observee *observe
if (event & E_EVENT_BORDER_NEW) if (event & E_EVENT_BORDER_NEW)
{ {
D("catch new border, register it\n"); D("catch new border, register it\n");
e_observer_register_observee(E_OBSERVER(observer), E_OBSERVEE(observee)); e_observer_register_observee(E_OBSERVER(observer),
E_OBSERVEE(observee));
} }
else if (event & E_EVENT_BORDER_DELETE) else if (event & E_EVENT_BORDER_DELETE)
@ -572,7 +599,7 @@ e_build_menu_iconified_borders_changed(E_Observer *observer, E_Observee *observe
else if (event & (E_EVENT_BORDER_ICONIFY | E_EVENT_BORDER_UNICONIFY)) else if (event & (E_EVENT_BORDER_ICONIFY | E_EVENT_BORDER_UNICONIFY))
{ {
D("catch iconify, set menu to changed\n"); D("catch iconify, set menu to changed\n");
bm = (E_Build_Menu *)observer; bm = (E_Build_Menu *) observer;
bm->changed = 1; bm->changed = 1;
} }
@ -580,7 +607,7 @@ e_build_menu_iconified_borders_changed(E_Observer *observer, E_Observee *observe
} }
static E_Menu * static E_Menu *
e_build_menu_iconified_borders_build(E_Build_Menu *bm) e_build_menu_iconified_borders_build(E_Build_Menu * bm)
{ {
E_Menu *menu = NULL; E_Menu *menu = NULL;
Evas_List l, entries = NULL; Evas_List l, entries = NULL;

View File

@ -26,5 +26,5 @@ E_Build_Menu *e_build_menu_new_from_db(char *file);
E_Build_Menu *e_build_menu_new_from_gnome_apps(char *dir); E_Build_Menu *e_build_menu_new_from_gnome_apps(char *dir);
E_Build_Menu *e_build_menu_new_from_iconified_borders(); E_Build_Menu *e_build_menu_new_from_iconified_borders();
void e_build_menu_iconified_borders_rebuild(E_Build_Menu *bm); void e_build_menu_iconified_borders_rebuild(E_Build_Menu * bm);
#endif #endif

View File

@ -2,7 +2,7 @@
#include "object.h" #include "object.h"
void void
e_object_init(E_Object *obj, E_Cleanup_Func cleanup_func) e_object_init(E_Object * obj, E_Cleanup_Func cleanup_func)
{ {
D_ENTER; D_ENTER;
@ -17,7 +17,7 @@ e_object_init(E_Object *obj, E_Cleanup_Func cleanup_func)
} }
void void
e_object_cleanup(E_Object *obj) e_object_cleanup(E_Object * obj)
{ {
D_ENTER; D_ENTER;
@ -29,9 +29,8 @@ e_object_cleanup(E_Object *obj)
D_RETURN; D_RETURN;
} }
void void
e_object_ref(E_Object *obj) e_object_ref(E_Object * obj)
{ {
D_ENTER; D_ENTER;
@ -45,7 +44,7 @@ e_object_ref(E_Object *obj)
} }
int int
e_object_unref(E_Object *obj) e_object_unref(E_Object * obj)
{ {
D_ENTER; D_ENTER;
@ -66,9 +65,8 @@ e_object_unref(E_Object *obj)
D_RETURN_(obj->references); D_RETURN_(obj->references);
} }
int int
e_object_get_usecount(E_Object *obj) e_object_get_usecount(E_Object * obj)
{ {
D_ENTER; D_ENTER;

View File

@ -13,7 +13,8 @@ typedef struct _e_object
int references; int references;
E_Cleanup_Func cleanup_func; E_Cleanup_Func cleanup_func;
} E_Object; }
E_Object;
/** /**
* e_object_init - Initializes an E object * e_object_init - Initializes an E object
@ -32,7 +33,7 @@ typedef struct _e_object
* The final free() call has to happen in the root class, * The final free() call has to happen in the root class,
* here, it happens in e_object_cleanup(). * here, it happens in e_object_cleanup().
*/ */
void e_object_init(E_Object *obj, E_Cleanup_Func cleanup_func); void e_object_init(E_Object * obj, E_Cleanup_Func cleanup_func);
/** /**
* e_object_cleanup - Cleanup function for E_Objects * e_object_cleanup - Cleanup function for E_Objects
@ -43,13 +44,13 @@ void e_object_init(E_Object *obj, E_Cleanup_Func cleanup_func);
* at the end. This is the place where the final free() * at the end. This is the place where the final free()
* call occurs. * call occurs.
*/ */
void e_object_cleanup(E_Object *obj); void e_object_cleanup(E_Object * obj);
/** /**
* e_object_ref - Increment the reference count of this object * e_object_ref - Increment the reference count of this object
* @obj: The object whose reference count to increase * @obj: The object whose reference count to increase
*/ */
void e_object_ref(E_Object *obj); void e_object_ref(E_Object * obj);
/** /**
* e_object_unref - Decrememnt the reference count of this object * e_object_unref - Decrememnt the reference count of this object
@ -62,7 +63,7 @@ void e_object_ref(E_Object *obj);
* and works its way back to the root class's destructor, * and works its way back to the root class's destructor,
* e_object_cleanup(). * e_object_cleanup().
*/ */
int e_object_unref(E_Object *obj); int e_object_unref(E_Object * obj);
/** /**
* e_object_get_usecount - Returns the current use count * e_object_get_usecount - Returns the current use count
@ -73,6 +74,6 @@ int e_object_unref(E_Object *obj);
* gets cleaned up by checking if the use count is one, * gets cleaned up by checking if the use count is one,
* cleaning up, and then calling e_object_unref(). * cleaning up, and then calling e_object_unref().
*/ */
int e_object_get_usecount(E_Object *obj); int e_object_get_usecount(E_Object * obj);
#endif #endif

View File

@ -6,9 +6,8 @@
static Evas_List observers; static Evas_List observers;
void void
e_observer_init(E_Observer *obs, E_Event_Type event, e_observer_init(E_Observer * obs, E_Event_Type event,
E_Notify_Func notify_func, E_Notify_Func notify_func, E_Cleanup_Func cleanup_func)
E_Cleanup_Func cleanup_func)
{ {
D_ENTER; D_ENTER;
@ -29,7 +28,7 @@ e_observer_init(E_Observer *obs, E_Event_Type event,
} }
void void
e_observer_cleanup(E_Observer *obs) e_observer_cleanup(E_Observer * obs)
{ {
E_Observee *o = NULL; E_Observee *o = NULL;
@ -52,7 +51,7 @@ e_observer_cleanup(E_Observer *obs)
} }
void void
e_observer_register_observee(E_Observer *observer, E_Observee *observee) e_observer_register_observee(E_Observer * observer, E_Observee * observee)
{ {
D_ENTER; D_ENTER;
@ -65,7 +64,7 @@ e_observer_register_observee(E_Observer *observer, E_Observee *observee)
} }
void void
e_observer_unregister_observee(E_Observer *observer, E_Observee *observee) e_observer_unregister_observee(E_Observer * observer, E_Observee * observee)
{ {
D_ENTER; D_ENTER;
@ -78,11 +77,10 @@ e_observer_unregister_observee(E_Observer *observer, E_Observee *observee)
D_RETURN; D_RETURN;
} }
/* --------------------- Observee code below */ /* --------------------- Observee code below */
void void
e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func) e_observee_init(E_Observee * obs, E_Cleanup_Func cleanup_func)
{ {
D_ENTER; D_ENTER;
@ -96,9 +94,8 @@ e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func)
D_RETURN; D_RETURN;
} }
void void
e_observee_notify_observers(E_Observee *o, E_Event_Type event) e_observee_notify_observers(E_Observee * o, E_Event_Type event)
{ {
Evas_List obs_list = NULL; Evas_List obs_list = NULL;
E_Observer *obs = NULL; E_Observer *obs = NULL;
@ -123,7 +120,7 @@ e_observee_notify_observers(E_Observee *o, E_Event_Type event)
} }
void void
e_observee_notify_all_observers(E_Observee *o, E_Event_Type event) e_observee_notify_all_observers(E_Observee * o, E_Event_Type event)
{ {
Evas_List obs_list = NULL; Evas_List obs_list = NULL;
E_Observer *obs = NULL; E_Observer *obs = NULL;
@ -148,7 +145,7 @@ e_observee_notify_all_observers(E_Observee *o, E_Event_Type event)
} }
void void
e_observee_cleanup(E_Observee *obs) e_observee_cleanup(E_Observee * obs)
{ {
E_Observer *observer = NULL; E_Observer *observer = NULL;
@ -171,4 +168,3 @@ e_observee_cleanup(E_Observee *obs)
D_RETURN; D_RETURN;
} }

View File

@ -39,9 +39,12 @@ typedef enum _e_event_type
/* ALL events */ /* ALL events */
E_EVENT_MAX = 0xFFFFFFFF E_EVENT_MAX = 0xFFFFFFFF
} E_Event_Type; }
E_Event_Type;
typedef void(*E_Notify_Func)(E_Observer *observer, E_Observee *observee, E_Event_Type event); typedef void (*E_Notify_Func) (E_Observer * observer,
E_Observee * observee,
E_Event_Type event);
struct _e_observer struct _e_observer
{ {
@ -59,7 +62,6 @@ struct _e_observee
Evas_List observers; /* list<E_Observer> */ Evas_List observers; /* list<E_Observer> */
}; };
/** /**
* e_observer_init - Initializes an observer * e_observer_init - Initializes an observer
* @obs: The observer to initialize * @obs: The observer to initialize
@ -72,7 +74,7 @@ struct _e_observee
* e_observee_notify_observers() call. Observers are derived from * e_observee_notify_observers() call. Observers are derived from
* E_Objects, therefore, this function also handles E_Object initalization. * E_Objects, therefore, this function also handles E_Object initalization.
*/ */
void e_observer_init(E_Observer *obs, E_Event_Type event, void e_observer_init(E_Observer * obs, E_Event_Type event,
E_Notify_Func notify_func, E_Notify_Func notify_func,
E_Cleanup_Func cleanup_func); E_Cleanup_Func cleanup_func);
@ -82,7 +84,7 @@ void e_observer_init(E_Observer *obs, E_Event_Type event,
* *
* This function cleans up an observer by unregistering all observees. * This function cleans up an observer by unregistering all observees.
*/ */
void e_observer_cleanup(E_Observer *obs); void e_observer_cleanup(E_Observer * obs);
/** /**
* e_observer_register_observee - Registers an observee * e_observer_register_observee - Registers an observee
@ -91,7 +93,8 @@ void e_observer_cleanup(E_Observer *obs);
* *
* This function registers the observer in the observee and vice versa. * This function registers the observer in the observee and vice versa.
*/ */
void e_observer_register_observee(E_Observer *observer, E_Observee *observee); void e_observer_register_observee(E_Observer * observer,
E_Observee * observee);
/** /**
* e_observer_unregister_observee - Unregisters an observee * e_observer_unregister_observee - Unregisters an observee
@ -100,7 +103,8 @@ void e_observer_register_observee(E_Observer *observer, E_Observee *observee)
* *
* This function unregisters the observer in the observee and vice versa. * This function unregisters the observer in the observee and vice versa.
*/ */
void e_observer_unregister_observee(E_Observer *observer, E_Observee *observee); void e_observer_unregister_observee(E_Observer * observer,
E_Observee * observee);
/** /**
* e_observee_init - Initializes an observee. * e_observee_init - Initializes an observee.
@ -111,7 +115,8 @@ void e_observer_unregister_observee(E_Observer *observer, E_Observee *observe
* from E_Objects, which is why this function gets the destructor * from E_Objects, which is why this function gets the destructor
* function as a parameter. It is passed on to e_object_init(). * function as a parameter. It is passed on to e_object_init().
*/ */
void e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func); void e_observee_init(E_Observee * obs,
E_Cleanup_Func cleanup_func);
/** /**
* e_observee_cleanup - Cleans up an observee. * e_observee_cleanup - Cleans up an observee.
@ -119,7 +124,7 @@ void e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func);
* *
* This function cleans up an observee by unregistering it from all observers. * This function cleans up an observee by unregistering it from all observers.
*/ */
void e_observee_cleanup(E_Observee *obs); void e_observee_cleanup(E_Observee * obs);
/** /**
* e_observee_notify_observers - Notify observers of a given Ecore event * e_observee_notify_observers - Notify observers of a given Ecore event
@ -130,8 +135,8 @@ void e_observee_cleanup(E_Observee *obs);
* and calls the notify_func() of the observers that are * and calls the notify_func() of the observers that are
* responsible for the given @event. * responsible for the given @event.
*/ */
void e_observee_notify_observers(E_Observee *o, E_Event_Type event); void e_observee_notify_observers(E_Observee * o,
E_Event_Type event);
/** /**
* e_observee_notify_all_observers - Notify all observers of a given E event * e_observee_notify_all_observers - Notify all observers of a given E event
@ -147,5 +152,6 @@ void e_observee_notify_observers(E_Observee *o, E_Event_Type event);
* If they are looking for this type of NEW event, then they can register * If they are looking for this type of NEW event, then they can register
* it as a legitimate observee. * it as a legitimate observee.
*/ */
void e_observee_notify_all_observers(E_Observee *o, E_Event_Type event); void e_observee_notify_all_observers(E_Observee * o,
E_Event_Type event);
#endif #endif

View File

@ -20,7 +20,8 @@ e_mouse_down(Ecore_Event * ev)
D_ENTER; D_ENTER;
e = ev->event; e = ev->event;
if (!win_place) D_RETURN; if (!win_place)
D_RETURN;
D_RETURN; D_RETURN;
} }
@ -33,9 +34,11 @@ e_mouse_up(Ecore_Event * ev)
D_ENTER; D_ENTER;
e = ev->event; e = ev->event;
if (!win_place) D_RETURN; if (!win_place)
D_RETURN;
e_action_stop("Window_Place", ACT_MOUSE_UP, 1, NULL, e_action_stop("Window_Place", ACT_MOUSE_UP, 1, NULL,
ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx, e->ry); ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx,
e->ry);
ecore_window_destroy(win_place); ecore_window_destroy(win_place);
win_place = 0; win_place = 0;
@ -50,10 +53,11 @@ e_mouse_move(Ecore_Event * ev)
D_ENTER; D_ENTER;
e = ev->event; e = ev->event;
if (!win_place) D_RETURN; if (!win_place)
D_RETURN;
e_action_cont("Window_Place", ACT_MOUSE_MOVE, 1, NULL, e_action_cont("Window_Place", ACT_MOUSE_MOVE, 1, NULL,
ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx, e->ry, ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx,
e->rx - prx, e->ry - pry); e->ry, e->rx - prx, e->ry - pry);
prx = e->rx; prx = e->rx;
pry = e->ry; pry = e->ry;
@ -61,12 +65,14 @@ e_mouse_move(Ecore_Event * ev)
} }
static int static int
e_place_manual(E_Border *b, E_Desktop *desk, int *x, int *y) e_place_manual(E_Border * b, E_Desktop * desk, int *x, int *y)
{ {
int w, h; int w, h;
int mx, my, rx, ry; int mx, my, rx, ry;
int move_mode = E_GUIDES_BOX; int move_mode = E_GUIDES_BOX;
E_CFG_INT(cfg_window_move_mode, "settings", "/window/move/mode", E_GUIDES_BOX);
E_CFG_INT(cfg_window_move_mode, "settings", "/window/move/mode",
E_GUIDES_BOX);
D_ENTER; D_ENTER;
@ -102,14 +108,16 @@ e_place_manual(E_Border *b, E_Desktop *desk, int *x, int *y)
/* start a move mode */ /* start a move mode */
e_action_stop_by_type("Window_Place"); e_action_stop_by_type("Window_Place");
e_action_start("Window_Place", ACT_MOUSE_CLICK, 1, NULL, e_action_start("Window_Place", ACT_MOUSE_CLICK, 1, NULL,
ECORE_EVENT_KEY_MODIFIER_NONE, E_OBJECT(b), NULL, mx, my, rx, ry); ECORE_EVENT_KEY_MODIFIER_NONE, E_OBJECT(b), NULL, mx, my, rx,
ry);
if (move_mode != E_GUIDES_OPAQUE) D_RETURN_(0); if (move_mode != E_GUIDES_OPAQUE)
D_RETURN_(0);
D_RETURN_(1); D_RETURN_(1);
} }
static int static int
e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y) e_place_smart(E_Border * b, E_Desktop * desk, int *x, int *y)
{ {
int w, h; int w, h;
int a_w = 0, a_h = 0; int a_w = 0, a_h = 0;
@ -149,18 +157,21 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
if (bd->current.x > 0) if (bd->current.x > 0)
{ {
if (a_x[i] == bd->current.x) ok = 0; if (a_x[i] == bd->current.x)
ok = 0;
else if (a_x[i] > bd->current.x) else if (a_x[i] > bd->current.x)
{ {
a_w++; a_w++;
REALLOC(a_x, int, a_w); REALLOC(a_x, int, a_w);
for (j = a_w - 1; j > i; j--) for (j = a_w - 1; j > i; j--)
a_x[j] = a_x[j - 1]; a_x[j] = a_x[j - 1];
a_x[i] = bd->current.x; a_x[i] = bd->current.x;
ok = 0; ok = 0;
} }
} }
if (!ok) break; if (!ok)
break;
} }
for (i = 0; i < a_w; i++) for (i = 0; i < a_w; i++)
{ {
@ -168,18 +179,21 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
if (bd->current.x + bd->current.w < desk->real.w) if (bd->current.x + bd->current.w < desk->real.w)
{ {
if (a_x[i] == bd->current.x + bd->current.w) ok = 0; if (a_x[i] == bd->current.x + bd->current.w)
ok = 0;
else if (a_x[i] > bd->current.x + bd->current.w) else if (a_x[i] > bd->current.x + bd->current.w)
{ {
a_w++; a_w++;
REALLOC(a_x, int, a_w); REALLOC(a_x, int, a_w);
for (j = a_w - 1; j > i; j--) for (j = a_w - 1; j > i; j--)
a_x[j] = a_x[j - 1]; a_x[j] = a_x[j - 1];
a_x[i] = bd->current.x + bd->current.w; a_x[i] = bd->current.x + bd->current.w;
ok = 0; ok = 0;
} }
} }
if (!ok) break; if (!ok)
break;
} }
for (i = 0; i < a_h; i++) for (i = 0; i < a_h; i++)
{ {
@ -187,18 +201,21 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
if (bd->current.y > 0) if (bd->current.y > 0)
{ {
if (a_y[i] == bd->current.y) ok = 0; if (a_y[i] == bd->current.y)
ok = 0;
else if (a_y[i] > bd->current.y) else if (a_y[i] > bd->current.y)
{ {
a_h++; a_h++;
REALLOC(a_y, int, a_h); REALLOC(a_y, int, a_h);
for (j = a_h - 1; j > i; j--) for (j = a_h - 1; j > i; j--)
a_y[j] = a_y[j - 1]; a_y[j] = a_y[j - 1];
a_y[i] = bd->current.y; a_y[i] = bd->current.y;
ok = 0; ok = 0;
} }
} }
if (!ok) break; if (!ok)
break;
} }
for (i = 0; i < a_h; i++) for (i = 0; i < a_h; i++)
{ {
@ -206,18 +223,21 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
if (bd->current.y + bd->current.h < desk->real.h) if (bd->current.y + bd->current.h < desk->real.h)
{ {
if (a_y[i] == bd->current.y + bd->current.h) ok = 0; if (a_y[i] == bd->current.y + bd->current.h)
ok = 0;
else if (a_y[i] > bd->current.y + bd->current.h) else if (a_y[i] > bd->current.y + bd->current.h)
{ {
a_h++; a_h++;
REALLOC(a_y, int, a_h); REALLOC(a_y, int, a_h);
for (j = a_h - 1; j > i; j--) for (j = a_h - 1; j > i; j--)
a_y[j] = a_y[j - 1]; a_y[j] = a_y[j - 1];
a_y[i] = bd->current.y + bd->current.h; a_y[i] = bd->current.y + bd->current.h;
ok = 0; ok = 0;
} }
} }
if (!ok) break; if (!ok)
break;
} }
} }
} }
@ -256,14 +276,18 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
int x0, x00, y0, y00; int x0, x00, y0, y00;
x0 = x1; x0 = x1;
if (x1 < x2) x0 = x2; if (x1 < x2)
x0 = x2;
x00 = (x1 + w1); x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2); if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1; y0 = y1;
if (y1 < y2) y0 = y2; if (y1 < y2)
y0 = y2;
y00 = (y1 + h1); y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2); if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0; iw = x00 - x0;
ih = y00 - y0; ih = y00 - y0;
@ -275,11 +299,11 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar; area = ar;
*x = a_x[i]; *x = a_x[i];
*y = a_y[j]; *y = a_y[j];
if (ar == 0) goto done; if (ar == 0)
goto done;
} }
} }
if ((a_x[i + 1] - w > 0) && if ((a_x[i + 1] - w > 0) && (a_y[j] < (desk->real.h - h)))
(a_y[j] < (desk->real.h - h)))
{ {
int ar = 0; int ar = 0;
@ -304,14 +328,18 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
int x0, x00, y0, y00; int x0, x00, y0, y00;
x0 = x1; x0 = x1;
if (x1 < x2) x0 = x2; if (x1 < x2)
x0 = x2;
x00 = (x1 + w1); x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2); if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1; y0 = y1;
if (y1 < y2) y0 = y2; if (y1 < y2)
y0 = y2;
y00 = (y1 + h1); y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2); if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0; iw = x00 - x0;
ih = y00 - y0; ih = y00 - y0;
@ -323,11 +351,11 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar; area = ar;
*x = a_x[i + 1] - w; *x = a_x[i + 1] - w;
*y = a_y[j]; *y = a_y[j];
if (ar == 0) goto done; if (ar == 0)
goto done;
} }
} }
if ((a_x[i + 1] - w > 0) && if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 0))
(a_y[j + 1] - h > 0))
{ {
int ar = 0; int ar = 0;
@ -352,14 +380,18 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
int x0, x00, y0, y00; int x0, x00, y0, y00;
x0 = x1; x0 = x1;
if (x1 < x2) x0 = x2; if (x1 < x2)
x0 = x2;
x00 = (x1 + w1); x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2); if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1; y0 = y1;
if (y1 < y2) y0 = y2; if (y1 < y2)
y0 = y2;
y00 = (y1 + h1); y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2); if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0; iw = x00 - x0;
ih = y00 - y0; ih = y00 - y0;
@ -371,11 +403,11 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar; area = ar;
*x = a_x[i + 1] - w; *x = a_x[i + 1] - w;
*y = a_y[j + 1] - h; *y = a_y[j + 1] - h;
if (ar == 0) goto done; if (ar == 0)
goto done;
} }
} }
if ((a_x[i] < (desk->real.w - w)) && if ((a_x[i] < (desk->real.w - w)) && (a_y[j + 1] - h > 0))
(a_y[j + 1] - h > 0))
{ {
int ar = 0; int ar = 0;
@ -400,14 +432,18 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
int x0, x00, y0, y00; int x0, x00, y0, y00;
x0 = x1; x0 = x1;
if (x1 < x2) x0 = x2; if (x1 < x2)
x0 = x2;
x00 = (x1 + w1); x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2); if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1; y0 = y1;
if (y1 < y2) y0 = y2; if (y1 < y2)
y0 = y2;
y00 = (y1 + h1); y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2); if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0; iw = x00 - x0;
ih = y00 - y0; ih = y00 - y0;
@ -419,7 +455,8 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar; area = ar;
*x = a_x[i]; *x = a_x[i];
*y = a_y[j + 1] - h; *y = a_y[j + 1] - h;
if (ar == 0) goto done; if (ar == 0)
goto done;
} }
} }
} }
@ -433,7 +470,7 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
} }
static int static int
e_place_middle(E_Border *b, E_Desktop *desk, int *x, int *y) e_place_middle(E_Border * b, E_Desktop * desk, int *x, int *y)
{ {
int w, h; int w, h;
@ -448,7 +485,7 @@ e_place_middle(E_Border *b, E_Desktop *desk, int *x, int *y)
} }
static int static int
e_place_cascade(E_Border *b, E_Desktop *desk, int *x, int *y) e_place_cascade(E_Border * b, E_Desktop * desk, int *x, int *y)
{ {
int w, h; int w, h;
static int count_x = 0; static int count_x = 0;
@ -458,11 +495,14 @@ e_place_cascade(E_Border *b, E_Desktop *desk, int *x, int *y)
D_ENTER; D_ENTER;
pl = pr = pt = pb = 0; pl = pr = pt = pb = 0;
if (b->bits.l) ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb); if (b->bits.l)
ebits_get_insets(b->bits.l, &pl, &pr, &pt, &pb);
w = b->current.requested.w; w = b->current.requested.w;
h = b->current.requested.h; h = b->current.requested.h;
if ((count_x + w) > desk->real.w) count_x = 0; if ((count_x + w) > desk->real.w)
if ((count_y + h) > desk->real.h) count_y = 0; count_x = 0;
if ((count_y + h) > desk->real.h)
count_y = 0;
*x = count_x; *x = count_x;
*y = count_y; *y = count_y;
count_x += pl; count_x += pl;
@ -472,7 +512,7 @@ e_place_cascade(E_Border *b, E_Desktop *desk, int *x, int *y)
} }
static int static int
e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y) e_place_random(E_Border * b, E_Desktop * desk, int *x, int *y)
{ {
int w, h; int w, h;
@ -495,7 +535,8 @@ e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y)
} }
int int
e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode) e_place_border(E_Border * b, E_Desktop * desk, int *x, int *y,
E_Placement_Mode mode)
{ {
int result = 1; int result = 1;
@ -507,19 +548,19 @@ e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mo
switch (mode) switch (mode)
{ {
case E_PLACE_MANUAL: case E_PLACE_MANUAL:
result = e_place_manual (b, desk, x, y); result = e_place_manual(b, desk, x, y);
break; break;
case E_PLACE_SMART: case E_PLACE_SMART:
result = e_place_smart (b, desk, x, y); result = e_place_smart(b, desk, x, y);
break; break;
case E_PLACE_MIDDLE: case E_PLACE_MIDDLE:
result = e_place_middle (b, desk, x, y); result = e_place_middle(b, desk, x, y);
break; break;
case E_PLACE_CASCADE: case E_PLACE_CASCADE:
result = e_place_cascade(b, desk, x, y); result = e_place_cascade(b, desk, x, y);
break; break;
case E_PLACE_RANDOM: case E_PLACE_RANDOM:
result = e_place_random (b, desk, x, y); result = e_place_random(b, desk, x, y);
break; break;
default: default:
break; break;

View File

@ -35,7 +35,7 @@ void e_place_init(void);
* and returns them in the @x and @y pointers. It does not actually * and returns them in the @x and @y pointers. It does not actually
* place the window. * place the window.
*/ */
int e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode); int e_place_border(E_Border * b, E_Desktop * desk, int *x,
int *y, E_Placement_Mode mode);
#endif #endif

View File

@ -5,21 +5,22 @@
#include "util.h" #include "util.h"
void void
e_resist_border(E_Border *b) e_resist_border(E_Border * b)
{ {
int resist = 1; int resist = 1;
int desk_resist = 32; int desk_resist = 32;
int win_resist = 12; int win_resist = 12;
/* int ok = 0; */ /* int ok = 0; */
int dx, dy, d; int dx, dy, d;
int resist_x = 0, resist_y = 0; int resist_x = 0, resist_y = 0;
Evas_List l, rects = NULL; Evas_List l, rects = NULL;
E_Rect *r; E_Rect *r;
E_CFG_INT(cfg_resist, "settings", "/move/resist", 1); E_CFG_INT(cfg_resist, "settings", "/move/resist", 1);
E_CFG_INT(cfg_desk_resist, "settings", "/move/resist/desk", 32); E_CFG_INT(cfg_desk_resist, "settings", "/move/resist/desk", 32);
E_CFG_INT(cfg_win_resist, "settings", "/move/resist/win", 12); E_CFG_INT(cfg_win_resist, "settings", "/move/resist/win", 12);
D_ENTER; D_ENTER;
E_CONFIG_INT_GET(cfg_resist, resist); E_CONFIG_INT_GET(cfg_resist, resist);
@ -31,7 +32,8 @@ e_resist_border(E_Border *b)
b->current.y = b->current.requested.y; b->current.y = b->current.requested.y;
D_RETURN; D_RETURN;
} }
if (!b->desk) D_RETURN; if (!b->desk)
D_RETURN;
dx = b->current.requested.x - b->previous.requested.x; dx = b->current.requested.x - b->previous.requested.x;
dy = b->current.requested.y - b->previous.requested.y; dy = b->current.requested.y - b->previous.requested.y;
/* edges of screen */ /* edges of screen */
@ -41,16 +43,21 @@ r = NEW(E_Rect, 1); \
r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \ r->x = _x; r->y = _y; r->w = _w; r->h = _h; r->v1 = _resist; \
rects = evas_list_append(rects, r); \ rects = evas_list_append(rects, r); \
} }
OBSTACLE(-1000000, -1000000, 2000000 + b->desk->real.w, 1000000, desk_resist); OBSTACLE(-1000000, -1000000, 2000000 + b->desk->real.w, 1000000,
OBSTACLE(-1000000, -1000000, 1000000, 2000000 + b->desk->real.h, desk_resist); desk_resist);
OBSTACLE(-1000000, b->desk->real.h, 2000000 + b->desk->real.w, 1000000, desk_resist); OBSTACLE(-1000000, -1000000, 1000000, 2000000 + b->desk->real.h,
OBSTACLE(b->desk->real.w, -1000000, 1000000, 2000000 + b->desk->real.h, desk_resist); desk_resist);
OBSTACLE(-1000000, b->desk->real.h, 2000000 + b->desk->real.w, 1000000,
desk_resist);
OBSTACLE(b->desk->real.w, -1000000, 1000000, 2000000 + b->desk->real.h,
desk_resist);
/* can add code here to add more fake obstacles with custom resist values */ /* can add code here to add more fake obstacles with custom resist values */
/* here if need be - ie xinerama middle between screens and panels etc. */ /* here if need be - ie xinerama middle between screens and panels etc. */
{ {
if (b->desk->view->iconbar) if (b->desk->view->iconbar)
evas_list_append(rects, e_iconbar_get_resist_rect(b->desk->view->iconbar)); evas_list_append(rects,
e_iconbar_get_resist_rect(b->desk->view->iconbar));
} }
for (l = b->desk->windows; l; l = l->next) for (l = b->desk->windows; l; l = l->next)
@ -63,6 +70,7 @@ rects = evas_list_append(rects, r); \
if (bd != b) if (bd != b)
{ {
r = NEW(struct _E_Rect, 1); r = NEW(struct _E_Rect, 1);
r->x = bd->current.x; r->x = bd->current.x;
r->y = bd->current.y; r->y = bd->current.y;
r->w = bd->current.w; r->w = bd->current.w;
@ -81,18 +89,20 @@ rects = evas_list_append(rects, r); \
{ {
/* moving right - check left edge of windows against right */ /* moving right - check left edge of windows against right */
d = r->x - (b->current.requested.x + b->current.w); d = r->x - (b->current.requested.x + b->current.w);
if ((d < 0) && (d >= - r->v1)) if ((d < 0) && (d >= -r->v1))
{ {
if (resist_x > d) resist_x = d; if (resist_x > d)
resist_x = d;
} }
} }
else if (dx < 0) else if (dx < 0)
{ {
/* moving left - check right edge of windows against left */ /* moving left - check right edge of windows against left */
d = b->current.requested.x - (r->x + r->w); d = b->current.requested.x - (r->x + r->w);
if ((d < 0) && (d >= - r->v1)) if ((d < 0) && (d >= -r->v1))
{ {
if (resist_x > d) resist_x = -d; if (resist_x > d)
resist_x = -d;
} }
} }
} }
@ -102,18 +112,20 @@ rects = evas_list_append(rects, r); \
{ {
/* moving down - check top edge of windows against bottom */ /* moving down - check top edge of windows against bottom */
d = r->y - (b->current.requested.y + b->current.h); d = r->y - (b->current.requested.y + b->current.h);
if ((d < 0) && (d >=2 - r->v1)) if ((d < 0) && (d >= 2 - r->v1))
{ {
if (resist_y > d) resist_y = d; if (resist_y > d)
resist_y = d;
} }
} }
else if (dy < 0) else if (dy < 0)
{ {
/* moving up - check bottom edge of windows against top */ /* moving up - check bottom edge of windows against top */
d = b->current.requested.y - (r->y + r->h); d = b->current.requested.y - (r->y + r->h);
if ((d < 0) && (d >= - r->v1)) if ((d < 0) && (d >= -r->v1))
{ {
if (resist_y > d) resist_y = -d; if (resist_y > d)
resist_y = -d;
} }
} }
} }
@ -129,8 +141,9 @@ rects = evas_list_append(rects, r); \
if (dx != 0) if (dx != 0)
{ {
if ((b->previous.requested.x != b->previous.x) && if ((b->previous.requested.x != b->previous.x) &&
(((b->previous.requested.dx < 0) && (b->current.requested.dx > 0)) || (((b->previous.requested.dx < 0) && (b->current.requested.dx > 0))
((b->previous.requested.dx > 0) && (b->current.requested.dx < 0)))) || ((b->previous.requested.dx > 0)
&& (b->current.requested.dx < 0))))
b->current.requested.x = b->current.x; b->current.requested.x = b->current.x;
else else
b->current.x = b->current.requested.x + resist_x; b->current.x = b->current.requested.x + resist_x;
@ -138,8 +151,9 @@ rects = evas_list_append(rects, r); \
if (dy != 0) if (dy != 0)
{ {
if ((b->previous.requested.y != b->previous.y) && if ((b->previous.requested.y != b->previous.y) &&
(((b->previous.requested.dy < 0) && (b->current.requested.dy > 0)) || (((b->previous.requested.dy < 0) && (b->current.requested.dy > 0))
((b->previous.requested.dy > 0) && (b->current.requested.dy < 0)))) || ((b->previous.requested.dy > 0)
&& (b->current.requested.dy < 0))))
b->current.requested.y = b->current.y; b->current.requested.y = b->current.y;
else else
b->current.y = b->current.requested.y + resist_y; b->current.y = b->current.requested.y + resist_y;

View File

@ -12,6 +12,6 @@ struct _E_Rect
int v1, v2, v3, v4; int v1, v2, v3, v4;
}; };
void e_resist_border(E_Border *b); void e_resist_border(E_Border * b);
#endif #endif

View File

@ -3,19 +3,28 @@
#include "config.h" #include "config.h"
#include "util.h" #include "util.h"
static void e_scrollbar_recalc(E_Scrollbar *sb); static void e_scrollbar_recalc(E_Scrollbar * sb);
static void e_scrollbar_setup_bits(E_Scrollbar *sb); static void e_scrollbar_setup_bits(E_Scrollbar * sb);
static void e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); static void e_sb_base_down_cb(void *data, Ebits_Object o, char *class,
static void e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); int bt, int x, int y, int ox, int oy,
static void e_sb_bar_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); int ow, int oh);
static void e_sb_bar_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); static void e_sb_base_up_cb(void *data, Ebits_Object o, char *class,
static void e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh); int bt, int x, int y, int ox, int oy,
int ow, int oh);
static void e_sb_bar_down_cb(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy,
int ow, int oh);
static void e_sb_bar_up_cb(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy, int ow,
int oh);
static void e_sb_bar_move_cb(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy,
int ow, int oh);
static void e_sb_scroll_timer(int val, void *data); static void e_sb_scroll_timer(int val, void *data);
static void e_scrollbar_cleanup(E_Scrollbar *sb); static void e_scrollbar_cleanup(E_Scrollbar * sb);
static void static void
e_scrollbar_recalc(E_Scrollbar *sb) e_scrollbar_recalc(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
@ -23,8 +32,7 @@ e_scrollbar_recalc(E_Scrollbar *sb)
{ {
double x, y, w, h; double x, y, w, h;
ebits_get_named_bit_geometry(sb->base, "Trough_Area", ebits_get_named_bit_geometry(sb->base, "Trough_Area", &x, &y, &w, &h);
&x, &y, &w, &h);
sb->bar_area.x = x + sb->x; sb->bar_area.x = x + sb->x;
sb->bar_area.y = y + sb->y; sb->bar_area.y = y + sb->y;
sb->bar_area.w = w; sb->bar_area.w = w;
@ -63,7 +71,7 @@ e_scrollbar_recalc(E_Scrollbar *sb)
} }
static void static void
e_scrollbar_setup_bits(E_Scrollbar *sb) e_scrollbar_setup_bits(E_Scrollbar * sb)
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
@ -71,16 +79,20 @@ e_scrollbar_setup_bits(E_Scrollbar *sb)
if (sb->direction == 1) if (sb->direction == 1)
{ {
snprintf(buf, PATH_MAX, "%s/scroll_base_v.bits.db", e_config_get("scrollbars")); snprintf(buf, PATH_MAX, "%s/scroll_base_v.bits.db",
e_config_get("scrollbars"));
sb->base = ebits_load(buf); sb->base = ebits_load(buf);
snprintf(buf, PATH_MAX, "%s/scroll_bar_v.bits.db", e_config_get("scrollbars")); snprintf(buf, PATH_MAX, "%s/scroll_bar_v.bits.db",
e_config_get("scrollbars"));
sb->bar = ebits_load(buf); sb->bar = ebits_load(buf);
} }
else else
{ {
snprintf(buf, PATH_MAX, "%s/scroll_base_h.bits.db", e_config_get("scrollbars")); snprintf(buf, PATH_MAX, "%s/scroll_base_h.bits.db",
e_config_get("scrollbars"));
sb->base = ebits_load(buf); sb->base = ebits_load(buf);
snprintf(buf, PATH_MAX, "%s/scroll_bar_h.bits.db", e_config_get("scrollbars")); snprintf(buf, PATH_MAX, "%s/scroll_bar_h.bits.db",
e_config_get("scrollbars"));
sb->bar = ebits_load(buf); sb->bar = ebits_load(buf);
} }
if (sb->base) if (sb->base)
@ -92,26 +104,41 @@ e_scrollbar_setup_bits(E_Scrollbar *sb)
sb->w = w; sb->w = w;
sb->h = h; sb->h = h;
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Trough", CALLBACK_MOUSE_DOWN, e_sb_base_down_cb, sb); ebits_set_classed_bit_callback(sb->base, "Scrollbar_Trough",
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Trough", CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb); CALLBACK_MOUSE_DOWN, e_sb_base_down_cb,
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow1", CALLBACK_MOUSE_DOWN, e_sb_base_down_cb, sb); sb);
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow1", CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb); ebits_set_classed_bit_callback(sb->base, "Scrollbar_Trough",
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow2", CALLBACK_MOUSE_DOWN, e_sb_base_down_cb, sb); CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb);
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow2", CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb); ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow1",
CALLBACK_MOUSE_DOWN, e_sb_base_down_cb,
sb);
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow1",
CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb);
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow2",
CALLBACK_MOUSE_DOWN, e_sb_base_down_cb,
sb);
ebits_set_classed_bit_callback(sb->base, "Scrollbar_Arrow2",
CALLBACK_MOUSE_UP, e_sb_base_up_cb, sb);
} }
if (sb->bar) if (sb->bar)
{ {
ebits_add_to_evas(sb->bar, sb->evas); ebits_add_to_evas(sb->bar, sb->evas);
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar", CALLBACK_MOUSE_DOWN, e_sb_bar_down_cb, sb); ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar",
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar", CALLBACK_MOUSE_UP, e_sb_bar_up_cb, sb); CALLBACK_MOUSE_DOWN, e_sb_bar_down_cb,
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar", CALLBACK_MOUSE_MOVE, e_sb_bar_move_cb, sb); sb);
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar",
CALLBACK_MOUSE_UP, e_sb_bar_up_cb, sb);
ebits_set_classed_bit_callback(sb->bar, "Scrollbar_Bar",
CALLBACK_MOUSE_MOVE, e_sb_bar_move_cb,
sb);
} }
D_RETURN; D_RETURN;
} }
static void static void
e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh) e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
int ox, int oy, int ow, int oh)
{ {
E_Scrollbar *sb; E_Scrollbar *sb;
double prev; double prev;
@ -121,16 +148,20 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
D_ENTER; D_ENTER;
sb = data; sb = data;
if (sb->mouse_down) D_RETURN; if (sb->mouse_down)
D_RETURN;
sb->mouse_down = bt; sb->mouse_down = bt;
if (!class) D_RETURN; if (!class)
D_RETURN;
prev = sb->val; prev = sb->val;
D ( "x %d y %d bt %d\n" , x , y , bt ); D("x %d y %d bt %d\n", x, y, bt);
D ( "val %f range %f max %f\n" , sb->val , sb->range , sb->max ); D("val %f range %f max %f\n", sb->val, sb->range, sb->max);
D ( "sb x %f y %f w %f h %f\n" , sb->x, sb->y, sb->w, sb->h ); D("sb x %f y %f w %f h %f\n", sb->x, sb->y, sb->w, sb->h);
D ( "sb area x %f y %f w %f h %f\n" , sb->bar_area.x, sb->bar_area.y, sb->bar_area.w, sb->bar_area.h ); D("sb area x %f y %f w %f h %f\n", sb->bar_area.x, sb->bar_area.y,
D ( "sb pos x %f y %f w %f h %f\n" , sb->bar_pos.x, sb->bar_pos.y, sb->bar_pos.w, sb->bar_pos.h ); sb->bar_area.w, sb->bar_area.h);
D("sb pos x %f y %f w %f h %f\n", sb->bar_pos.x, sb->bar_pos.y,
sb->bar_pos.w, sb->bar_pos.h);
if (!strcmp(class, "Scrollbar_Arrow1")) if (!strcmp(class, "Scrollbar_Arrow1"))
{ {
@ -152,9 +183,9 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
else if (!strcmp(class, "Scrollbar_Trough")) else if (!strcmp(class, "Scrollbar_Trough"))
{ {
if ( bt == 1 ) if (bt == 1)
{ {
if ( sb->direction ) /* vertical */ if (sb->direction) /* vertical */
{ {
sb->scroll_step = sb->bar_area.h; sb->scroll_step = sb->bar_area.h;
inc = y - sb->bar_pos.y; inc = y - sb->bar_pos.y;
@ -165,44 +196,58 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
inc = x - sb->bar_pos.x; inc = x - sb->bar_pos.x;
} }
if ( inc < 0 ) /* scroll up (or left) */ if (inc < 0) /* scroll up (or left) */
{ {
sb->scroll_step = -sb->scroll_step; sb->scroll_step = -sb->scroll_step;
snprintf ( name , PATH_MAX , "scroll_up.%i.%s" , sb->direction , sb->dir ); snprintf(name, PATH_MAX, "scroll_up.%i.%s", sb->direction,
sb->dir);
} }
else /* scroll down (or right) */ else /* scroll down (or right) */
{ {
snprintf ( name , PATH_MAX , "scroll_down.%i.%s" , sb->direction , sb->dir ); snprintf(name, PATH_MAX, "scroll_down.%i.%s", sb->direction,
sb->dir);
} }
/* scroll once in the chosen direction */ /* scroll once in the chosen direction */
sb->val += sb->scroll_step; sb->val += sb->scroll_step;
if (sb->val < 0) sb->val = 0; if (sb->val < 0)
if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range; sb->val = 0;
if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
/* set a timer to keep on scrolling */ /* set a timer to keep on scrolling */
sb->scroll_speed = 0.1; sb->scroll_speed = 0.1;
ecore_add_event_timer ( name , sb->scroll_speed , e_sb_scroll_timer , 0 , sb ); ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0,
sb);
} }
else else
{ {
if (sb->direction) if (sb->direction)
sb->val = ( y - sb->bar_area.y) * sb->max / sb->bar_area.h - sb->bar_area.h / 2; sb->val =
(y - sb->bar_area.y) * sb->max / sb->bar_area.h -
sb->bar_area.h / 2;
else else
sb->val = ( x - sb->bar_area.x) * sb->max / sb->bar_area.w - sb->bar_area.w / 2; sb->val =
(x - sb->bar_area.x) * sb->max / sb->bar_area.w -
sb->bar_area.w / 2;
if (sb->val < 0) sb->val = 0; if (sb->val < 0)
if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range; sb->val = 0;
if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
} }
} }
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (prev != sb->val) if (prev != sb->val)
{ {
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val); if (sb->func_change)
sb->func_change(sb->func_data, sb, sb->val);
} }
D_RETURN; D_RETURN;
@ -214,7 +259,8 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
} }
static void static void
e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh) e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
int ox, int oy, int ow, int oh)
{ {
E_Scrollbar *sb; E_Scrollbar *sb;
char name[PATH_MAX]; char name[PATH_MAX];
@ -222,9 +268,12 @@ e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
D_ENTER; D_ENTER;
sb = data; sb = data;
if (bt == sb->mouse_down) sb->mouse_down = 0; if (bt == sb->mouse_down)
else D_RETURN; sb->mouse_down = 0;
if (!class) D_RETURN; else
D_RETURN;
if (!class)
D_RETURN;
if (!strcmp(class, "Scrollbar_Arrow1")) if (!strcmp(class, "Scrollbar_Arrow1"))
{ {
@ -244,16 +293,18 @@ e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
else if (!strcmp(class, "Scrollbar_Trough")) else if (!strcmp(class, "Scrollbar_Trough"))
{ {
if ( sb->scroll_step < 0 ) if (sb->scroll_step < 0)
{ {
sb->scroll_step = 0; sb->scroll_step = 0;
snprintf(name, PATH_MAX, "scroll_up.%i.%s", sb->direction, sb->dir); snprintf(name, PATH_MAX, "scroll_up.%i.%s", sb->direction,
sb->dir);
ecore_del_event_timer(name); ecore_del_event_timer(name);
} }
else if ( sb->scroll_step > 0 ) else if (sb->scroll_step > 0)
{ {
sb->scroll_step = 0; sb->scroll_step = 0;
snprintf(name, PATH_MAX, "scroll_down.%i.%s", sb->direction, sb->dir); snprintf(name, PATH_MAX, "scroll_down.%i.%s", sb->direction,
sb->dir);
ecore_del_event_timer(name); ecore_del_event_timer(name);
} }
} }
@ -269,14 +320,16 @@ e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
} }
static void static void
e_sb_bar_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh) e_sb_bar_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
int ox, int oy, int ow, int oh)
{ {
E_Scrollbar *sb; E_Scrollbar *sb;
D_ENTER; D_ENTER;
sb = data; sb = data;
if (sb->mouse_down) D_RETURN; if (sb->mouse_down)
D_RETURN;
sb->mouse_down = bt; sb->mouse_down = bt;
sb->down_x = x; sb->down_x = x;
sb->down_y = y; sb->down_y = y;
@ -295,7 +348,8 @@ e_sb_bar_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
} }
static void static void
e_sb_bar_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh) e_sb_bar_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
int ox, int oy, int ow, int oh)
{ {
E_Scrollbar *sb; E_Scrollbar *sb;
@ -319,7 +373,8 @@ e_sb_bar_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, in
} }
static void static void
e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh) e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
int ox, int oy, int ow, int oh)
{ {
E_Scrollbar *sb; E_Scrollbar *sb;
int dx, dy; int dx, dy;
@ -327,7 +382,8 @@ e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
D_ENTER; D_ENTER;
sb = data; sb = data;
if (!sb->mouse_down) D_RETURN; if (!sb->mouse_down)
D_RETURN;
dx = x - sb->mouse_x; dx = x - sb->mouse_x;
dy = y - sb->mouse_y; dy = y - sb->mouse_y;
sb->mouse_x = x; sb->mouse_x = x;
@ -335,24 +391,31 @@ e_sb_bar_move_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
prev = sb->val; prev = sb->val;
if (sb->direction) if (sb->direction)
{ {
if (sb->bar_area.h > sb->bar_pos.h) sb->val += if (sb->bar_area.h > sb->bar_pos.h)
((double)dy * sb->max) / sb->bar_area.h; sb->val += ((double)dy * sb->max) / sb->bar_area.h;
else sb->val = 0; else
sb->val = 0;
} }
else else
{ {
if (sb->bar_area.w > sb->bar_pos.w) sb->val += if (sb->bar_area.w > sb->bar_pos.w)
((double)dx * sb->max) / sb->bar_area.w; sb->val += ((double)dx * sb->max) / sb->bar_area.w;
else sb->val = 0; else
sb->val = 0;
} }
if (sb->val < 0) sb->val = 0; if (sb->val < 0)
if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range; sb->val = 0;
if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
if (prev != sb->val) if (prev != sb->val)
{ {
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val); if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->func_change)
sb->func_change(sb->func_data, sb, sb->val);
} }
D_RETURN; D_RETURN;
@ -377,35 +440,38 @@ e_sb_scroll_timer(int val, void *data)
sb = data; sb = data;
if ( sb->scroll_step < 0 ) if (sb->scroll_step < 0)
{ {
sb->val += sb->scroll_step; sb->val += sb->scroll_step;
if (sb->val < 0) sb->val = 0; if (sb->val < 0)
sb->val = 0;
snprintf(name, PATH_MAX, "scroll_up.%i.%s", sb->direction, sb->dir); snprintf(name, PATH_MAX, "scroll_up.%i.%s", sb->direction, sb->dir);
ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0, sb); ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0, sb);
} }
else if ( sb->scroll_step > 0 ) else if (sb->scroll_step > 0)
{ {
sb->val += sb->scroll_step; sb->val += sb->scroll_step;
if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range; if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
snprintf(name, PATH_MAX, "scroll_down.%i.%s", sb->direction, sb->dir); snprintf(name, PATH_MAX, "scroll_down.%i.%s", sb->direction, sb->dir);
ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0, sb); ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0, sb);
} }
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val); if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->func_change)
sb->func_change(sb->func_data, sb, sb->val);
D_RETURN; D_RETURN;
UN(val); UN(val);
} }
E_Scrollbar * E_Scrollbar *
e_scrollbar_new(void) e_scrollbar_new(void)
{ {
@ -427,7 +493,7 @@ e_scrollbar_new(void)
} }
static void static void
e_scrollbar_cleanup(E_Scrollbar *sb) e_scrollbar_cleanup(E_Scrollbar * sb)
{ {
char name[PATH_MAX]; char name[PATH_MAX];
@ -435,8 +501,10 @@ e_scrollbar_cleanup(E_Scrollbar *sb)
if (sb->evas) if (sb->evas)
{ {
if (sb->base) ebits_free(sb->base); if (sb->base)
if (sb->bar) ebits_free(sb->bar); ebits_free(sb->base);
if (sb->bar)
ebits_free(sb->bar);
} }
IF_FREE(sb->dir); IF_FREE(sb->dir);
@ -451,30 +519,40 @@ e_scrollbar_cleanup(E_Scrollbar *sb)
} }
void void
e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas) e_scrollbar_add_to_evas(E_Scrollbar * sb, Evas evas)
{ {
D_ENTER; D_ENTER;
if (sb->evas) if (sb->evas)
{ {
if (sb->base) ebits_free(sb->base); if (sb->base)
if (sb->bar) ebits_free(sb->bar); ebits_free(sb->base);
if (sb->bar)
ebits_free(sb->bar);
} }
sb->evas = evas; sb->evas = evas;
if (sb->evas) if (sb->evas)
{ {
e_scrollbar_setup_bits(sb); e_scrollbar_setup_bits(sb);
if (sb->base) ebits_set_layer(sb->base, sb->layer); if (sb->base)
if (sb->bar) ebits_set_layer(sb->bar, sb->layer); ebits_set_layer(sb->base, sb->layer);
if (sb->base) ebits_move(sb->base, sb->x, sb->y); if (sb->bar)
if (sb->base) ebits_resize(sb->base, sb->w, sb->h); ebits_set_layer(sb->bar, sb->layer);
if (sb->base)
ebits_move(sb->base, sb->x, sb->y);
if (sb->base)
ebits_resize(sb->base, sb->w, sb->h);
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->visible) if (sb->visible)
{ {
if (sb->base) ebits_show(sb->base); if (sb->base)
if (sb->bar) ebits_show(sb->bar); ebits_show(sb->base);
if (sb->bar)
ebits_show(sb->bar);
} }
} }
@ -482,79 +560,95 @@ e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas)
} }
void void
e_scrollbar_show(E_Scrollbar *sb) e_scrollbar_show(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
if (sb->visible) D_RETURN; if (sb->visible)
D_RETURN;
sb->visible = 1; sb->visible = 1;
if (sb->base) ebits_show(sb->base); if (sb->base)
if (sb->bar) ebits_show(sb->bar); ebits_show(sb->base);
if (sb->bar)
ebits_show(sb->bar);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_hide(E_Scrollbar *sb) e_scrollbar_hide(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
if (!sb->visible) D_RETURN; if (!sb->visible)
D_RETURN;
sb->visible = 0; sb->visible = 0;
if (sb->base) ebits_hide(sb->base); if (sb->base)
if (sb->bar) ebits_hide(sb->bar); ebits_hide(sb->base);
if (sb->bar)
ebits_hide(sb->bar);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_raise(E_Scrollbar *sb) e_scrollbar_raise(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
if (sb->base) ebits_raise(sb->base); if (sb->base)
if (sb->bar) ebits_raise(sb->bar); ebits_raise(sb->base);
if (sb->bar)
ebits_raise(sb->bar);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_lower(E_Scrollbar *sb) e_scrollbar_lower(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
if (sb->bar) ebits_lower(sb->bar); if (sb->bar)
if (sb->base) ebits_lower(sb->base); ebits_lower(sb->bar);
if (sb->base)
ebits_lower(sb->base);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_set_layer(E_Scrollbar *sb, int l) e_scrollbar_set_layer(E_Scrollbar * sb, int l)
{ {
D_ENTER; D_ENTER;
if (l == sb->layer) D_RETURN; if (l == sb->layer)
D_RETURN;
sb->layer = l; sb->layer = l;
if (sb->base) ebits_set_layer(sb->base, sb->layer); if (sb->base)
if (sb->bar) ebits_set_layer(sb->bar, sb->layer); ebits_set_layer(sb->base, sb->layer);
if (sb->bar)
ebits_set_layer(sb->bar, sb->layer);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_set_direction(E_Scrollbar *sb, int d) e_scrollbar_set_direction(E_Scrollbar * sb, int d)
{ {
D_ENTER; D_ENTER;
if (d == sb->direction) D_RETURN; if (d == sb->direction)
D_RETURN;
sb->direction = d; sb->direction = d;
if (sb->evas) if (sb->evas)
{ {
Evas evas; Evas evas;
if (sb->base) ebits_free(sb->base); if (sb->base)
if (sb->bar) ebits_free(sb->bar); ebits_free(sb->base);
if (sb->bar)
ebits_free(sb->bar);
evas = sb->evas; evas = sb->evas;
sb->evas = NULL; sb->evas = NULL;
e_scrollbar_add_to_evas(sb, evas); e_scrollbar_add_to_evas(sb, evas);
@ -564,40 +658,47 @@ e_scrollbar_set_direction(E_Scrollbar *sb, int d)
} }
void void
e_scrollbar_move(E_Scrollbar *sb, double x, double y) e_scrollbar_move(E_Scrollbar * sb, double x, double y)
{ {
D_ENTER; D_ENTER;
if ((x == sb->x) && (y == sb->y)) D_RETURN; if ((x == sb->x) && (y == sb->y))
D_RETURN;
sb->x = x; sb->x = x;
sb->y = y; sb->y = y;
if (sb->base) ebits_move(sb->base, sb->x, sb->y); if (sb->base)
ebits_move(sb->base, sb->x, sb->y);
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_resize(E_Scrollbar *sb, double w, double h) e_scrollbar_resize(E_Scrollbar * sb, double w, double h)
{ {
D_ENTER; D_ENTER;
if ((w == sb->w) && (h == sb->h)) D_RETURN; if ((w == sb->w) && (h == sb->h))
D_RETURN;
sb->w = w; sb->w = w;
sb->h = h; sb->h = h;
if (sb->base) ebits_resize(sb->base, sb->w, sb->h); if (sb->base)
ebits_resize(sb->base, sb->w, sb->h);
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_set_change_func(E_Scrollbar *sb, e_scrollbar_set_change_func(E_Scrollbar * sb,
void (*func_change) (void *_data, E_Scrollbar *sb, double val), void (*func_change) (void *_data, E_Scrollbar * sb,
void *data) double val), void *data)
{ {
D_ENTER; D_ENTER;
@ -608,52 +709,64 @@ e_scrollbar_set_change_func(E_Scrollbar *sb,
} }
void void
e_scrollbar_set_value(E_Scrollbar *sb, double val) e_scrollbar_set_value(E_Scrollbar * sb, double val)
{ {
D_ENTER; D_ENTER;
if (val > sb->max - sb->range) val = sb->max - sb->range; if (val > sb->max - sb->range)
if (val < 0 ) val = 0; val = sb->max - sb->range;
if (sb->val == val) D_RETURN; if (val < 0)
val = 0;
if (sb->val == val)
D_RETURN;
sb->val = val; sb->val = val;
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->func_change) sb->func_change(sb->func_data, sb, sb->val); if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
if (sb->func_change)
sb->func_change(sb->func_data, sb, sb->val);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_set_range(E_Scrollbar *sb, double range) e_scrollbar_set_range(E_Scrollbar * sb, double range)
{ {
D_ENTER; D_ENTER;
if (sb->range == range) D_RETURN; if (sb->range == range)
D_RETURN;
sb->range = range; sb->range = range;
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
D_RETURN; D_RETURN;
} }
void void
e_scrollbar_set_max(E_Scrollbar *sb, double max) e_scrollbar_set_max(E_Scrollbar * sb, double max)
{ {
D_ENTER; D_ENTER;
if (sb->max == max) D_RETURN; if (sb->max == max)
D_RETURN;
sb->max = max; sb->max = max;
e_scrollbar_recalc(sb); e_scrollbar_recalc(sb);
if (sb->bar) ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y); if (sb->bar)
if (sb->bar) ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h); ebits_move(sb->bar, sb->bar_pos.x, sb->bar_pos.y);
if (sb->bar)
ebits_resize(sb->bar, sb->bar_pos.w, sb->bar_pos.h);
D_RETURN; D_RETURN;
} }
double double
e_scrollbar_get_value(E_Scrollbar *sb) e_scrollbar_get_value(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
@ -661,7 +774,7 @@ e_scrollbar_get_value(E_Scrollbar *sb)
} }
double double
e_scrollbar_get_range(E_Scrollbar *sb) e_scrollbar_get_range(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
@ -669,7 +782,7 @@ e_scrollbar_get_range(E_Scrollbar *sb)
} }
double double
e_scrollbar_get_max(E_Scrollbar *sb) e_scrollbar_get_max(E_Scrollbar * sb)
{ {
D_ENTER; D_ENTER;
@ -677,15 +790,19 @@ e_scrollbar_get_max(E_Scrollbar *sb)
} }
void void
e_scrollbar_get_geometry(E_Scrollbar *sb, double *x, double *y, double *w, double *h) e_scrollbar_get_geometry(E_Scrollbar * sb, double *x, double *y, double *w,
double *h)
{ {
D_ENTER; D_ENTER;
if (x) *x = sb->x; if (x)
if (y) *y = sb->y; *x = sb->x;
if (w) *w = sb->w; if (y)
if (h) *h = sb->h; *y = sb->y;
if (w)
*w = sb->w;
if (h)
*h = sb->h;
D_RETURN; D_RETURN;
} }

View File

@ -31,34 +31,45 @@ struct _E_Scrollbar
int scroll_step; int scroll_step;
double scroll_speed; double scroll_speed;
struct { struct
{
double x, y, w, h; double x, y, w, h;
} bar_area; }
struct { bar_area;
struct
{
double x, y, w, h; double x, y, w, h;
} bar_pos; }
bar_pos;
void (*func_change) (void *_data, E_Scrollbar *sb, double val); void (*func_change) (void *_data, E_Scrollbar * sb,
double val);
void *func_data; void *func_data;
}; };
E_Scrollbar *e_scrollbar_new(void); E_Scrollbar *e_scrollbar_new(void);
void e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas); void e_scrollbar_add_to_evas(E_Scrollbar * sb, Evas evas);
void e_scrollbar_show(E_Scrollbar *sb); void e_scrollbar_show(E_Scrollbar * sb);
void e_scrollbar_hide(E_Scrollbar *sb); void e_scrollbar_hide(E_Scrollbar * sb);
void e_scrollbar_raise(E_Scrollbar *sb); void e_scrollbar_raise(E_Scrollbar * sb);
void e_scrollbar_lower(E_Scrollbar *sb); void e_scrollbar_lower(E_Scrollbar * sb);
void e_scrollbar_set_layer(E_Scrollbar *sb, int l); void e_scrollbar_set_layer(E_Scrollbar * sb, int l);
void e_scrollbar_set_direction(E_Scrollbar *sb, int d); void e_scrollbar_set_direction(E_Scrollbar * sb, int d);
void e_scrollbar_move(E_Scrollbar *sb, double x, double y); void e_scrollbar_move(E_Scrollbar * sb, double x, double y);
void e_scrollbar_resize(E_Scrollbar *sb, double w, double h); void e_scrollbar_resize(E_Scrollbar * sb, double w, double h);
void e_scrollbar_set_change_func(E_Scrollbar *sb, void e_scrollbar_set_change_func(E_Scrollbar * sb,
void (*func_change) (void *_data, E_Scrollbar *sb, double val), void (*func_change) (void
*_data,
E_Scrollbar
* sb,
double
val),
void *data); void *data);
void e_scrollbar_set_value(E_Scrollbar *sb, double val); void e_scrollbar_set_value(E_Scrollbar * sb, double val);
void e_scrollbar_set_range(E_Scrollbar *sb, double range); void e_scrollbar_set_range(E_Scrollbar * sb, double range);
void e_scrollbar_set_max(E_Scrollbar *sb, double max); void e_scrollbar_set_max(E_Scrollbar * sb, double max);
double e_scrollbar_get_value(E_Scrollbar *sb); double e_scrollbar_get_value(E_Scrollbar * sb);
double e_scrollbar_get_range(E_Scrollbar *sb); double e_scrollbar_get_range(E_Scrollbar * sb);
double e_scrollbar_get_max(E_Scrollbar *sb); double e_scrollbar_get_max(E_Scrollbar * sb);
void e_scrollbar_get_geometry(E_Scrollbar *sb, double *x, double *y, double *w, double *h); void e_scrollbar_get_geometry(E_Scrollbar * sb, double *x,
double *y, double *w, double *h);

View File

@ -12,10 +12,14 @@ e_text_new(Evas evas, char *text, char *class)
t = NEW(E_Text, 1); t = NEW(E_Text, 1);
ZERO(t, E_Text, 1); ZERO(t, E_Text, 1);
t->state = strdup("normal"); t->state = strdup("normal");
if (class) t->class = strdup(class); if (class)
else t->class = strdup(""); t->class = strdup(class);
if (text) t->text = strdup(text); else
else t->text = strdup(""); t->class = strdup("");
if (text)
t->text = strdup(text);
else
t->text = strdup("");
t->evas = evas; t->evas = evas;
t->obj.o1 = evas_add_text(t->evas, "borzoib", 8, t->text); t->obj.o1 = evas_add_text(t->evas, "borzoib", 8, t->text);
t->obj.o2 = evas_add_text(t->evas, "borzoib", 8, t->text); t->obj.o2 = evas_add_text(t->evas, "borzoib", 8, t->text);
@ -52,7 +56,7 @@ e_text_new(Evas evas, char *text, char *class)
} }
void void
e_text_free(E_Text *t) e_text_free(E_Text * t)
{ {
D_ENTER; D_ENTER;
@ -74,12 +78,14 @@ e_text_free(E_Text *t)
} }
void void
e_text_set_text(E_Text *t, char *text) e_text_set_text(E_Text * t, char *text)
{ {
D_ENTER; D_ENTER;
if (!text) text = ""; if (!text)
if (!strcmp(t->text, text)) D_RETURN; text = "";
if (!strcmp(t->text, text))
D_RETURN;
FREE(t->text); FREE(t->text);
t->text = strdup(text); t->text = strdup(text);
evas_set_text(t->evas, t->obj.o1, t->text); evas_set_text(t->evas, t->obj.o1, t->text);
@ -98,11 +104,12 @@ e_text_set_text(E_Text *t, char *text)
} }
void void
e_text_set_layer(E_Text *t, int l) e_text_set_layer(E_Text * t, int l)
{ {
D_ENTER; D_ENTER;
if (t->layer == l) D_RETURN; if (t->layer == l)
D_RETURN;
t->layer = l; t->layer = l;
evas_set_layer(t->evas, t->obj.o1, t->layer); evas_set_layer(t->evas, t->obj.o1, t->layer);
evas_set_layer(t->evas, t->obj.o2, t->layer); evas_set_layer(t->evas, t->obj.o2, t->layer);
@ -114,7 +121,7 @@ e_text_set_layer(E_Text *t, int l)
} }
void void
e_text_set_clip(E_Text *t, Evas_Object clip) e_text_set_clip(E_Text * t, Evas_Object clip)
{ {
D_ENTER; D_ENTER;
@ -128,7 +135,7 @@ e_text_set_clip(E_Text *t, Evas_Object clip)
} }
void void
e_text_unset_clip(E_Text *t) e_text_unset_clip(E_Text * t)
{ {
D_ENTER; D_ENTER;
@ -142,7 +149,7 @@ e_text_unset_clip(E_Text *t)
} }
void void
e_text_raise(E_Text *t) e_text_raise(E_Text * t)
{ {
D_ENTER; D_ENTER;
@ -156,7 +163,7 @@ e_text_raise(E_Text *t)
} }
void void
e_text_lower(E_Text *t) e_text_lower(E_Text * t)
{ {
D_ENTER; D_ENTER;
@ -170,11 +177,12 @@ e_text_lower(E_Text *t)
} }
void void
e_text_show(E_Text *t) e_text_show(E_Text * t)
{ {
D_ENTER; D_ENTER;
if (t->visible) D_RETURN; if (t->visible)
D_RETURN;
t->visible = 1; t->visible = 1;
evas_show(t->evas, t->obj.o1); evas_show(t->evas, t->obj.o1);
evas_show(t->evas, t->obj.o2); evas_show(t->evas, t->obj.o2);
@ -186,11 +194,12 @@ e_text_show(E_Text *t)
} }
void void
e_text_hide(E_Text *t) e_text_hide(E_Text * t)
{ {
D_ENTER; D_ENTER;
if (!t->visible) D_RETURN; if (!t->visible)
D_RETURN;
t->visible = 0; t->visible = 0;
evas_hide(t->evas, t->obj.o1); evas_hide(t->evas, t->obj.o1);
evas_hide(t->evas, t->obj.o2); evas_hide(t->evas, t->obj.o2);
@ -202,29 +211,30 @@ e_text_hide(E_Text *t)
} }
void void
e_text_set_color(E_Text *t, int r, int g, int b, int a) e_text_set_color(E_Text * t, int r, int g, int b, int a)
{ {
D_ENTER; D_ENTER;
if ((r == t->color.r) && if ((r == t->color.r) &&
(g == t->color.g) && (g == t->color.g) && (b == t->color.b) && (a == t->color.a))
(b == t->color.b) && D_RETURN;
(a == t->color.a)) D_RETURN;
t->color.r = r; t->color.r = r;
t->color.g = g; t->color.g = g;
t->color.b = b; t->color.b = b;
t->color.a = a; t->color.a = a;
evas_set_color(t->evas, t->obj.text, t->color.r, t->color.g, t->color.b, t->color.a); evas_set_color(t->evas, t->obj.text, t->color.r, t->color.g, t->color.b,
t->color.a);
D_RETURN; D_RETURN;
} }
void void
e_text_move(E_Text *t, double x, double y) e_text_move(E_Text * t, double x, double y)
{ {
D_ENTER; D_ENTER;
if ((t->x == x) && (t->y == y)) D_RETURN; if ((t->x == x) && (t->y == y))
D_RETURN;
t->x = x; t->x = x;
t->y = y; t->y = y;
evas_move(t->evas, t->obj.o1, t->x + 1, t->y); evas_move(t->evas, t->obj.o1, t->x + 1, t->y);
@ -237,11 +247,10 @@ e_text_move(E_Text *t, double x, double y)
} }
void void
e_text_resize(E_Text *t, double w, double h) e_text_resize(E_Text * t, double w, double h)
{ {
D_ENTER; D_ENTER;
D_RETURN; D_RETURN;
UN(t); UN(t);
UN(w); UN(w);
@ -249,42 +258,50 @@ e_text_resize(E_Text *t, double w, double h)
} }
void void
e_text_get_geometry(E_Text *t, double *x, double *y, double *w, double *h) e_text_get_geometry(E_Text * t, double *x, double *y, double *w, double *h)
{ {
D_ENTER; D_ENTER;
if (x) *x = t->x; if (x)
if (y) *y = t->y; *x = t->x;
if (w) *w = t->w; if (y)
if (h) *h = t->h; *y = t->y;
if (w)
*w = t->w;
if (h)
*h = t->h;
D_RETURN; D_RETURN;
} }
void void
e_text_get_min_size(E_Text *t, double *w, double *h) e_text_get_min_size(E_Text * t, double *w, double *h)
{ {
D_ENTER; D_ENTER;
if (w) *w = t->min.w; if (w)
if (h) *h = t->min.h; *w = t->min.w;
if (h)
*h = t->min.h;
D_RETURN; D_RETURN;
} }
void void
e_text_get_max_size(E_Text *t, double *w, double *h) e_text_get_max_size(E_Text * t, double *w, double *h)
{ {
D_ENTER; D_ENTER;
if (w) *w = t->max.w; if (w)
if (h) *h = t->max.h; *w = t->max.w;
if (h)
*h = t->max.h;
D_RETURN; D_RETURN;
} }
void void
e_text_set_state(E_Text *t, char *state) e_text_set_state(E_Text * t, char *state)
{ {
D_ENTER; D_ENTER;
@ -295,7 +312,7 @@ e_text_set_state(E_Text *t, char *state)
} }
void void
e_text_set_class(E_Text *t, char *class) e_text_set_class(E_Text * t, char *class)
{ {
D_ENTER; D_ENTER;
@ -306,11 +323,10 @@ e_text_set_class(E_Text *t, char *class)
} }
void void
e_text_update_class(E_Text *t) e_text_update_class(E_Text * t)
{ {
D_ENTER; D_ENTER;
D_RETURN; D_RETURN;
UN(t); UN(t);
} }

View File

@ -13,41 +13,48 @@ struct _E_Text
int visible; int visible;
double x, y, w, h; double x, y, w, h;
struct { struct
{
double w, h; double w, h;
} min, max; }
struct { min , max;
struct
{
int r, g, b, a; int r, g, b, a;
} color; }
color;
int layer; int layer;
Evas evas; Evas evas;
struct { struct
{
Evas_Object text; Evas_Object text;
Evas_Object o1; Evas_Object o1;
Evas_Object o2; Evas_Object o2;
Evas_Object o3; Evas_Object o3;
Evas_Object o4; Evas_Object o4;
} obj; }
obj;
}; };
E_Text *e_text_new(Evas evas, char *text, char *class); E_Text *e_text_new(Evas evas, char *text, char *class);
void e_text_free(E_Text *t); void e_text_free(E_Text * t);
void e_text_set_text(E_Text *t, char *text); void e_text_set_text(E_Text * t, char *text);
void e_text_set_layer(E_Text *t, int l); void e_text_set_layer(E_Text * t, int l);
void e_text_set_clip(E_Text *t, Evas_Object clip); void e_text_set_clip(E_Text * t, Evas_Object clip);
void e_text_unset_clip(E_Text *t); void e_text_unset_clip(E_Text * t);
void e_text_raise(E_Text *t); void e_text_raise(E_Text * t);
void e_text_lower(E_Text *t); void e_text_lower(E_Text * t);
void e_text_show(E_Text *t); void e_text_show(E_Text * t);
void e_text_hide(E_Text *t); void e_text_hide(E_Text * t);
void e_text_set_color(E_Text *t, int r, int g, int b, int a); void e_text_set_color(E_Text * t, int r, int g, int b, int a);
void e_text_move(E_Text *t, double x, double y); void e_text_move(E_Text * t, double x, double y);
void e_text_resize(E_Text *t, double w, double h); void e_text_resize(E_Text * t, double w, double h);
void e_text_get_geometry(E_Text *t, double *x, double *y, double *w, double *h); void e_text_get_geometry(E_Text * t, double *x, double *y,
void e_text_get_min_size(E_Text *t, double *w, double *h); double *w, double *h);
void e_text_get_max_size(E_Text *t, double *w, double *h); void e_text_get_min_size(E_Text * t, double *w, double *h);
void e_text_set_state(E_Text *t, char *state); void e_text_get_max_size(E_Text * t, double *w, double *h);
void e_text_set_class(E_Text *t, char *class); void e_text_set_state(E_Text * t, char *state);
void e_text_update_class(E_Text *t); void e_text_set_class(E_Text * t, char *class);
void e_text_update_class(E_Text * t);
#endif #endif

View File

@ -21,10 +21,13 @@ e_util_get_user_home(void)
D_ENTER; D_ENTER;
if (home) D_RETURN_(home); if (home)
D_RETURN_(home);
home = getenv("HOME"); home = getenv("HOME");
if (!home) home = getenv("TMPDIR"); if (!home)
if (!home) home = "/tmp"; home = getenv("TMPDIR");
if (!home)
home = "/tmp";
D_RETURN_(home); D_RETURN_(home);
} }
@ -37,7 +40,8 @@ e_util_memdup(void *data, int size)
D_ENTER; D_ENTER;
data_dup = malloc(size); data_dup = malloc(size);
if (!data_dup) D_RETURN_(NULL); if (!data_dup)
D_RETURN_(NULL);
memcpy(data_dup, data, size); memcpy(data_dup, data, size);
D_RETURN_(data_dup); D_RETURN_(data_dup);
@ -48,12 +52,12 @@ e_util_glob_matches(char *str, char *glob)
{ {
D_ENTER; D_ENTER;
if (!fnmatch(glob, str, 0)) D_RETURN_(1); if (!fnmatch(glob, str, 0))
D_RETURN_(1);
D_RETURN_(0); D_RETURN_(0);
} }
/* /*
* Function to take a URL of the form * Function to take a URL of the form
* file://dir1/dir2/file * file://dir1/dir2/file
@ -70,15 +74,15 @@ e_util_de_url_and_verify(const char *fi)
D_ENTER; D_ENTER;
wk = strstr( fi, "file:" ); wk = strstr(fi, "file:");
/* Valid URL contains "file:" */ /* Valid URL contains "file:" */
if( !wk ) if (!wk)
D_RETURN_ (NULL); D_RETURN_(NULL);
/* Need some form of hostname to continue */ /* Need some form of hostname to continue */
/* if( !hostn ) /* if( !hostn )
* D_RETURN_ (NULL); * * D_RETURN_ (NULL);
*/ */
/* Do we contain hostname? */ /* Do we contain hostname? */
@ -87,13 +91,13 @@ e_util_de_url_and_verify(const char *fi)
/* Hostname mismatch, reject file */ /* Hostname mismatch, reject file */
/* if( !wk ) /* if( !wk )
* D_RETURN_ (NULL); * * D_RETURN_ (NULL);
*/ */
/* Local file name starts after "hostname" */ /* Local file name starts after "hostname" */
wk = strchr( wk, '/' ); wk = strchr(wk, '/');
if ( !wk ) if (!wk)
D_RETURN_(NULL); D_RETURN_(NULL);
D_RETURN_(wk); D_RETURN_(wk);

File diff suppressed because it is too large Load Diff

View File

@ -30,8 +30,8 @@ typedef struct _E_Iconbar E_Iconbar;
typedef struct _E_View_Model E_View_Model; typedef struct _E_View_Model E_View_Model;
#endif #endif
typedef enum
typedef enum { {
E_DND_NONE, E_DND_NONE,
E_DND_COPY, E_DND_COPY,
E_DND_MOVE, E_DND_MOVE,
@ -40,39 +40,51 @@ typedef enum {
E_DND_DELETED, E_DND_DELETED,
E_DND_COPIED, E_DND_COPIED,
E_DND_ICONBAR_ADD E_DND_ICONBAR_ADD
} E_dnd_enum ; }
E_dnd_enum;
struct _E_View struct _E_View
{ {
E_Object o; E_Object o;
char * name; char *name;
E_View_Model *model; E_View_Model *model;
struct { struct
{
Evas_Render_Method render_method; Evas_Render_Method render_method;
int back_pixmap; int back_pixmap;
} options; }
options;
Evas evas; Evas evas;
struct { struct
{
Window base; Window base;
Window main; Window main;
} win; }
win;
Pixmap pmap; Pixmap pmap;
struct { struct
{
int w, h; int w, h;
int force; int force;
} size; }
struct { size;
struct
{
int x, y; int x, y;
} scroll; }
struct { scroll;
struct
{
int x, y; int x, y;
} location; }
location;
struct { struct
{
/* +-----------------+ /* +-----------------+
* | Wt | * | Wt |
* | +-----------+ | * | +-----------+ |
@ -85,38 +97,51 @@ struct _E_View
* | Wb | * | Wb |
* +-----------------+ * +-----------------+
*/ */
struct { struct
{
int l, r, t, b; int l, r, t, b;
} window; }
struct { window;
struct
{
int s, g, b; int s, g, b;
} icon; }
} spacing; icon;
struct { }
spacing;
struct
{
int on; int on;
/* The number of selected icons. */ /* The number of selected icons. */
int count; int count;
/* The number of icons we selected the last time. /* The number of icons we selected the last time.
If this is > 0, we don't pop up menus when * If this is > 0, we don't pop up menus when
the user clicks in a view. */ * the user clicks in a view. */
int last_count; int last_count;
int x, y, w, h; int x, y, w, h;
struct { struct
{
int x, y; int x, y;
} down; }
down;
struct { struct
struct { {
struct
{
int r, g, b, a; int r, g, b, a;
} }
edge_l, edge_r, edge_t, edge_b, edge_l , edge_r, edge_t, edge_b,
middle, middle, grad_l, grad_r, grad_t, grad_b;
grad_l, grad_r, grad_t, grad_b; struct
struct { {
int l, r, t, b; int l, r, t, b;
} grad_size; }
} config; grad_size;
struct { }
config;
struct
{
Evas_Object clip; Evas_Object clip;
Evas_Object edge_l; Evas_Object edge_l;
Evas_Object edge_r; Evas_Object edge_r;
@ -127,41 +152,51 @@ struct _E_View
Evas_Object grad_r; Evas_Object grad_r;
Evas_Object grad_t; Evas_Object grad_t;
Evas_Object grad_b; Evas_Object grad_b;
} obj; }
} select; obj;
}
select;
struct { struct
{
int started; int started;
Window win; Window win;
int x, y; int x, y;
struct { struct
{
int x, y; int x, y;
} offset; }
offset;
int update; int update;
int drop_mode; int drop_mode;
int icon_hide; int icon_hide;
int icon_show; int icon_show;
int matching_drop_attempt; int matching_drop_attempt;
} drag; }
struct { drag;
struct
{
int valid; int valid;
double x1, x2, y1, y2; double x1, x2, y1, y2;
} extents; }
extents;
E_Background bg; E_Background bg;
struct
struct { {
EfsdCmdId x, y, w, h; EfsdCmdId x, y, w, h;
int busy; int busy;
} geom_get; }
geom_get;
EfsdCmdId getbg; EfsdCmdId getbg;
struct
struct { {
E_Scrollbar *h, *v; E_Scrollbar *h, *v;
} scrollbar; }
scrollbar;
int is_listing; int is_listing;
@ -177,8 +212,6 @@ struct _E_View
Ebits_Object epplet_layout; Ebits_Object epplet_layout;
}; };
/** /**
* e_view_init - View event handlers initialization. * e_view_init - View event handlers initialization.
* *
@ -188,25 +221,29 @@ struct _E_View
*/ */
void e_view_init(void); void e_view_init(void);
void e_view_selection_update(E_View *v); void e_view_selection_update(E_View * v);
void e_view_deselect_all(E_View *v); void e_view_deselect_all(E_View * v);
void e_view_deselect_all_except(E_Icon *not_ic); void e_view_deselect_all_except(E_Icon * not_ic);
Ecore_Event *e_view_get_current_event(void); Ecore_Event *e_view_get_current_event(void);
int e_view_filter_file(E_View *v, char *file); int e_view_filter_file(E_View * v, char *file);
void e_view_icons_get_extents(E_View *v, int *min_x, int *min_y, int *max_x, int *max_y); void e_view_icons_get_extents(E_View * v, int *min_x, int *min_y,
void e_view_icons_apply_xy(E_View *v); int *max_x, int *max_y);
void e_view_scroll_to(E_View *v, int sx, int sy); void e_view_icons_apply_xy(E_View * v);
void e_view_scroll_by(E_View *v, int sx, int sy); void e_view_scroll_to(E_View * v, int sx, int sy);
void e_view_scroll_to_percent(E_View *v, double psx, double psy); void e_view_scroll_by(E_View * v, int sx, int sy);
void e_view_get_viewable_percentage(E_View *v, double *vw, double *vh); void e_view_scroll_to_percent(E_View * v, double psx,
void e_view_get_position_percentage(E_View *v, double *vx, double *vy); double psy);
void e_view_get_viewable_percentage(E_View * v, double *vw,
double *vh);
void e_view_get_position_percentage(E_View * v, double *vx,
double *vy);
void e_view_resort_alphabetical(E_View *v); void e_view_resort_alphabetical(E_View * v);
void e_view_arrange(E_View *v); void e_view_arrange(E_View * v);
void e_view_resort(E_View *v); void e_view_resort(E_View * v);
void e_view_queue_geometry_record(E_View *v); void e_view_queue_geometry_record(E_View * v);
void e_view_queue_icon_xy_record(E_View *v); void e_view_queue_icon_xy_record(E_View * v);
void e_view_queue_resort(E_View *v); void e_view_queue_resort(E_View * v);
/** /**
* e_view_new - Creates a new view object * e_view_new - Creates a new view object
@ -226,7 +263,7 @@ E_View *e_view_new(void);
* view's metadata (view window coordinates etc). If a view_model already * view's metadata (view window coordinates etc). If a view_model already
* exists for this dir, it is reused, otherwise a new on is created. * exists for this dir, it is reused, otherwise a new on is created.
*/ */
void e_view_set_dir(E_View *v, char *dir, int is_desktop); void e_view_set_dir(E_View * v, char *dir, int is_desktop);
/** /**
* e_view_populate - Draws icons for all files in view * e_view_populate - Draws icons for all files in view
@ -236,7 +273,7 @@ void e_view_set_dir(E_View *v, char *dir, int is_desktop);
* view_add_file for each one. This results in icons being created for each * view_add_file for each one. This results in icons being created for each
* file. * file.
*/ */
void e_view_populate(E_View *v); void e_view_populate(E_View * v);
/** /**
* e_view_realize - Initializes a view's graphics and content * e_view_realize - Initializes a view's graphics and content
@ -245,7 +282,7 @@ void e_view_populate(E_View *v);
* This function initializes a created view by loading * This function initializes a created view by loading
* all the graphics and creating the evas. * all the graphics and creating the evas.
*/ */
void e_view_realize(E_View *v); void e_view_realize(E_View * v);
/** /**
* e_view_update - Redraws a view * e_view_update - Redraws a view
@ -253,15 +290,14 @@ void e_view_realize(E_View *v);
* *
* If the contents of the view have changed, this function redraws it. * If the contents of the view have changed, this function redraws it.
*/ */
void e_view_update(E_View *v); void e_view_update(E_View * v);
void e_view_bg_reload(E_View * v);
void e_view_ib_reload(E_View * v);
void e_view_bg_reload(E_View *v); void e_view_file_add(E_View * v, E_File * file);
void e_view_ib_reload(E_View *v); void e_view_file_changed(E_View * v, E_File * file);
void e_view_file_delete(E_View * v, E_File * file);
void e_view_file_add(E_View *v, E_File *file);
void e_view_file_changed(E_View *v, E_File *file);
void e_view_file_delete(E_View *v, E_File *file);
void e_view_close_all(void); void e_view_close_all(void);