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_KEY_DOWN,
ACT_KEY_UP
} E_Action_Type;
}
E_Action_Type;
struct _E_Active_Action_Timer
{
@ -45,11 +46,14 @@ struct _E_Action
};
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,
int ry);
typedef void (*E_Action_Cont_Func) (E_Object * o, E_Action * a,
void *data, int x, int y, int rx, int ry, int dx, int dy);
void *data, int x, int y, int rx,
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);
void *data, int x, int y, int rx,
int ry);
struct _E_Action_Impl
{
@ -62,7 +66,6 @@ struct _E_Action_Impl
E_Action_Stop_Func func_stop;
};
/**
* e_action_init - Actions implementation initializer
*
@ -71,19 +74,25 @@ struct _E_Action_Impl
*/
void e_action_init(void);
int e_action_start(char *action, E_Action_Type act, int button, char *key,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data,
int x, int y, int rx, int ry);
void e_action_stop(char *action, E_Action_Type act, int button, char *key,
Ecore_Event_Key_Modifiers mods, E_Object *o, void *data,
int x, int y, int rx, int ry);
void e_action_cont(char *action, E_Action_Type act, int button, 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);
int e_action_start(char *action, E_Action_Type act, int button,
char *key, Ecore_Event_Key_Modifiers mods,
E_Object * o, void *data, int x, int y,
int rx, int ry);
void e_action_stop(char *action, E_Action_Type act, int button,
char *key, Ecore_Event_Key_Modifiers mods,
E_Object * o, void *data, int x, int y,
int rx, int ry);
void e_action_cont(char *action, E_Action_Type act, int button,
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_add_impl(char *action, E_Action_Start_Func func_start,
E_Action_Cont_Func func_cont, E_Action_Stop_Func func_stop);
void e_action_add_impl(char *action,
E_Action_Start_Func func_start,
E_Action_Cont_Func func_cont,
E_Action_Stop_Func func_stop);
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);

View File

@ -17,15 +17,20 @@ e_background_cleanup(E_Background *bg)
E_Background_Layer *bl;
bl = l->data;
if (bl->color_class) FREE(bl->color_class);
if (bl->file) FREE(bl->file);
if (bl->obj) evas_del_object(bg->evas, bl->obj);
if (bl->color_class)
FREE(bl->color_class);
if (bl->file)
FREE(bl->file);
if (bl->obj)
evas_del_object(bg->evas, bl->obj);
FREE(bl);
}
evas_list_free(bg->layers);
}
if (bg->file) FREE (bg->file);
if (bg->base_obj) evas_del_object(bg->evas, bg->base_obj);
if (bg->file)
FREE(bg->file);
if (bg->base_obj)
evas_del_object(bg->evas, bg->base_obj);
e_object_cleanup(E_OBJECT(bg));
@ -57,7 +62,8 @@ e_background_load(char *file)
D_ENTER;
db = e_db_open_read(file);
if (!db) D_RETURN_(NULL);
if (!db)
D_RETURN_(NULL);
num = 0;
e_db_int_get(db, "/type/bg", &num);
if (num != 1)
@ -79,38 +85,64 @@ e_background_load(char *file)
ZERO(bl, E_Background_Layer, 1);
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/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);
snprintf(buf, PATH_MAX, "/layers/%i/type", i);
e_db_int_get(db, buf, (int *)&(bl->type));
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)
{
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
{
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.y", i); e_db_float_get(db, buf, &(bl->scroll.y));
snprintf(buf, PATH_MAX, "/layers/%i/pos.x", i); e_db_float_get(db, buf, &(bl->pos.x));
snprintf(buf, PATH_MAX, "/layers/%i/pos.y", i); e_db_float_get(db, buf, &(bl->pos.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/size.h", i); e_db_float_get(db, buf, &(bl->size.h));
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/size.orig.h", i); e_db_int_get(db, buf, &(bl->size.orig.h));
snprintf(buf, PATH_MAX, "/layers/%i/fill.w", i); e_db_float_get(db, buf, &(bl->fill.w));
snprintf(buf, PATH_MAX, "/layers/%i/fill.h", i); e_db_float_get(db, buf, &(bl->fill.h));
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));
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.y", i);
e_db_float_get(db, buf, &(bl->scroll.y));
snprintf(buf, PATH_MAX, "/layers/%i/pos.x", i);
e_db_float_get(db, buf, &(bl->pos.x));
snprintf(buf, PATH_MAX, "/layers/%i/pos.y", i);
e_db_float_get(db, buf, &(bl->pos.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/size.h", i);
e_db_float_get(db, buf, &(bl->size.h));
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/size.orig.h", i);
e_db_int_get(db, buf, &(bl->size.orig.h));
snprintf(buf, PATH_MAX, "/layers/%i/fill.w", i);
e_db_float_get(db, buf, &(bl->fill.w));
snprintf(buf, PATH_MAX, "/layers/%i/fill.h", i);
e_db_float_get(db, buf, &(bl->fill.h));
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);
D_RETURN_(bg);
@ -124,9 +156,11 @@ e_background_realize(E_Background *bg, Evas evas)
D_ENTER;
if (bg->evas) D_RETURN;
if (bg->evas)
D_RETURN;
bg->evas = evas;
if (!bg->evas) D_RETURN;
if (!bg->evas)
D_RETURN;
for (count = 0, l = bg->layers; l; l = l->next, count++)
{
E_Background_Layer *bl;
@ -173,10 +207,12 @@ e_background_set_scroll(E_Background *bg, int sx, int sy)
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.sy = sy;
if (!bg->evas) D_RETURN;
if (!bg->evas)
D_RETURN;
for (l = bg->layers; l; l = l->next)
{
E_Background_Layer *bl;
@ -200,7 +236,8 @@ e_background_set_size(E_Background *bg, int w, int h)
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.h = h;
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;
iw = 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;
h = bl->size.h * (double)bg->geom.h;
if (bl->size.orig.w) w = (double)iw * bl->size.w;
if (bl->size.orig.h) h = (double)ih * bl->size.h;
if (bl->size.orig.w)
w = (double)iw *bl->size.w;
if (bl->size.orig.h)
h = (double)ih *bl->size.h;
fw = bl->fill.w * w;
fh = bl->fill.h * h;
if (bl->fill.orig.w) fw = (double)iw * bl->fill.w;
if (bl->fill.orig.h) fh = (double)ih * bl->fill.h;
if (bl->fill.orig.w)
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;
y = ((double)bg->geom.h - h + 1) * bl->pos.y;
bl->x = x;
@ -253,7 +299,8 @@ 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)
e_background_set_color_class(E_Background * bg, char *cc, int r, int g, int b,
int a)
{
Evas_List l;

View File

@ -21,52 +21,63 @@ struct _E_Background
Evas evas;
char *file;
struct {
struct
{
int sx, sy;
int w, h;
} geom;
}
geom;
Evas_List layers;
Evas_Object base_obj;
};
struct _E_Background_Layer
{
E_Background_Type type;
int inlined;
struct {
struct
{
float x, y;
} scroll;
struct {
}
scroll;
struct
{
float x, y;
} pos;
struct {
}
pos;
struct
{
float w, h;
struct {
struct
{
int w, h;
} orig;
} size, fill;
}
orig;
}
size , fill;
char *color_class;
char *file;
double angle;
struct {
struct
{
int r, g, b, a;
} fg, bg;
}
fg , bg;
double x, y, w, h, fw, fh;
Evas_Object obj;
};
E_Background *e_background_new(void);
E_Background *e_background_load(char *file);
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_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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -27,38 +27,55 @@ struct _E_Border
{
E_Observee obs;
struct {
struct
{
Window main;
Window l, r, t, b;
Window input;
Window container;
Window client;
} win;
struct {
}
win;
struct
{
Evas l, r, t, b;
} evas;
struct {
struct {
}
evas;
struct
{
struct
{
E_Text *l, *r, *t, *b;
} title;
struct {
}
title;
struct
{
Evas_Object l, r, t, b;
} title_clip;
} obj;
struct {
}
title_clip;
}
obj;
struct
{
Pixmap l, r, t, b;
} pixmap;
struct {
}
pixmap;
struct
{
int new;
Ebits_Object l, r, t, b;
} bits;
}
bits;
struct {
struct {
struct
{
struct
{
int x, y, w, h;
int visible;
int dx, dy;
} requested;
}
requested;
int x, y, w, h;
int visible;
int selected;
@ -67,13 +84,17 @@ struct _E_Border
int has_shape;
int shape_changes;
int shaped_client;
} current, previous;
}
current , previous;
struct {
struct {
struct
{
struct
{
int w, h;
double aspect;
} base, min, max, step;
}
base , min, max, step;
int layer;
char *title;
char *name;
@ -97,67 +118,96 @@ struct _E_Border
int is_desktop;
int w, h;
int no_place;
struct {
struct
{
int launch_id;
pid_t pid;
pid_t ppid;
uid_t user;
} e;
struct {
}
e;
struct
{
int requested;
int x, y;
int gravity;
} pos;
}
pos;
int desk;
struct {
struct
{
int x, y;
} area;
}
area;
int internal;
struct {
struct
{
int matched;
struct {
struct
{
int matched;
int ignore;
} prog_location;
struct {
}
prog_location;
struct
{
int matched;
char *style;
} border;
struct {
}
border;
struct
{
int matched;
int x, y;
} location;
struct {
}
location;
struct
{
int matched;
int x, y;
} desk_area;
struct {
}
desk_area;
struct
{
int matched;
int w, h;
} size;
struct {
}
size;
struct
{
int matched;
int desk;
} desktop;
struct {
}
desktop;
struct
{
int matched;
int sticky;
} sticky;
struct {
}
sticky;
struct
{
int matched;
int layer;
} layer;
} matched;
} client;
}
layer;
}
matched;
}
client;
struct {
struct
{
int move, resize;
} mode;
}
mode;
struct {
struct
{
int x, y, w, h;
int is;
} max;
}
max;
int ignore_unmap;
int shape_changed;
@ -203,7 +253,8 @@ void e_border_attach_all_mouse_grabs(void);
void e_border_redo_grabs(void);
E_Border *e_border_find_by_window(Window win);
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,
int gg, int bb, int aa);
void e_border_adjust_limits(E_Border * b);
void e_border_update(E_Border * b);
void e_border_set_layer(E_Border * b, int layer);

View File

@ -6,19 +6,37 @@
#include "icccm.h"
#include "bordermenu.h"
static void e_bordermenu_cb_close(E_Menu *m, E_Menu_Item *mi, void *data);
static void e_bordermenu_cb_kill(E_Menu *m, E_Menu_Item *mi, void *data);
static void e_bordermenu_cb_raise(E_Menu *m, E_Menu_Item *mi, void *data);
static void e_bordermenu_cb_lower(E_Menu *m, E_Menu_Item *mi, void *data);
static void e_bordermenu_cb_sticky(E_Menu *m, E_Menu_Item *mi, void *data);
static void e_bordermenu_cb_iconify(E_Menu *m, E_Menu_Item *mi, void *data);
static void e_bordermenu_cb_max(E_Menu *m, E_Menu_Item *mi, 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_close(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_kill(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_raise(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_lower(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_sticky(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_iconify(E_Menu * m, E_Menu_Item * mi,
void *data);
static void e_bordermenu_cb_max(E_Menu * m, E_Menu_Item * mi,
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
@ -30,7 +48,8 @@ e_bordermenu_cb_close(E_Menu *m, E_Menu_Item *mi, void *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;
UN(m);
@ -46,7 +65,8 @@ e_bordermenu_cb_kill(E_Menu *m, E_Menu_Item *mi, void *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;
UN(m);
@ -94,8 +114,10 @@ e_bordermenu_cb_sticky(E_Menu *m, E_Menu_Item *mi, void *data)
b = data;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
b->client.sticky = mi->on;
@ -129,14 +151,19 @@ e_bordermenu_cb_max(E_Menu *m, E_Menu_Item *mi, void *data)
b = data;
if (b->client.is_desktop) D_RETURN;
if (b->current.shaded > 0) D_RETURN;
if ((b->mode.move) || (b->mode.resize)) D_RETURN;
if (b->client.is_desktop)
D_RETURN;
if (b->current.shaded > 0)
D_RETURN;
if ((b->mode.move) || (b->mode.resize))
D_RETURN;
b->mode.move = 0;
b->mode.resize = 0;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
if (mi->on)
@ -200,8 +227,10 @@ e_bordermenu_cb_remember_location(E_Menu *m, E_Menu_Item *mi, void *data)
b = data;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
b->client.matched.matched = 1;
@ -220,8 +249,10 @@ e_bordermenu_cb_remember_size(E_Menu *m, E_Menu_Item *mi, void *data)
b = data;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
b->client.matched.matched = 1;
@ -240,8 +271,10 @@ e_bordermenu_cb_remember_desktop(E_Menu *m, E_Menu_Item *mi, void *data)
b = data;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
b->client.matched.matched = 1;
@ -260,8 +293,10 @@ e_bordermenu_cb_remember_sticky(E_Menu *m, E_Menu_Item *mi, void *data)
b = data;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
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
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;
@ -280,8 +316,10 @@ e_bordermenu_cb_remember_prog_location_ignore(E_Menu *m, E_Menu_Item *mi, void
b = data;
if (mi->on) e_menu_item_set_state(mi, 0);
else e_menu_item_set_state(mi, 1);
if (mi->on)
e_menu_item_set_state(mi, 0);
else
e_menu_item_set_state(mi, 1);
e_menu_set_state(m, mi);
b->client.matched.matched = 1;
@ -378,7 +416,8 @@ e_bordermenu_do(E_Border *b)
menuitem = e_menu_item_new("Remember Location");
e_menu_item_set_check(menuitem, 1);
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_set_state(menu, menuitem);
@ -405,8 +444,11 @@ e_bordermenu_do(E_Border *b)
menuitem = e_menu_item_new("Ignore Program Specified Position");
e_menu_item_set_check(menuitem, 1);
e_menu_item_set_state(menuitem, b->client.matched.prog_location.matched);
e_menu_item_set_callback(menuitem, e_bordermenu_cb_remember_prog_location_ignore, b);
e_menu_item_set_state(menuitem,
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_set_state(menu, menuitem);
}
@ -418,16 +460,21 @@ e_bordermenu_do(E_Border *b)
menu = b->menus->data;
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;
cry = b->current.y + pt;
crw = b->client.w;
crh = b->client.h;
ecore_pointer_xy_get(&mx, &my);
if (mx + menu->current.w > crx + crw) mx = crx + crw - menu->current.w;
if (my + menu->current.h > cry + crh) my = cry + crh - menu->current.h;
if (mx < crx) mx = crx;
if (my < cry) my = cry;
if (mx + menu->current.w > crx + crw)
mx = crx + crw - menu->current.w;
if (my + menu->current.h > cry + crh)
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);
}

View File

@ -6,4 +6,3 @@
void e_bordermenu_do(E_Border * b);
#endif

View File

@ -54,39 +54,28 @@ e_config_get(char *type)
} \
}
E_CONF("grabs", cfg_grabs_db,
"%s/behavior/grabs.db", e_config_user_dir());
E_CONF("grabs", cfg_grabs_db, "%s/behavior/grabs.db", e_config_user_dir());
E_CONF("settings", cfg_settings_db,
"%s/behavior/settings.db", e_config_user_dir());
E_CONF("actions", cfg_actions_db,
"%s/behavior/actions.db", e_config_user_dir());
E_CONF("apps_menu", cfg_apps_menu_db,
"%s/behavior/apps_menu.db", e_config_user_dir());
E_CONF("match", cfg_match_db,
"%s/behavior/match.db", e_config_user_dir());
E_CONF("borders", cfg_borders_db,
PACKAGE_DATA_DIR"/data/borders/");
E_CONF("menus", cfg_menus_dir,
PACKAGE_DATA_DIR"/data/menus/");
E_CONF("entries", cfg_entries_dir,
PACKAGE_DATA_DIR"/data/entries/");
E_CONF("match", cfg_match_db, "%s/behavior/match.db", e_config_user_dir());
E_CONF("borders", cfg_borders_db, PACKAGE_DATA_DIR "/data/borders/");
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,
PACKAGE_DATA_DIR "/data/selections/");
E_CONF("scrollbars", cfg_scrollbars_dir,
PACKAGE_DATA_DIR "/data/scrollbars/");
E_CONF("guides", cfg_guides_dir,
PACKAGE_DATA_DIR"/data/guides/");
E_CONF("images", cfg_images_dir,
PACKAGE_DATA_DIR"/data/images/");
E_CONF("cursors", cfg_cursors_dir,
PACKAGE_DATA_DIR"/data/cursors/");
E_CONF("guides", cfg_guides_dir, PACKAGE_DATA_DIR "/data/guides/");
E_CONF("images", cfg_images_dir, PACKAGE_DATA_DIR "/data/images/");
E_CONF("cursors", cfg_cursors_dir, PACKAGE_DATA_DIR "/data/cursors/");
E_CONF("backgrounds", cfg_backgrounds_dir,
PACKAGE_DATA_DIR "/data/backgrounds/");
E_CONF("fonts", cfg_fonts_dir,
PACKAGE_DATA_DIR"/data/fonts/");
E_CONF("epplets", cfg_epplets_dir,
PACKAGE_DATA_DIR"/data/epplets/");
E_CONF("fonts", cfg_fonts_dir, PACKAGE_DATA_DIR "/data/fonts/");
E_CONF("epplets", cfg_epplets_dir, PACKAGE_DATA_DIR "/data/epplets/");
D_RETURN_("");
}
@ -99,26 +88,34 @@ e_config_init(void)
D_ENTER;
#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());
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());
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());
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());
if (!e_file_exists(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());
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());
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());
if (!e_file_exists(buf))
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/apps_menu.db", buf);
snprintf(buf, PATH_MAX, "%sappearance/borders/border.bits.db", e_config_user_dir());
e_file_cp(PACKAGE_DATA_DIR "/data/config/behavior/default/apps_menu.db",
buf);
snprintf(buf, PATH_MAX, "%sappearance/borders/border.bits.db",
e_config_user_dir());
#endif
#if 0
ts();
@ -161,8 +158,10 @@ e_config_user_dir(void)
{
D_ENTER;
if (cfg_user_dir[0]) D_RETURN_(cfg_user_dir);
if (cfg_root[0]) D_RETURN_(cfg_root);
if (cfg_user_dir[0])
D_RETURN_(cfg_user_dir);
if (cfg_root[0])
D_RETURN_(cfg_root);
#if 1 /* disabled for now - use system ones only */
snprintf(cfg_user_dir, PATH_MAX, "%s/.e/", e_util_get_user_home());
#else
@ -177,10 +176,12 @@ typedef struct _e_config_file_entry E_Config_File_Entry;
struct _e_config_file_entry
{
char *name;
struct {
struct
{
char *path;
time_t last_mod;
} user, system;
}
user , system;
Evas_List hash[256];
};
@ -214,16 +215,10 @@ e_config_val_key_get(char *file, char *key, char *def)
{
}
void
e_config_type_add_node(E_Config_Base_Type * base, char *prefix,
E_Config_Datatype type, E_Config_Base_Type * list_type,
int offset,
int def_int,
float def_float,
char *def_str)
int offset, int def_int, float def_float, char *def_str)
{
E_Config_Node *cfg_node;
@ -270,7 +265,8 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
D_ENTER;
if (!e_file_exists(file)) D_RETURN_(NULL);
if (!e_file_exists(file))
D_RETURN_(NULL);
db = e_db_open_read(file);
if (!db)
@ -278,6 +274,7 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
data = NEW(char, type->size);
ZERO(data, char, type->size);
for (l = type->nodes; l; l = l->next)
{
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)))
(*((char **)(&(data[node->offset])))) = val;
else
e_strdup((*((char **)(&(data[node->offset])))), node->def_str);
e_strdup((*((char **)(&(data[node->offset])))),
node->def_str);
}
break;
case E_CFG_TYPE_FLOAT:
@ -334,7 +332,8 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
{
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);
l2 = evas_list_append(l2, data2);
}
@ -356,7 +355,6 @@ e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
D_RETURN_(data);
}
#if 0
typedef struct _list_base List_Base;
typedef struct _list_element List_Element;
@ -374,7 +372,8 @@ struct _list_element
};
/* eg: */
void ts(void)
void
ts(void)
{
/* define the different config types and structs to the config engine */
E_Config_Base_Type *cf_list;
@ -383,12 +382,16 @@ void ts(void)
D_ENTER;
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, "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);
E_CONFIG_NODE(cf_element, "name", E_CFG_TYPE_STR, NULL, List_Element, name,
0, 0, "DEFAULT_NAME");
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();
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 */
{

View File

@ -146,7 +146,6 @@ E_CFG_END_VALIDITY_CHECK \
_val = _var.cur_data_val; \
_size = _var.cur_data_size;}
char *e_config_get(char *type);
void e_config_init(void);
void e_config_set_user_dir(char *dir);
@ -203,9 +202,10 @@ E_Config_Value *e_config_value_get_int(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 **val_ret, char *default_val);
E_Config_Value *e_config_value_get_float(E_Config_Value *handle, char *file,
char *prefix, char *key,
float *val_ret, float default_val);
E_Config_Value *e_config_value_get_float(E_Config_Value * handle,
char *file, char *prefix,
char *key, float *val_ret,
float default_val);
E_Config_Base_Type *e_config_type_new(void);
void e_config_type_add_node(E_Config_Base_Type * base,
char *prefix,
@ -213,10 +213,8 @@ void e_config_type_add_node(E_Config_Base_Type *base,
E_Config_Base_Type * list_type,
int offset,
int def_int,
float def_float,
char *def_str);
float def_float, char *def_str);
void *e_config_load(char *file,
char *prefix,
E_Config_Base_Type *type);
char *prefix, E_Config_Base_Type * type);
#endif

View File

@ -29,14 +29,16 @@ e_cursors_idle(void *data)
D_ENTER;
if (!cursor_change) D_RETURN;
if (!cursor_change)
D_RETURN;
if ((prev_cursor) && (cur_cursor) && (strcmp(prev_cursor, cur_cursor)))
change = 1;
if ((prev_cursor) && (!cur_cursor))
change = 1;
if ((!prev_cursor) && (cur_cursor))
change = 1;
if (change) e_cursors_set(cur_cursor);
if (change)
e_cursors_set(cur_cursor);
IF_FREE(prev_cursor);
e_strdup(prev_cursor, cur_cursor);
IF_FREE(cur_cursor);
@ -95,7 +97,8 @@ e_cursors_display_in_window(Window win, char *type)
D_ENTER;
if (!type) type = "Default";
if (!type)
type = "Default";
c = e_cursors_find(type);
if (!c)
{
@ -117,7 +120,8 @@ e_cursors_display_in_window(Window win, char *type)
c->mod = e_file_mod_time(buf);
E_DB_INT_GET(buf, "/cursor/x", hx, 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);
if (im)
{
@ -134,7 +138,8 @@ e_cursors_display_in_window(Window win, char *type)
data = imlib_image_get_data_for_reading_only();
/* figure out fg & bg */
if (!data) goto done;
if (!data)
goto done;
for (y = 0; y < h; y++)
{
for (x = 0; x < w; x++)
@ -186,7 +191,8 @@ e_cursors_display_in_window(Window win, char *type)
/* fill out cursor pixmap with 0's (bg) */
ecore_fill_rectangle(pmap, 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 (x = 0; x < w; x++)
@ -224,7 +230,8 @@ e_cursors_display_in_window(Window win, char *type)
}
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(mask);
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);
else
{
if (!strcmp(type, "Default")) D_RETURN;
if (!strcmp(type, "Default"))
D_RETURN;
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);
#endif

View File

@ -33,7 +33,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "debug.h"
static int do_print = 0;
static int calldepth = 0;
@ -49,15 +48,12 @@ debug_whitespace(int calldepth)
printf("-");
}
static void
debug_print_info(void)
{
printf("e17 dbg: ");
}
void
e_debug_enter(const char *file, const char *func)
{
@ -73,7 +69,6 @@ e_debug_enter(const char *file, const char *func)
}
}
void
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");
}
}

View File

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

View File

@ -13,10 +13,8 @@ e_delayed_action_cleanup(E_Delayed_Action *eda)
D_RETURN;
}
E_Delayed_Action *
e_delayed_action_new(E_Event_Type event,
double delay, E_Delay_Func delay_func)
e_delayed_action_new(E_Event_Type event, double delay, E_Delay_Func delay_func)
{
E_Delayed_Action *eda = NULL;
@ -34,7 +32,6 @@ e_delayed_action_new(E_Event_Type event,
D_RETURN_(eda);
}
void
e_delayed_action_start(E_Observer * obs, E_Observee * obj, E_Event_Type event)
{
@ -49,7 +46,6 @@ e_delayed_action_start(E_Observer *obs, E_Observee *obj, E_Event_Type event)
D_RETURN;
}
void
e_delayed_action_cancel(E_Delayed_Action * eda)
{
@ -57,9 +53,9 @@ e_delayed_action_cancel(E_Delayed_Action *eda)
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);
D_RETURN;
}

View File

@ -13,14 +13,14 @@ typedef struct _e_delayed_action
double delay;
E_Delay_Func delay_func;
} E_Delayed_Action;
}
E_Delayed_Action;
E_Delayed_Action *e_delayed_action_new(E_Event_Type event,
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,
E_Event_Type event);
void e_delayed_action_cancel(E_Delayed_Action * eda);
#endif

View File

@ -63,7 +63,8 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
D_ENTER;
/* set grav */
if ((dx ==0) && (dy == 0)) D_RETURN;
if ((dx == 0) && (dy == 0))
D_RETURN;
desk->x -= dx;
desk->y -= dy;
xd = yd = wd = hd = 0;
@ -119,8 +120,7 @@ e_desktops_scroll(E_Desktop *desk, int dx, int dy)
grav_stick = StaticGravity;
/* scroll */
ecore_window_move_resize(desk->win.container,
xd, yd,
screen_w + wd, screen_h + hd);
xd, yd, screen_w + wd, screen_h + hd);
/* reset */
for (l = desk->windows; l; l = l->next)
{
@ -223,7 +223,8 @@ e_desktops_init_file_display(E_Desktop *desk)
b->client.fixed = 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;
}
@ -240,8 +241,10 @@ e_desktops_new(void)
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.container = ecore_window_override_new(desk->win.main, 0, 0, screen_w, screen_h);
desk->win.main =
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_show(desk->win.container);
@ -263,7 +266,8 @@ e_desktops_add_border(E_Desktop *d, E_Border *b)
{
D_ENTER;
if ((!d) || (!b)) D_RETURN;
if ((!d) || (!b))
D_RETURN;
b->desk = d;
b->client.desk = d->desk.desk;
b->client.area.x = d->desk.area.x;
@ -278,7 +282,8 @@ e_desktops_del_border(E_Desktop *d, E_Border *b)
{
D_ENTER;
if ((!d) || (!b)) D_RETURN;
if ((!d) || (!b))
D_RETURN;
d->windows = evas_list_remove(d->windows, b);
b->desk = NULL;
@ -360,7 +365,6 @@ e_desktops_goto_desk(int d)
e_desktops_goto(d, 0, 0);
D_RETURN;
}
@ -378,8 +382,8 @@ e_desktops_goto(int d, int ax, int ay)
Evas_List l;
if ((d == desk->desk.desk) &&
(ax == desk->desk.area.x) &&
(ay == desk->desk.area.y)) D_RETURN;
(ax == desk->desk.area.x) && (ay == desk->desk.area.y))
D_RETURN;
dx = ax - desk->desk.area.x;
dy = ay - desk->desk.area.y;
@ -389,7 +393,8 @@ e_desktops_goto(int d, int ax, int ay)
E_Border *b;
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)
{
@ -432,4 +437,3 @@ e_desktops_get_desktops_list()
D_ENTER;
D_RETURN_(desktops);
}

View File

@ -17,21 +17,29 @@ struct _E_Desktop
char *name;
char *dir;
struct {
struct
{
Window main;
Window container;
} win;
}
win;
int x, y;
struct {
struct
{
int w, h;
} real, virt;
}
real , virt;
Evas_List windows;
struct {
struct
{
int desk;
struct {
struct
{
int x, y;
} area;
} desk;
}
area;
}
desk;
E_View *view;
int changed;
};

View File

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

View File

@ -13,7 +13,8 @@
#endif
#endif
void e_ferite_init(void)
void
e_ferite_init(void)
{
D_ENTER;
@ -23,7 +24,8 @@ void e_ferite_init(void)
D_RETURN;
}
void e_ferite_deinit(void)
void
e_ferite_deinit(void)
{
D_ENTER;
@ -33,7 +35,8 @@ void e_ferite_deinit(void)
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;
@ -42,7 +45,8 @@ int e_ferite_script_error( FeriteScript *script, char *errmsg, int val )
D_RETURN_(1);
}
int e_ferite_script_warning( FeriteScript *script, char *warnmsg )
int
e_ferite_script_warning(FeriteScript * script, char *warnmsg)
{
D_ENTER;
@ -51,7 +55,8 @@ int e_ferite_script_warning( FeriteScript *script, char *warnmsg )
D_RETURN_(1);
}
void e_ferite_run( char *txt )
void
e_ferite_run(char *txt)
{
FeriteScript *script = NULL;

View File

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

View File

@ -11,8 +11,7 @@ e_file_cleanup(E_File *f)
D_ENTER;
IF_FREE(f->info.icon);
IF_FREE(f->info.link)
IF_FREE(f->info.custom_icon);
IF_FREE(f->info.link) IF_FREE(f->info.custom_icon);
IF_FREE(f->info.mime.base);
IF_FREE(f->info.mime.type);
IF_FREE(f->file);
@ -25,6 +24,7 @@ E_File *
e_file_new(char *file)
{
E_File *f;
D_ENTER;
if (!file || *file == 0)
@ -32,8 +32,7 @@ e_file_new(char *file)
f = NEW(E_File, 1);
e_object_init(E_OBJECT(f),
(E_Cleanup_Func) e_file_cleanup);
e_object_init(E_OBJECT(f), (E_Cleanup_Func) e_file_cleanup);
f->info.icon = NULL;
f->info.link = NULL;
@ -83,7 +82,6 @@ e_file_set_mime(E_File *f, char *base, char *mime)
D("Setting mime: %40s: %s/%s\n", f->file, base, mime);
if (((f->info.mime.base) && !(strcmp(f->info.mime.base, base)))
&& ((f->info.mime.type) && !(strcmp(f->info.mime.type, mime))))
D_RETURN;
@ -94,7 +92,6 @@ e_file_set_mime(E_File *f, char *base, char *mime)
f->info.mime.base = strdup(base);
f->info.mime.type = strdup(mime);
/* effect changes here */
/*
* if (f->info.custom_icon)
@ -116,7 +113,8 @@ e_file_set_mime(E_File *f, char *base, char *mime)
snprintf(icon, PATH_MAX, "%s/data/icons/%s/%s.db",
PACKAGE_DATA_DIR, f->info.mime.base, type);
p = strrchr(type, '/');
if (p) *p = 0;
if (p)
*p = 0;
}
while (p && !e_file_exists(icon));

View File

@ -11,15 +11,19 @@ struct _E_File
char *file;
struct stat stat;
struct {
struct
{
char *icon;
char *custom_icon;
char *link;
struct {
struct
{
char *base;
char *type;
} mime;
} info;
}
mime;
}
info;
};
E_File *e_file_new(char *file);

View File

@ -58,11 +58,13 @@ void
e_view_machine_close_all_views(void)
{
Evas_List l;
D_ENTER;
/* Copy the list of views and unregister them */
for (l = VM->views; l; l = l->next)
{
E_View *v = l->data;
e_object_unref(E_OBJECT(v->model));
}
D_RETURN;
@ -102,10 +104,12 @@ E_View *
e_view_machine_get_view_by_main_window(Window win)
{
Evas_List l;
D_ENTER;
for (l = VM->views; l; l = l->next)
{
E_View *v = l->data;
if (v && win == v->win.main)
D_RETURN_(v);
}
@ -116,13 +120,14 @@ E_View *
e_view_machine_get_view_by_base_window(Window win)
{
Evas_List l;
D_ENTER;
for (l = VM->views; l; l = l->next)
{
E_View *v = l->data;
if (v && win == v->win.base)
D_RETURN_(v);
}
D_RETURN_(NULL);
}

View File

@ -12,9 +12,12 @@ 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_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_readlink (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_handle_efsd_event_reply_readlink(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_bg_reload_timeout(int val, void *data);
@ -60,8 +63,7 @@ e_view_model_new (void)
m->dir = NULL;
m->views = NULL;
e_object_init(E_OBJECT(m),
(E_Cleanup_Func) e_view_model_cleanup);
e_object_init(E_OBJECT(m), (E_Cleanup_Func) e_view_model_cleanup);
e_view_machine_register_view_model(m);
D_RETURN_(m);
@ -92,6 +94,7 @@ static void
e_view_model_set_default_background(E_View_Model * m)
{
char buf[PATH_MAX];
D_ENTER;
if (!m)
@ -107,8 +110,7 @@ e_view_model_set_default_background(E_View_Model *m)
e_strdup(m->bg_file, buf);
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5,
e_view_model_bg_reload_timeout, 0, m);
ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, m);
D_RETURN;
}
@ -124,17 +126,18 @@ e_view_model_handle_fs_restart(void *data)
if (e_fs_get_connection())
{
EfsdOptions *ops;
/* FIXME restart with metadata pending for views */
ops = efsd_ops(3,
efsd_op_get_stat(),
efsd_op_get_filetype(),
efsd_op_list_all());
efsd_op_get_filetype(), efsd_op_list_all());
m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir,
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;
}
@ -165,8 +168,7 @@ e_view_model_set_dir(E_View_Model *m, char *dir)
ops = efsd_ops(3,
efsd_op_get_stat(),
efsd_op_get_filetype(),
efsd_op_list_all());
efsd_op_get_filetype(), efsd_op_list_all());
m->monitor_id = efsd_start_monitor(e_fs_get_connection(), m->dir,
ops, TRUE);
D("monitor id for %s = %i\n", m->dir, m->monitor_id);
@ -222,7 +224,6 @@ e_view_model_handle_fs(EfsdEvent *ev)
D_RETURN;
}
static void
e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent * ev)
{
@ -233,6 +234,7 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
char *m, *p;
char mime[PATH_MAX], base[PATH_MAX];
D_ENTER;
if (!ev)
@ -272,9 +274,10 @@ e_view_model_handle_efsd_event_reply_getfiletype(EfsdEvent *ev)
{
E_View *v = (E_View *) l->data;
E_Icon *ic = e_icon_find_by_file(v, f->file);
/* Try to update the GUI.
It's just a try because we need to have the file's stat
info as well. --cK.
* It's just a try because we need to have the file's stat
* info as well. --cK.
*/
e_icon_update_state(ic);
e_icon_initial_show(ic);
@ -304,14 +307,15 @@ e_view_model_handle_efsd_event_reply_stat(EfsdEvent *ev)
D_RETURN;
/* When everything went okay and we can find a model,
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
info too. --cK. */
* 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
* info too. --cK. */
f->stat = *((struct stat *)efsd_event_data(ev));
for (l = m->views; l; l = l->next)
{
E_View *v = (E_View *) l->data;
E_Icon *ic = e_icon_find_by_file(v, f->file);
e_icon_update_state(ic);
e_icon_initial_show(ic);
}
@ -325,6 +329,7 @@ e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *ev)
E_View_Model *m;
E_File *f;
Evas_List l;
D_ENTER;
if (!ev)
@ -343,6 +348,7 @@ e_view_model_handle_efsd_event_reply_readlink(EfsdEvent *ev)
{
E_View *v = (E_View *) l->data;
E_Icon *ic = e_icon_find_by_file(v, f->file);
e_icon_update_state(ic);
e_icon_initial_show(ic);
}
@ -355,6 +361,7 @@ e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *ev)
{
Evas_List l;
EfsdCmdId cmd;
D_ENTER;
if (!ev)
@ -364,9 +371,11 @@ e_view_model_handle_efsd_event_reply_getmeta(EfsdEvent *ev)
for (l = VM->views; l; l = l->next)
{
E_View *v;
v = l->data;
/* ignore metadata for desktops */
if(v->model->is_desktop) continue;
if (v->model->is_desktop)
continue;
if (v->geom_get.x == cmd)
{
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)
efsd_metadata_get_int(ev, &(v->size.h));
else
v->size.h = 400;
v->size.h = 401;
}
}
/* FIXME currently, the bg info is not set via metadata */
@ -433,30 +442,28 @@ 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 */
if ((!v->geom_get.x) &&
(!v->geom_get.y) &&
(!v->geom_get.w) &&
(!v->geom_get.h) &&
(v->geom_get.busy))
(!v->geom_get.w) && (!v->geom_get.h) && (v->geom_get.busy))
{
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;
if (v->bg)
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->client.internal = 1;
e_border_remove_click_grab(b);
}
}
D_RETURN;
}
@ -561,7 +568,8 @@ e_view_model_file_added(int id, char *file)
D_ENTER;
/* 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);
if (!strcmp(file, ".e_background.bg.db"))
@ -570,15 +578,13 @@ e_view_model_file_added(int id, char *file)
snprintf(buf, PATH_MAX, "%s/%s", m->dir, file);
e_strdup(m->bg_file, buf);
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5,
e_view_model_bg_reload_timeout, 0, m);
ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, m);
}
else if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp(".e_iconbar.bits.db", file)))
{
snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5,
e_view_model_ib_reload_timeout, 0, m);
ecore_add_event_timer(buf, 0.5, e_view_model_ib_reload_timeout, 0, m);
}
else if (file[0] != '.')
{
@ -600,6 +606,7 @@ e_view_model_file_deleted(int id, char *file)
Evas_List l;
E_File *f;
E_View_Model *m;
D_ENTER;
if (!file || file[0] == '/')
@ -619,6 +626,7 @@ e_view_model_file_deleted(int id, char *file)
for (l = m->views; l; l = l->next)
{
E_View *v = (E_View *) l->data;
e_object_unref(E_OBJECT(v->iconbar));
v->iconbar = NULL;
}
@ -628,6 +636,7 @@ e_view_model_file_deleted(int id, char *file)
for (l = m->views; l; l = l->next)
{
E_View *v = (E_View *) l->data;
e_view_file_delete(v, f);
}
}
@ -645,7 +654,8 @@ e_view_model_file_changed(int id, char *file)
D_ENTER;
if (!file || file[0] == '/') D_RETURN;
if (!file || file[0] == '/')
D_RETURN;
m = e_view_model_find_by_monitor_id(id);
f = e_file_get_by_name(m->files, file);
if (!strcmp(file, ".e_background.bg.db"))
@ -654,15 +664,13 @@ e_view_model_file_changed(int id, char *file)
snprintf(buf, PATH_MAX, "%s/%s", m->dir, file);
e_strdup(m->bg_file, buf);
snprintf(buf, PATH_MAX, "background_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5,
e_view_model_bg_reload_timeout, 0, m);
ecore_add_event_timer(buf, 0.5, e_view_model_bg_reload_timeout, 0, m);
}
else if ((!strcmp(".e_iconbar.db", file)) ||
(!strcmp(".e_iconbar.bits.db", file)))
{
snprintf(buf, PATH_MAX, "iconbar_reload:%s", m->dir);
ecore_add_event_timer(buf, 0.5,
e_view_model_ib_reload_timeout, 0, m);
ecore_add_event_timer(buf, 0.5, e_view_model_ib_reload_timeout, 0, m);
}
else if (file[0] != '.')
{
@ -683,7 +691,8 @@ e_view_model_file_moved(int id, char *file)
D_ENTER;
if (!file || file[0] == '/') D_RETURN;
if (!file || file[0] == '/')
D_RETURN;
m = e_view_model_find_by_monitor_id(id);
for (l = m->views; l; l = l->next)
{
@ -703,6 +712,7 @@ e_view_model_find_by_monitor_id(int id)
{
E_View_Model *m;
Evas_List l;
D_ENTER;
for (l = VM->models; l; l = l->next)

View File

@ -22,7 +22,8 @@ e_embed_text_func_show(void *_data)
D_ENTER;
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);
D_RETURN;
@ -36,7 +37,8 @@ e_embed_text_func_hide(void *_data)
D_ENTER;
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);
D_RETURN;
@ -50,7 +52,8 @@ e_embed_text_func_move(void *_data, double x, double y)
D_ENTER;
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);
D_RETURN;
@ -64,7 +67,8 @@ e_embed_text_func_resize(void *_data, double w, double h)
D_ENTER;
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);
D_RETURN;
@ -78,7 +82,8 @@ e_embed_text_func_raise(void *_data)
D_ENTER;
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);
D_RETURN;
@ -92,7 +97,8 @@ e_embed_text_func_lower(void *_data)
D_ENTER;
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);
D_RETURN;
@ -106,7 +112,8 @@ e_embed_text_func_set_layer(void *_data, int l)
D_ENTER;
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);
D_RETURN;
@ -139,7 +146,8 @@ e_embed_text_func_set_clip(void *_data, Evas_Object clip)
}
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;
@ -162,8 +170,10 @@ e_embed_text_func_get_min_size(void *_data, double *w, double *h)
em = _data;
e_text_get_min_size(em->text_obj, w, h);
if (em->clip_x) *w = 0;
if (em->clip_y) *h = 0;
if (em->clip_x)
*w = 0;
if (em->clip_y)
*h = 0;
D_RETURN;
}
@ -177,8 +187,10 @@ e_embed_text_func_get_max_size(void *_data, double *w, double *h)
em = _data;
e_text_get_max_size(em->text_obj, w, h);
if (em->clip_x) *w = 999999999;
if (em->clip_y) *h = 999999999;
if (em->clip_x)
*w = 999999999;
if (em->clip_y)
*h = 999999999;
D_RETURN;
}
@ -186,7 +198,8 @@ e_embed_text_func_get_max_size(void *_data, double *w, double *h)
/***/
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;
@ -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_color_class,
e_embed_text_func_get_min_size,
e_embed_text_func_get_max_size,
em);
e_embed_text_func_get_max_size, em);
D_RETURN_(em);
}
@ -333,7 +345,8 @@ e_embed_image_func_set_clip(void *_data, Evas_Object clip)
}
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;
@ -358,8 +371,10 @@ e_embed_image_func_get_min_size(void *_data, double *w, double *h)
iw = 0;
ih = 0;
evas_get_image_size(em->evas, em->image_obj, &iw, &ih);
if (w) *w = iw;
if (h) *h = ih;
if (w)
*w = iw;
if (h)
*h = ih;
D_RETURN;
}
@ -374,8 +389,10 @@ e_embed_image_func_get_max_size(void *_data, double *w, double *h)
em = _data;
evas_get_image_size(em->evas, em->image_obj, &iw, &ih);
if (w) *w = iw;
if (h) *h = ih;
if (w)
*w = iw;
if (h)
*h = ih;
D_RETURN;
}
@ -383,7 +400,8 @@ e_embed_image_func_get_max_size(void *_data, double *w, double *h)
/***/
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;
@ -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_color_class,
e_embed_image_func_get_min_size,
e_embed_image_func_get_max_size,
em);
e_embed_image_func_get_max_size, em);
D_RETURN_(em);
}
@ -420,7 +437,8 @@ e_embed_free(Embed emb)
D_ENTER;
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);
D_RETURN;

View File

@ -6,8 +6,10 @@
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_image_object(Ebits_Object o, char *bit_name, Evas evas, Evas_Object image_obj);
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_image_object(Ebits_Object o, char *bit_name,
Evas evas, Evas_Object image_obj);
void e_embed_free(Embed em);
#endif

View File

@ -8,9 +8,12 @@ static Evas_List entries;
static void e_clear_selection(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_up_cb(void *_data, Evas _e, Evas_Object _o, 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_down_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,
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_realize(E_Entry * entry);
static void e_entry_unrealize(E_Entry * entry);
static void e_entry_configure(E_Entry * entry);
@ -80,7 +83,8 @@ e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
entry = _data;
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();
}
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 *entry;
/* int pos; */
D_ENTER;
entry = _data;
if (_b == entry->mouse_down) entry->mouse_down = 0;
if (_b == entry->mouse_down)
entry->mouse_down = 0;
e_entry_configure(entry);
D_RETURN;
@ -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)
{
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
{
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)
@ -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);
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);
free(str2);
}
@ -261,9 +270,12 @@ e_entry_realize(E_Entry *entry)
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->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_UP, e_entry_up_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_DOWN,
e_entry_down_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;
}
@ -273,12 +285,18 @@ e_entry_unrealize(E_Entry *entry)
{
D_ENTER;
if (entry->event_box) evas_del_object(entry->evas, entry->event_box);
if (entry->text) evas_del_object(entry->evas, entry->text);
if (entry->clip_box) 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);
if (entry->event_box)
evas_del_object(entry->evas, entry->event_box);
if (entry->text)
evas_del_object(entry->evas, entry->text);
if (entry->clip_box)
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->text = NULL;
entry->clip_box = NULL;
@ -297,33 +315,42 @@ e_entry_configure(E_Entry *entry)
D_ENTER;
if (!entry->evas) D_RETURN;
if (!entry->event_box) D_RETURN;
if (!entry->evas)
D_RETURN;
if (!entry->event_box)
D_RETURN;
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;
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)
{
ebits_move(entry->obj_base, entry->x, entry->y);
ebits_resize(entry->obj_base, entry->w, entry->h);
}
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_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);
evas_resize(entry->evas, entry->clip_box, entry->w - p1l - p1r,
entry->h - p1t - p1b);
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))
{
double tx, ty, tw, th;
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
{
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;
tw = entry->end_width;
}
@ -334,7 +361,9 @@ e_entry_configure(E_Entry *entry)
entry->scroll_pos = 0 - tx;
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_show(entry->obj_cursor);
}
@ -349,8 +378,11 @@ e_entry_configure(E_Entry *entry)
th = evas_get_text_height(entry->evas, entry->text);
if (entry->obj_cursor)
{
ebits_move(entry->obj_cursor, entry->x + tx + entry->scroll_pos + p1l, entry->y + p1t);
ebits_resize(entry->obj_cursor, entry->end_width + p2l + p2r, th + p2t + p2b);
ebits_move(entry->obj_cursor,
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);
}
}
@ -359,24 +391,34 @@ e_entry_configure(E_Entry *entry)
if (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)
{
double x1, y1, x2, tw, th;
evas_text_at(entry->evas, entry->text, entry->select.start, &x1, &y1, NULL, NULL);
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);
evas_text_at(entry->evas, entry->text, entry->select.start, &x1, &y1,
NULL, NULL);
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
{
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;
}
th = evas_get_text_height(entry->evas, entry->text);
if (entry->obj_selection)
{
ebits_move(entry->obj_selection, 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_move(entry->obj_selection,
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);
}
}
@ -395,7 +437,8 @@ e_entry_init(void)
D_ENTER;
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;
}
@ -435,7 +478,8 @@ e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
{
D_ENTER;
if (!entry->focused) D_RETURN;
if (!entry->focused)
D_RETURN;
if (!strcmp(e->key, "Up"))
{
}
@ -462,19 +506,24 @@ e_entry_handle_keypress(E_Entry *entry, Ecore_Event_Key_Down *e)
{
/* char *str2; */
if (entry->select.start >= 0) e_entry_clear_selection(entry);
else if (entry->cursor_pos > 0) e_entry_delete_to_left(entry);
if (entry->select.start >= 0)
e_entry_clear_selection(entry);
else if (entry->cursor_pos > 0)
e_entry_delete_to_left(entry);
}
else if (!strcmp(e->key, "Delete"))
{
/* char *str2; */
if (entry->select.start >= 0) e_entry_clear_selection(entry);
else if (entry->cursor_pos < (int)strlen(entry->buffer)) e_entry_delete_to_right(entry);
if (entry->select.start >= 0)
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"))
{
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();
}
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 */
{
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)
{
@ -552,7 +602,8 @@ e_entry_set_evas(E_Entry *entry, Evas evas)
{
D_ENTER;
if (entry->evas) e_entry_unrealize(entry);
if (entry->evas)
e_entry_unrealize(entry);
entry->evas = evas;
e_entry_realize(entry);
e_entry_configure(entry);
@ -570,12 +621,17 @@ e_entry_show(E_Entry *entry)
{
D_ENTER;
if (entry->visible) D_RETURN;
if (entry->visible)
D_RETURN;
entry->visible = 1;
if (!entry->evas) D_RETURN;
if (entry->obj_base) ebits_show(entry->obj_base);
if (entry->obj_cursor) ebits_show(entry->obj_cursor);
if (entry->obj_selection) ebits_show(entry->obj_selection);
if (!entry->evas)
D_RETURN;
if (entry->obj_base)
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->clip_box);
evas_show(entry->evas, entry->text);
@ -588,12 +644,17 @@ e_entry_hide(E_Entry *entry)
{
D_ENTER;
if (!entry->visible) D_RETURN;
if (!entry->visible)
D_RETURN;
entry->visible = 0;
if (!entry->evas) D_RETURN;
if (entry->obj_base) ebits_hide(entry->obj_base);
if (entry->obj_cursor) ebits_hide(entry->obj_cursor);
if (entry->obj_selection) ebits_hide(entry->obj_selection);
if (!entry->evas)
D_RETURN;
if (entry->obj_base)
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->clip_box);
evas_hide(entry->evas, entry->text);
@ -606,11 +667,14 @@ e_entry_raise(E_Entry *entry)
{
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->text);
if (entry->obj_selection) ebits_raise(entry->obj_selection);
if (entry->obj_cursor) ebits_raise(entry->obj_cursor);
if (entry->obj_selection)
ebits_raise(entry->obj_selection);
if (entry->obj_cursor)
ebits_raise(entry->obj_cursor);
evas_raise(entry->evas, entry->event_box);
D_RETURN;
@ -622,11 +686,14 @@ e_entry_lower(E_Entry *entry)
D_ENTER;
evas_lower(entry->evas, entry->event_box);
if (entry->obj_cursor) ebits_lower(entry->obj_cursor);
if (entry->obj_selection) ebits_lower(entry->obj_selection);
if (entry->obj_cursor)
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->clip_box);
if (entry->obj_base) ebits_lower(entry->obj_base);
if (entry->obj_base)
ebits_lower(entry->obj_base);
D_RETURN;
}
@ -636,11 +703,14 @@ e_entry_set_layer(E_Entry *entry, int l)
{
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->text, l);
if (entry->obj_selection) ebits_set_layer(entry->obj_selection, l);
if (entry->obj_cursor) ebits_set_layer(entry->obj_cursor, l);
if (entry->obj_selection)
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);
D_RETURN;
@ -703,12 +773,18 @@ e_entry_query_max_size(E_Entry *entry, int *w, int *h)
D_ENTER;
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;
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 (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
if (w)
*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;
}
@ -722,11 +798,16 @@ e_entry_max_size(E_Entry *entry, int *w, int *h)
D_ENTER;
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;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (w) *w = 8000;
if (h) *h = evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
if (entry->obj_cursor)
ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &p2t, &p2b);
if (w)
*w = 8000;
if (h)
*h =
evas_get_text_height(entry->evas, entry->text) + p1t + p1b + p2t + p2b;
D_RETURN;
}
@ -740,11 +821,16 @@ e_entry_min_size(E_Entry *entry, int *w, int *h)
D_ENTER;
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;
if (entry->obj_cursor) ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &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;
if (entry->obj_cursor)
ebits_get_insets(entry->obj_cursor, &p2l, &p2r, &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;
}
@ -758,9 +844,11 @@ e_entry_set_size(E_Entry *entry, int w, int h)
D_ENTER;
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;
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)
{
entry->min_size = w;
@ -776,7 +864,8 @@ e_entry_set_focus(E_Entry *entry, int focused)
{
D_ENTER;
if (entry->focused == focused) D_RETURN;
if (entry->focused == focused)
D_RETURN;
entry->focused = focused;
e_entry_configure(entry);
if (entry->focused)
@ -838,7 +927,9 @@ e_entry_get_cursor(E_Entry *entry)
}
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;
@ -849,7 +940,9 @@ e_entry_set_changed_callback(E_Entry *entry, void (*func) (E_Entry *_entry, 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;
@ -860,7 +953,9 @@ e_entry_set_enter_callback(E_Entry *entry, void (*func) (E_Entry *_entry, 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;
@ -871,7 +966,9 @@ e_entry_set_focus_in_callback(E_Entry *entry, void (*func) (E_Entry *_entry, voi
}
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;
@ -888,7 +985,8 @@ e_entry_insert_text(E_Entry *entry, char *text)
D_ENTER;
if (!text) D_RETURN;
if (!text)
D_RETURN;
str2 = malloc(strlen(e_entry_get_text(entry)) + 1 + strlen(text));
str2[0] = 0;
strncat(str2, entry->buffer, entry->cursor_pos);
@ -912,9 +1010,11 @@ e_entry_clear_selection(E_Entry *entry)
if (entry->select.start >= 0)
{
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;
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);
free(str2);
entry->cursor_pos = entry->select.start;
@ -968,7 +1068,8 @@ e_entry_get_selection(E_Entry *entry)
int len;
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;
str2 = e_util_memdup(&(entry->buffer[entry->select.start]), len + 1);
str2[len] = 0;

View File

@ -10,9 +10,11 @@ struct _E_Entry
Evas evas;
char *buffer;
int cursor_pos;
struct {
struct
{
int start, length, down;
} select;
}
select;
int mouse_down;
int visible;
int focused;
@ -38,7 +40,6 @@ struct _E_Entry
void *data_focus_out;
};
/**
* e_entry_init - Text entry widget event handler initialization.
*
@ -49,7 +50,8 @@ void e_entry_init(void);
void e_entry_free(E_Entry * entry);
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,
Ecore_Event_Key_Down * e);
void e_entry_set_evas(E_Entry * entry, Evas evas);
void e_entry_show(E_Entry * entry);
void e_entry_hide(E_Entry * entry);
@ -69,10 +71,24 @@ void e_entry_set_text(E_Entry *entry, const char *text);
const char *e_entry_get_text(E_Entry * entry);
void e_entry_set_cursor(E_Entry * entry, int cursor_pos);
int e_entry_get_cursor(E_Entry * entry);
void e_entry_set_changed_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), void *data);
void e_entry_set_enter_callback(E_Entry *entry, void (*func) (E_Entry *_entry, void *_data), 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_set_changed_callback(E_Entry * entry,
void (*func) (E_Entry * _entry,
void *_data),
void *data);
void e_entry_set_enter_callback(E_Entry * entry,
void (*func) (E_Entry * _entry,
void *_data),
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);

View File

@ -81,19 +81,23 @@ e_epplet_cleanup(E_Epplet *epp)
for (l = epp->ebits; l; l = l->next)
{
Ebits_Object o = l->data;
ebits_free(o);
}
for (l = epp->evas_objects; l; l = l->next)
{
Evas_Object_Wrapper *o = l->data;
evas_del_object(o->evas, o->obj);
free(o);
}
if (epp->layout) ebits_free(epp->layout);
if (epp->ui) ebits_free(epp->ui);
if (epp->layout)
ebits_free(epp->layout);
if (epp->ui)
ebits_free(epp->ui);
#endif
D_RETURN;
}
@ -152,8 +156,6 @@ e_epplet_load_from_layout (E_View * v)
D_RETURN;
}
E_Epplet_Context *
e_epplet_get_context_from_script(FeriteScript * script)
{
@ -176,6 +178,7 @@ e_epplet_get_context_from_script (FeriteScript * script)
for (ll = v->epplet_contexts; ll; ll = ll->next)
{
E_Epplet_Context *context = ll->data;
D("found script: %p\n", context->script);
if (context->script == script)
@ -187,7 +190,6 @@ e_epplet_get_context_from_script (FeriteScript * script)
D_RETURN_(NULL);
}
void
e_epplet_script_load(E_Epplet_Context * context, char *path)
{
@ -218,7 +220,6 @@ e_epplet_script_load (E_Epplet_Context * context, char *path)
D_RETURN;
}
void
e_epplet_set_common_callbacks(E_Epplet * epp)
{
@ -232,7 +233,6 @@ e_epplet_set_common_callbacks (E_Epplet * epp)
D_RETURN;
}
ebits_set_classed_bit_callback (epp->bits, "Title_Bar",
CALLBACK_MOUSE_DOWN, e_epplet_mouse_down_cb,
epp);
@ -351,8 +351,6 @@ e_epplet_mouse_down_cb (void *_data, Ebits_Object _o,
D_RETURN;
}
static void
e_epplet_mouse_up_cb(void *_data, Ebits_Object _o,
char *_c, int _b, int _x, int _y,
@ -490,9 +488,9 @@ e_epplet_mouse_move_cb (void *_data, Ebits_Object _o,
D_RETURN;
}
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;
FeriteNamespaceBucket *nsb;
@ -555,11 +553,16 @@ e_epplet_bits_cb (void *_data, Ebits_Object _o,
#ifdef USE_FERITE
cb = _data;
if (cb->script) {
if (cb->script)
{
D("creating params and calling func\n");
params = __ferite_create_parameter_list_from_data( cb->script, "osnnnnnnn",
cb->data, _c, _b, _x, _y, _ox, _oy, _ow, _oh );
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params));
params =
__ferite_create_parameter_list_from_data(cb->script, "osnnnnnnn",
cb->data, _c, _b, _x, _y,
_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");
}
@ -573,9 +576,7 @@ e_epplet_bits_cb (void *_data, Ebits_Object _o,
}
void
e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o,
int _b, int _x, int _y)
e_epplet_evas_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
E_Epplet_CB_Info *cb;
FeriteVariable **params;
@ -587,12 +588,18 @@ e_epplet_evas_cb (void *_data, Evas _e, Evas_Object _o,
D("d1: %s, d2: %s\n", cb->data->name, cb->data2->name);
if (cb->script) {
if (cb->script)
{
D("creating params\n");
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);
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params));
__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");
}
@ -617,12 +624,15 @@ e_epplet_timer_func(int val, void *data)
/* D("in timer func\n"); */
cb = data;
if (cb->script) {
if (cb->script)
{
/* D("creating params\n"); */
params = __ferite_create_parameter_list_from_data(cb->script, "on",
cb->data, (float)val);
/* D("calling func\n"); */
__ferite_variable_destroy( cb->script, __ferite_call_function( cb->script, cb->func, params));
__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"); */
}
@ -637,7 +647,8 @@ e_epplet_timer_func(int val, void *data)
}
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;
FeriteNamespaceBucket *nsb;
@ -703,10 +714,10 @@ e_epplet_observer_register_desktops(E_Epplet_Observer *obs)
for (l = e_desktops_get_desktops_list(); l; l = l->next)
{
E_Desktop *d = l->data;
D("registering desktop...\n")
e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(d));
D("desktop registered\n")
}
D("desktop registered\n")}
#endif
D_RETURN;
}
@ -721,17 +732,18 @@ e_epplet_observer_register_borders(E_Epplet_Observer *obs)
for (l = e_border_get_borders_list(); l; l = l->next)
{
E_Border *b = l->data;
D("registering desktop...\n")
e_observer_register_observee(E_OBSERVER(obs), E_OBSERVEE(b));
D("desktop registered\n")
}
D("desktop registered\n")}
#endif
D_RETURN;
}
#endif
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_Desktop *desk;
@ -750,10 +762,13 @@ e_epplet_desktop_observer_func(E_Observer *observer, E_Observee *observee, E_Eve
D("creating params\n");
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);
__ferite_variable_destroy( obs->script, __ferite_call_function(
obs->script, obs->func, params));
__ferite_variable_destroy(obs->script,
__ferite_call_function(obs->script, obs->func,
params));
D("function called\n");
__ferite_delete_parameter_list(obs->script, params);
D("func called, params deleted\n");
@ -789,8 +804,9 @@ e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee)
params = __ferite_create_parameter_list_from_data(obs->script, "o",
obs->data);
/*D("calling func: %s\n", obs->func->name); */
__ferite_variable_destroy( obs->script, __ferite_call_function(
obs->script, obs->func, params));
__ferite_variable_destroy(obs->script,
__ferite_call_function(obs->script, obs->func,
params));
/*D("function called\n"); */
__ferite_delete_parameter_list(obs->script, params);
/*D("func called, params deleted\n"); */
@ -803,4 +819,3 @@ e_epplet_border_observer_func(E_Observer *observer, E_Observee *observee)
D_RETURN;
}
#endif

View File

@ -37,13 +37,14 @@ struct _E_Epplet_Context
E_Epplet *epp;
struct {
struct
{
double x, y;
double w, h;
} geom;
}
geom;
};
struct _E_Epplet
{
E_Object o;
@ -56,19 +57,24 @@ struct _E_Epplet
Ebits_Object layout;
Ebits_Object ui;
struct {
struct
{
double x, y;
double w, h;
} current, requested, offset;
}
current , requested, offset;
struct {
struct
{
int changed;
int moving;
struct {
struct
{
int up, down, left, right;
}resizing;
} state;
}
resizing;
}
state;
Evas_List evas_objects;
Evas_List ebits;
@ -84,13 +90,13 @@ struct _Evas_Object_Wrapper
/* epplet loading / cleanup */
E_Epplet *e_epplet_new();
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,
char *script_path);
E_Epplet_Context *e_epplet_get_context_from_script(FeriteScript * script);
/* probably won't use this... */
void e_epplet_set_common_callbacks(E_Epplet * epp);
/* callbacks */
E_Epplet_CB_Info *e_epplet_cb_new(FeriteScript * script, char *func_name,
FeriteObject * data, FeriteObject * data2);
@ -107,7 +113,8 @@ void e_epplet_timer_func(int val, void *data);
E_Epplet_Observer *e_epplet_observer_new(FeriteScript * script,
char *func_name, FeriteObject * data,
char *event_type);
void e_epplet_observer_register_desktops(E_Epplet_Observer *obs);
void e_epplet_observer_register_desktops(E_Epplet_Observer *
obs);
void e_epplet_desktop_observer_func(E_Observer * observer,
E_Observee * observee,
E_Event_Type event);

View File

@ -152,7 +152,8 @@ 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)
e_exec_in_dir_with_env(char *exe, char *dir, int *launch_id_ret, char **env,
char *launch_path)
{
static int launch_id = 0;
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;
launch_id++;
if (launch_id_ret) *launch_id_ret = launch_id;
if (launch_id_ret)
*launch_id_ret = launch_id;
pid = fork();
if (pid) D_RETURN_(pid);
if (pid)
D_RETURN_(pid);
chdir(dir);
setsid();
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 */
/* have this launch Id number set on them - as well as process ID */
/* 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'",
launch_id, PACKAGE_LIB_DIR);
snprintf(preload, PATH_MAX, "LD_PRELOAD='libehack.so libX11.so libdl.so'");
exe2 = malloc(strlen(exe) + 1 +
strlen(preload_paths) + 1 +
strlen(preload) + 1);
strlen(preload_paths) + 1 + strlen(preload) + 1);
snprintf(exe2, PATH_MAX, "%s %s %s", preload_paths, preload, exe);
execl("/bin/sh", "/bin/sh", "-c", exe2, NULL);

View File

@ -3,13 +3,16 @@
#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_e_hack_found(Window win);
void e_exec_set_args(int argc, char **argv);
void e_exec_restart(void);
pid_t e_exec_run(char *exe);
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

View File

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

View File

@ -10,4 +10,3 @@ void e_focus_list_border_del(E_Border *b);
void e_focus_list_clear(void);
#endif

View File

@ -19,7 +19,8 @@ e_fs_flush_timeout(int val, void *data)
{
D_ENTER;
if (!ec) D_RETURN;
if (!ec)
D_RETURN;
if (efsd_commands_pending(ec) > 0)
{
if (efsd_flush(ec) > 0)
@ -55,7 +56,8 @@ e_fs_child_handle(Ecore_Event *ev)
if (e->pid == efsd_pid)
{
D("it was efsd!\n");
if (ec) efsd_close(ec);
if (ec)
efsd_close(ec);
ec = NULL;
efsd_pid = 0;
e_fs_restarter(1, NULL);
@ -117,7 +119,8 @@ e_fs_restarter(int val, void *data)
{
D_ENTER;
if (ec) D_RETURN;
if (ec)
D_RETURN;
ec = efsd_open();
@ -128,7 +131,8 @@ e_fs_restarter(int val, void *data)
efsd_pid = e_exec_run("efsd -f");
D("launch efsd... %i\n", efsd_pid);
}
if (efsd_pid > 0) ec = efsd_open();
if (efsd_pid > 0)
ec = efsd_open();
}
if (ec)
{
@ -148,8 +152,10 @@ e_fs_restarter(int val, void *data)
double gap;
gap = (double)val / 10;
if (gap > 10.0) gap = 10.0;
ecore_add_event_timer("e_fs_restarter", gap, e_fs_restarter, val + 1, NULL);
if (gap > 10.0)
gap = 10.0;
ecore_add_event_timer("e_fs_restarter", gap, e_fs_restarter, val + 1,
NULL);
}
D_RETURN;
@ -191,7 +197,8 @@ e_fs_add_event_handler(void (*func) (EfsdEvent *ev))
{
D_ENTER;
if (!func) D_RETURN;
if (!func)
D_RETURN;
fs_handlers = evas_list_append(fs_handlers, func);
D_RETURN;
@ -203,16 +210,16 @@ e_fs_init(void)
D_ENTER;
/* 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);
/* Also hook in an idle handler to flush efsd's
write queue.
FIXME: This should be handled by letting ecore
report when Efsd's file descriptor becomes
writeable, and then calling efsd_flush().
* write queue.
*
* FIXME: This should be handled by letting ecore
* report when Efsd's file descriptor becomes
* writeable, and then calling efsd_flush().
*/
ecore_event_filter_idle_handler_add(e_fs_idle, NULL);
e_fs_restarter(0, NULL);
@ -231,7 +238,6 @@ e_fs_cleanup(void)
D_RETURN;
}
EfsdConnection *
e_fs_get_connection(void)
{

View File

@ -28,7 +28,8 @@ void e_fs_init(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 *data);
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);

View File

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

View File

@ -17,7 +17,6 @@ typedef enum e_guides_location
}
E_Guides_Location;
/**
* 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);
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);
}
@ -118,7 +119,8 @@ e_icccm_delete(Window win)
num = size / sizeof(int);
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);
}
@ -242,7 +244,8 @@ e_icccm_get_pos_info(Window win, E_Border *b)
void
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;
int mask;
XSizeHints hint;
@ -272,22 +275,28 @@ e_icccm_get_size_info(Window win, E_Border *b)
{
max_w = hint.max_width;
max_h = hint.max_height;
if (max_w < min_w) max_w = min_w;
if (max_h < min_h) max_h = min_h;
if (max_w < min_w)
max_w = min_w;
if (max_h < min_h)
max_h = min_h;
}
if (hint.flags & PResizeInc)
{
step_w = hint.width_inc;
step_h = hint.height_inc;
if (step_w < 1) step_w = 1;
if (step_h < 1) step_h = 1;
if (step_w < 1)
step_w = 1;
if (step_h < 1)
step_h = 1;
}
if (hint.flags & PBaseSize)
{
base_w = hint.base_width;
base_h = hint.base_height;
if (base_w > max_w) max_w = base_w;
if (base_h > max_h) max_h = base_h;
if (base_w > max_w)
max_w = base_w;
if (base_h > max_h)
max_h = base_h;
}
else
{
@ -297,9 +306,11 @@ e_icccm_get_size_info(Window win, E_Border *b)
if (hint.flags & PAspect)
{
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)
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;
@ -328,7 +339,8 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
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)
{
int num;
@ -350,9 +362,12 @@ e_icccm_get_mwm_hints(Window win, E_Border *b)
b->client.handles = 1;
b->client.titlebar = 1;
}
if (mwmhints->decorations & MWM_DECOR_BORDER) b->client.border = 1;
if (mwmhints->decorations & MWM_DECOR_RESIZEH) b->client.handles = 1;
if (mwmhints->decorations & MWM_DECOR_TITLE) b->client.titlebar = 1;
if (mwmhints->decorations & MWM_DECOR_BORDER)
b->client.border = 1;
if (mwmhints->decorations & MWM_DECOR_RESIZEH)
b->client.handles = 1;
if (mwmhints->decorations & MWM_DECOR_TITLE)
b->client.titlebar = 1;
}
FREE(mwmhints);
}
@ -377,7 +392,8 @@ e_icccm_get_layer(Window win, E_Border *b)
int num;
num = size / sizeof(int);
if (num > 0) b->client.layer = props[0];
if (num > 0)
b->client.layer = props[0];
FREE(props);
}
@ -404,13 +420,14 @@ e_icccm_get_title(Window win, E_Border *b)
FREE(b->client.title);
}
b->client.title = NULL;
if (title) b->client.title = title;
else e_strdup(b->client.title, "No Title");
if (title)
b->client.title = title;
else
e_strdup(b->client.title, "No Title");
D_RETURN;
}
void
e_icccm_get_class(Window win, E_Border * b)
{
@ -421,8 +438,10 @@ e_icccm_get_class(Window win, E_Border *b)
b->client.name = NULL;
b->client.class = NULL;
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.class) e_strdup(b->client.class, "Unknown");
if (!b->client.name)
e_strdup(b->client.name, "Unknown");
if (!b->client.class)
e_strdup(b->client.class, "Unknown");
D_RETURN;
}
@ -435,8 +454,7 @@ e_icccm_get_hints(Window win, E_Border *b)
ecore_window_get_hints(win,
&(b->client.takes_focus),
&(b->client.initial_state),
NULL, NULL, NULL,
&(b->client.group));
NULL, NULL, NULL, &(b->client.group));
D_RETURN;
}
@ -482,7 +500,6 @@ e_icccm_get_state(Window win, E_Border *b)
{
D_ENTER;
D_RETURN;
UN(win);
UN(b);
@ -595,6 +612,7 @@ e_icccm_get_e_hack_launch_id(Window win, E_Border *b)
str = NEW(char, size + 1);
ZERO(str, char, size + 1);
memcpy(str, props, size);
b->client.e.launch_id = atoi(str);
FREE(str);
@ -633,16 +651,26 @@ e_icccm_handle_property_change(Atom a, E_Border *b)
ECORE_ATOM(a_wm_state, "WM_STATE");
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);
else if (a == a_motif_wm_hints) e_icccm_get_mwm_hints(b->win.client, b);
else if (a == a_wm_name) e_icccm_get_title(b->win.client, b);
else if (a == a_wm_class) e_icccm_get_class(b->win.client, b);
else if (a == a_wm_hints) 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);
if (a == a_wm_normal_hints)
e_icccm_get_size_info(b->win.client, b);
else if (a == a_motif_wm_hints)
e_icccm_get_mwm_hints(b->win.client, b);
else if (a == a_wm_name)
e_icccm_get_title(b->win.client, b);
else if (a == a_wm_class)
e_icccm_get_class(b->win.client, b);
else if (a == a_wm_hints)
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;
}
@ -661,7 +689,6 @@ e_icccm_advertise_e_compat(void)
{
D_ENTER;
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_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_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");
win = ecore_window_override_new(0, 0, 0, 7, 7);
props[0] = win;
ecore_window_property_set(win, a_win_supporting_wm_check, XA_CARDINAL, 32, props, 1);
ecore_window_property_set(0, a_win_supporting_wm_check, XA_CARDINAL, 32, props, 1);
ecore_window_property_set(win, a_win_supporting_wm_check, XA_CARDINAL, 32,
props, 1);
ecore_window_property_set(0, a_win_supporting_wm_check, XA_CARDINAL, 32,
props, 1);
D_RETURN;
}
@ -718,7 +749,6 @@ e_icccm_advertise_kde_compat(void)
{
D_ENTER;
D_RETURN;
}
@ -727,6 +757,5 @@ e_icccm_advertise_net_compat(void)
{
D_ENTER;
D_RETURN;
}

View File

@ -22,7 +22,8 @@ void e_icccm_get_machine(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_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_size(Window win, int ax, int ay);
void e_icccm_set_desk(Window win, int d);

View File

@ -13,10 +13,12 @@ static Evas_List iconbars = NULL;
/* internal func (iconbar use only) prototypes */
static void e_ib_bit_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_ib_bit_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_ib_bit_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_ib_bit_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 ib_scroll_timeout(int val, void *data);
static void ib_timeout(int val, void *data);
@ -35,14 +37,14 @@ static void ib_bits_set_color_class (void *data, char *cc, int r, int g,
static void ib_bits_get_min_size(void *data, double *w, double *h);
static void ib_bits_get_max_size(void *data, double *w, double *h);
static void ib_mouse_in (void *data, Evas _e, Evas_Object _o, int _b, int _x,
int _y);
static void ib_mouse_out (void *data, Evas _e, Evas_Object _o, int _b, int _x,
int _y);
static void ib_mouse_in(void *data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void ib_mouse_out(void *data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void ib_mouse_down(void *data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void ib_mouse_up (void *data, Evas _e, Evas_Object _o, int _b, int _x,
int _y);
static void ib_mouse_up(void *data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void ib_mouse_move(void *data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
@ -172,11 +174,9 @@ e_iconbar_cleanup (E_Iconbar * ib)
/* call the destructor of the base class */
e_object_cleanup(E_OBJECT(ib));
D_RETURN;
}
/**
* e_iconbar_init - Init function
*
@ -311,7 +311,6 @@ e_iconbar_new (E_View * v)
D_RETURN_(ib);
}
/**
* e_iconbar_icon_cleanup -- Iconbar icon destructor
* @ic: The icon that is to be freed
@ -433,8 +432,7 @@ e_iconbar_realize (E_Iconbar * ib)
ib_bits_set_layer,
ib_bits_set_clip,
ib_bits_set_color_class,
ib_bits_get_min_size,
ib_bits_get_max_size, ib);
ib_bits_get_min_size, ib_bits_get_max_size, ib);
/* now move this ebit to a really high layer.. so its ontop of a lot */
ebits_set_layer(ib->bit, 10000);
/* and now call "fix" - i called it fix cause it does a few things... */
@ -725,8 +723,8 @@ e_iconbar_save_out_final (E_Iconbar * ib)
if (ic->imlib_image)
{
imlib_context_set_image(ic->imlib_image);
imlib_image_attach_data_value ("compression", NULL,
9, NULL);
imlib_image_attach_data_value("compression",
NULL, 9, NULL);
imlib_image_set_format("db");
snprintf(buf2, PATH_MAX,
@ -752,7 +750,7 @@ e_iconbar_save_out_final (E_Iconbar * ib)
E_DB_FLOAT_SET(buf, "/scroll", ib->scroll);
}
/*D ("set just_saved\n");
ib->just_saved = 1;*/
* ib->just_saved = 1; */
ib->changed = 0;
}
@ -925,8 +923,7 @@ ib_timeout (int val, void *data)
evas_set_image_fill(ic->iconbar->view->evas, ic->hi.image, 0, 0, nw,
nh);
/* set its fade */
evas_set_color (ic->iconbar->view->evas, ic->hi.image, 255, 255, 255,
a);
evas_set_color(ic->iconbar->view->evas, ic->hi.image, 255, 255, 255, a);
/* incirment our count */
val++;
}
@ -1131,7 +1128,6 @@ ib_bits_set_clip (void *data, Evas_Object clip)
{
D_ENTER;
D_RETURN;
UN(data);
UN(clip);
@ -1143,7 +1139,6 @@ ib_bits_set_color_class (void *data, char *cc, int r, int g, int b, int a)
{
D_ENTER;
D_RETURN;
UN(data);
UN(cc);
@ -1179,10 +1174,6 @@ ib_bits_get_max_size (void *data, double *w, double *h)
UN(data);
}
/* called on events on icons */
/* called when a mouse goes in on an icon object */
@ -1215,7 +1206,6 @@ ib_mouse_in (void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
/* a redraw is needed */
ic->iconbar->view->changed = 1;
D_RETURN;
UN(_e);
UN(_o);
@ -1299,8 +1289,8 @@ ib_mouse_up (void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
char buf[PATH_MAX];
ic->launch_id_cb =
e_exec_broadcast_cb_add (e_iconbar_handle_launch_id,
ic);
e_exec_broadcast_cb_add
(e_iconbar_handle_launch_id, ic);
snprintf(buf, PATH_MAX, "iconbar_launch_wait:%i",
ic->launch_id);
if (ic->wait_timeout > 0.0)
@ -1314,8 +1304,8 @@ ib_mouse_up (void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
evas_set_color(ic->iconbar->view->evas, ic->image,
255, 255, 255, 50);
if (ic->hi.image)
evas_set_color (ic->iconbar->view->evas, ic->hi.image,
255, 255, 255, 0);
evas_set_color(ic->iconbar->view->evas,
ic->hi.image, 255, 255, 255, 0);
}
}
}
@ -1369,14 +1359,12 @@ ib_mouse_move (void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
{
int dx, dy;
ic->mouse.x = _x;
ic->mouse.y = _y;
dx = ic->down.x - ic->mouse.x;
dy = ic->down.y - ic->mouse.y;
if (dx > 3 || dx < -3 || dy > 3 || dy < -3)
{
ic->moving = 1;
@ -1397,7 +1385,6 @@ ib_mouse_move (void *data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
UN(_y);
}
void
e_iconbar_icon_move(E_Iconbar_Icon * ic, int x, int y)
{
@ -1477,8 +1464,7 @@ e_iconbar_icon_move (E_Iconbar_Icon *ic, int x, int y)
}
/* place after icon */
else if (x < lic->current.x + lic->current.w
&& x >
lic->current.x + (lic->current.w / 2))
&& x > lic->current.x + (lic->current.w / 2))
{
ic->iconbar->icons =
evas_list_remove(ic->iconbar->icons, ic);
@ -1497,7 +1483,6 @@ e_iconbar_icon_move (E_Iconbar_Icon *ic, int x, int y)
lic);
}
}
/* vertical */
else
@ -1514,8 +1499,7 @@ e_iconbar_icon_move (E_Iconbar_Icon *ic, int x, int y)
}
/* place after icon */
else if (y < lic->current.y + lic->current.h
&& y >
lic->current.y + (lic->current.h / 2))
&& y > lic->current.y + (lic->current.h / 2))
{
ic->iconbar->icons =
evas_list_remove(ic->iconbar->icons, ic);
@ -1549,7 +1533,6 @@ e_iconbar_icon_move (E_Iconbar_Icon *ic, int x, int y)
D_RETURN;
}
/* called when a dnd drop occurs on an iconbar */
void
e_iconbar_dnd_add_files(E_View * v, E_View * source, int num_files,
@ -1587,12 +1570,15 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
if (ibic)
{
if (v->iconbar->dnd.x > ibic->current.x &&
v->iconbar->dnd.x < ibic->current.x + ibic->current.w &&
v->iconbar->dnd.y > ibic->current.y &&
v->iconbar->dnd.y < ibic->current.y + ibic->current.h )
v->iconbar->dnd.x <
ibic->current.x + ibic->current.w
&& v->iconbar->dnd.y > ibic->current.y
&& v->iconbar->dnd.y <
ibic->current.y + ibic->current.h)
{
D("over icon: %s\n", ibic->exec);
snprintf(buf, PATH_MAX, "%s/%s:/icon/normal", ic->view->model->dir, ic->file);
snprintf(buf, PATH_MAX, "%s/%s:/icon/normal",
ic->view->model->dir, ic->file);
D("set icon: %s\n", buf);
ibic->imlib_image = imlib_load_image(buf);
@ -1628,16 +1614,17 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
ibic = NEW(E_Iconbar_Icon, 1);
ZERO(ibic, E_Iconbar_Icon, 1);
e_object_init (E_OBJECT (ibic),
(E_Cleanup_Func) e_iconbar_icon_cleanup);
e_object_init(E_OBJECT(ibic), (E_Cleanup_Func) e_iconbar_icon_cleanup);
if (v->iconbar)
ibic->iconbar = v->iconbar;
else
D("EEEEEEEEEEEEK: how the hell did this happen?");
D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x, v->model->dir, ibic->iconbar->view->model->dir);
D("x: %f, v-dir: %s, ib-dir: %s\n", ibic->iconbar->icon_area.x,
v->model->dir, ibic->iconbar->view->model->dir);
if (!ic->info.icon) D_RETURN;
if (!ic->info.icon)
D_RETURN;
snprintf(buf, PATH_MAX, "%s:/icon/normal", ic->info.icon);
ibic->image = evas_add_image_from_file(v->evas, buf);
ibic->imlib_image = imlib_load_image(buf);
@ -1669,7 +1656,6 @@ e_iconbar_dnd_add_files (E_View *v, E_View *source, int num_files,
#endif
}
/* called when child processes exit */
static void
ib_child_handle(Ecore_Event * ev)

View File

@ -9,6 +9,7 @@
#include "resist.h"
typedef struct _E_Iconbar_Icon E_Iconbar_Icon;
#ifndef E_ICONBAR_TYPEDEF
#define E_ICONBAR_TYPEDEF
typedef struct _E_Iconbar E_Iconbar;
@ -34,13 +35,17 @@ struct _E_Iconbar
float scroll;
Ebits_Object *bit;
struct {
struct
{
double x, y, w, h;
} icon_area;
}
icon_area;
struct {
struct
{
int x, y;
} dnd;
}
dnd;
};
struct _E_Iconbar_Icon
@ -56,20 +61,26 @@ struct _E_Iconbar_Icon
char *exec;
int hilited;
struct {
struct
{
Evas_Object image;
char *timer;
double start;
} hi;
}
hi;
struct {
struct
{
double x, y;
} down, mouse;
}
down , mouse;
struct {
struct
{
double x, y;
double w, h;
} current;
}
current;
int mouse_down;
int moving;

View File

@ -9,12 +9,16 @@
#include "e_view_machine.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_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y);
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 e_icon_down_cb(void *_data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void e_icon_up_cb(void *_data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
static void e_icon_in_cb(void *_data, Evas _e, Evas_Object _o, int _b,
int _x, int _y);
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
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;
ev = e_view_get_current_event();
if (!ev) D_RETURN;
if (!ev)
D_RETURN;
e = ev->event;
ic = _data;
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;
ev = e_view_get_current_event();
if (!ev) D_RETURN;
if (!ev)
D_RETURN;
e = ev->event;
ic = _data;
if (ic->view->drag.started)
@ -172,9 +178,11 @@ e_icon_out_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
}
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;
D_ENTER;
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)
continue;
evas_get_geometry(ic->view->evas,
ic->obj.icon,
&ix, &iy, NULL, NULL);
evas_get_geometry(ic->view->evas, ic->obj.icon, &ix, &iy, NULL, NULL);
icx = ix + v->location.x - wx;
icy = iy + v->location.y - wy;
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();
imlib_context_set_image(im);
imlib_blend_image_onto_image(im2, 1,
0, 0, iw, ih,
icx, icy, iw, ih);
0, 0, iw, ih, icx, icy, iw, ih);
imlib_context_set_image(im2);
imlib_free_image();
imlib_context_set_image(im);
@ -239,8 +244,6 @@ _paint_selected_icons_onto_drag_window(E_View *v, Imlib_Image im, int wx, int wy
D_RETURN;
}
static void
_start_drag(E_View * v, int _x, int _y)
{
@ -249,7 +252,8 @@ _start_drag(E_View *v, int _x, int _y)
int x, y, xx, yy, rw, rh, downx, downy, wx, wy, ww, wh;
int dx, dy;
if (!v) D_RETURN;
if (!v)
D_RETURN;
dx = abs(v->select.down.x - _x);
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;
iw = ic->geom.w;
ih = ic->geom.h;
if (ix < x) x = ix;
if (iy < y) y = iy;
if ((ix + iw) > xx) xx = ix + iw;
if ((iy + ih) > yy) yy = iy + ih;
if (ix < x)
x = ix;
if (iy < y)
y = iy;
if ((ix + iw) > xx)
xx = ix + iw;
if ((iy + ih) > yy)
yy = iy + ih;
}
}
}
@ -311,7 +319,8 @@ _start_drag(E_View *v, int _x, int _y)
v->drag.offset.x = downx - v->drag.x;
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);
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);
imlib_context_set_image(im);
if (ww * wh < (200 * 200)) imlib_context_set_dither_mask(1);
else imlib_context_set_dither_mask(0);
if (ww * wh < (200 * 200))
imlib_context_set_dither_mask(1);
else
imlib_context_set_dither_mask(0);
imlib_context_set_dither(1);
imlib_context_set_drawable(pmap);
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;
Ecore_Event *ev;
Ecore_Event_Mouse_Move *e;
D_ENTER;
ev = e_view_get_current_event();
@ -413,7 +425,6 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
UN(_b);
}
static void
e_icon_cleanup(E_Icon * ic)
{
@ -428,10 +439,14 @@ e_icon_cleanup(E_Icon *ic)
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.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);
if (ic->obj.sel.under.icon)
ebits_free(ic->obj.sel.under.icon);
if (ic->obj.sel.under.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));
@ -453,8 +468,6 @@ e_icon_new(void)
D_RETURN_(ic);
}
E_Icon *
e_icon_find_by_file(E_View * view, char *file)
{
@ -467,7 +480,8 @@ e_icon_find_by_file(E_View *view, char *file)
E_Icon *ic;
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_(NULL);
@ -478,7 +492,8 @@ e_icon_show(E_Icon *ic)
{
D_ENTER;
if (ic->state.visible) D_RETURN;
if (ic->state.visible)
D_RETURN;
ic->state.visible = 1;
if (!ic->obj.event1)
{
@ -486,16 +501,26 @@ e_icon_show(E_Icon *ic)
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.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_UP, e_icon_up_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_OUT, e_icon_out_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.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_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_UP,
e_icon_up_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_OUT,
e_icon_out_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.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);
e_text_set_layer(ic->obj.text, 200);
@ -515,7 +540,8 @@ e_icon_hide(E_Icon *ic)
{
D_ENTER;
if (!ic->state.visible) D_RETURN;
if (!ic->state.visible)
D_RETURN;
ic->state.visible = 0;
evas_hide(ic->view->evas, ic->obj.icon);
e_text_hide(ic->obj.text);
@ -523,10 +549,14 @@ e_icon_hide(E_Icon *ic)
evas_hide(ic->view->evas, ic->obj.event2);
/* Hide any selection in the view */
if(ic->obj.sel.under.icon) ebits_hide(ic->obj.sel.under.icon);
if(ic->obj.sel.under.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);
if (ic->obj.sel.under.icon)
ebits_hide(ic->obj.sel.under.icon);
if (ic->obj.sel.under.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;
}
@ -536,7 +566,8 @@ e_icon_hide_delete_pending(E_Icon *ic)
{
D_ENTER;
if (!ic->state.visible) D_RETURN;
if (!ic->state.visible)
D_RETURN;
if (ic->state.selected)
{
if (ic->view->drag.drop_mode == E_DND_MOVE)
@ -560,10 +591,12 @@ e_icon_show_delete_end(E_Icon *ic, E_dnd_enum dnd_pending_mode)
{
D_ENTER;
if (!ic->state.visible) D_RETURN;
if (!ic->state.visible)
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;
if (dnd_pending_mode == E_DND_COPIED)
@ -584,8 +617,10 @@ e_icon_apply_xy(E_Icon *ic)
/* Ig */
/* [txt] */
if (ic->geom.text.w > ic->geom.icon.w) ic->geom.w = ic->geom.text.w;
else ic->geom.w = ic->geom.icon.w;
if (ic->geom.text.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;
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,
ic->geom.text.w, ic->geom.text.h);
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);
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.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
ic->view->scroll.x + ic->geom.x +
((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,
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);
e_text_move(ic->obj.text,
ic->view->scroll.x + ic->geom.x + ((ic->geom.w - ic->geom.text.w) / 2),
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h + ic->view->spacing.icon.g);
ic->view->scroll.x + ic->geom.x +
((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)
{
int pl, pr, pt, pb;
ebits_get_insets(ic->obj.sel.under.icon, &pl, &pr, &pt, &pb);
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);
ebits_resize(ic->obj.sel.under.icon,
ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
ebits_resize(ic->obj.sel.under.icon, ic->geom.icon.w + pl + pr,
ic->geom.icon.h + pt + pb);
ebits_show(ic->obj.sel.under.icon);
}
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_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.y + ic->geom.y + ic->geom.icon.h + 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);
ic->view->scroll.x + ic->geom.x +
((ic->geom.w - ic->geom.text.w) / 2) - pl,
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h +
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);
}
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_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);
ebits_resize(ic->obj.sel.over.icon,
ic->geom.icon.w + pl + pr, ic->geom.icon.h + pt + pb);
ebits_resize(ic->obj.sel.over.icon, ic->geom.icon.w + pl + pr,
ic->geom.icon.h + pt + pb);
ebits_show(ic->obj.sel.over.icon);
}
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_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.y + ic->geom.y + ic->geom.icon.h + 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);
ic->view->scroll.x + ic->geom.x +
((ic->geom.w - ic->geom.text.w) / 2) - pl,
ic->view->scroll.y + ic->geom.y + ic->geom.icon.h +
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);
}
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 */
//e_view_queue_icon_xy_record(ic->view);
}
if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0;
else if (ic->geom.y != ic->prev_geom.y) 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;
if (ic->geom.x != ic->prev_geom.x)
ic->view->extents.valid = 0;
else if (ic->geom.y != ic->prev_geom.y)
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.x = ic->geom.x;
@ -672,7 +723,6 @@ e_icon_apply_xy(E_Icon *ic)
D_RETURN;
}
void
e_icon_check_permissions(E_Icon * ic)
{
@ -692,15 +742,13 @@ e_icon_check_permissions(E_Icon *ic)
D_RETURN;
}
void
e_icon_initial_show(E_Icon * ic)
{
D_ENTER;
/* check if we have enuf info and we havent been shown yet */
if ( !ic->file->info.icon || !ic->obj.icon
|| ic->state.visible)
if (!ic->file->info.icon || !ic->obj.icon || ic->state.visible)
D_RETURN;
/* first. lets figure out the size of the icon */
@ -733,6 +781,7 @@ e_icon_update_state(E_Icon *ic)
{
char icon[PATH_MAX];
int iw, ih;
D_ENTER;
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);
}
if ((ic->state.selected) &&
(!ic->obj.sel.under.icon) &&
(!ic->obj.sel.over.icon))
(!ic->obj.sel.under.icon) && (!ic->obj.sel.over.icon))
{
char file[PATH_MAX];
@ -790,13 +838,16 @@ e_icon_update_state(E_Icon *ic)
}
}
else if ((!ic->state.selected) &&
((ic->obj.sel.under.icon) ||
(ic->obj.sel.over.icon)))
((ic->obj.sel.under.icon) || (ic->obj.sel.over.icon)))
{
if (ic->obj.sel.under.icon) ebits_free(ic->obj.sel.under.icon);
if (ic->obj.sel.under.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);
if (ic->obj.sel.under.icon)
ebits_free(ic->obj.sel.under.icon);
if (ic->obj.sel.under.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.text = NULL;
ic->obj.sel.over.icon = NULL;
@ -817,14 +868,15 @@ e_icon_update_state(E_Icon *ic)
D_RETURN;
}
void
e_icon_invert_selection(E_Icon * ic)
{
D_ENTER;
if (ic->state.selected) e_icon_deselect(ic);
else e_icon_select(ic);
if (ic->state.selected)
e_icon_deselect(ic);
else
e_icon_select(ic);
D_RETURN;
}

View File

@ -22,20 +22,27 @@ struct _E_Icon
E_File *file;
E_View *view;
struct {
struct
{
Evas_Object icon;
Evas_Object event1;
Evas_Object event2;
E_Text *text;
struct {
struct {
struct
{
struct
{
Ebits_Object icon;
Ebits_Object text;
} over, under;
} sel;
} obj;
}
over , under;
}
sel;
}
obj;
struct {
struct
{
int hilited;
int clicked;
int selected;
@ -45,26 +52,34 @@ struct _E_Icon
int just_selected;
int just_executed;
int drag_delete;
} state;
}
state;
struct {
struct
{
int x, y, w, h;
struct {
struct
{
int w, h;
} icon;
struct {
}
icon;
struct
{
int w, h;
} text;
} geom, prev_geom;
}
text;
}
geom , prev_geom;
struct {
struct
{
int write_xy;
} q;
}
q;
int changed;
};
E_Icon *e_icon_new(void);
void e_icon_update_state(E_Icon * ic);
void e_icon_invert_selection(E_Icon * ic);
@ -87,7 +102,8 @@ E_Icon *e_icon_find_by_file(E_View *view, char *file);
void e_icon_show(E_Icon * ic);
void e_icon_hide(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,
E_dnd_enum dnd_pending_mode);
void e_icon_apply_xy(E_Icon * ic);
void e_icon_check_permissions(E_Icon * ic);

View File

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

View File

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

View File

@ -32,7 +32,8 @@ static void cb_exit(void);
static void wm_running_error(Display * d, XErrorEvent * ev);
static void setup(void);
static void cb_exit(void)
static void
cb_exit(void)
{
D_ENTER;
@ -42,7 +43,6 @@ static void cb_exit(void)
D_RETURN;
}
static void
wm_running_error(Display * d, XErrorEvent * ev)
{
@ -94,15 +94,13 @@ main(int argc, char **argv)
if (((!strcmp("-d", argv[i]))
|| (!strcmp("-disp", argv[i]))
|| (!strcmp("-display", argv[i]))
|| (!strcmp("--display", argv[i])))
&& (argc - i > 1))
|| (!strcmp("--display", argv[i]))) && (argc - i > 1))
{
display = argv[++i];
}
else if ((!strcmp("-h", 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"
"\t[-d | -disp | -display --display] display_name \n"

View File

@ -11,38 +11,61 @@ e_match_set_props(E_Border *b)
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"));
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));
if (!ok)
{
e_db_close(db);
D_RETURN;
}
snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore", 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);
snprintf(buf, PATH_MAX, "match/%s/%s/prog_location/ignore", 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.matched = (int)b->client.matched.border.style;
snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name, b->client.class);
b->client.matched.location.matched = e_db_int_get(db, buf, &(b->client.matched.location.x));
snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name, b->client.class);
b->client.matched.location.matched = e_db_int_get(db, buf, &(b->client.matched.location.y));
snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/x", b->client.name, b->client.class);
b->client.matched.desk_area.matched = e_db_int_get(db, buf, &(b->client.matched.desk_area.x));
snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/y", b->client.name, b->client.class);
b->client.matched.desk_area.matched = e_db_int_get(db, buf, &(b->client.matched.desk_area.y));
snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name, 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));
snprintf(buf, PATH_MAX, "match/%s/%s/location/x", b->client.name,
b->client.class);
b->client.matched.location.matched =
e_db_int_get(db, buf, &(b->client.matched.location.x));
snprintf(buf, PATH_MAX, "match/%s/%s/location/y", b->client.name,
b->client.class);
b->client.matched.location.matched =
e_db_int_get(db, buf, &(b->client.matched.location.y));
snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/x", b->client.name,
b->client.class);
b->client.matched.desk_area.matched =
e_db_int_get(db, buf, &(b->client.matched.desk_area.x));
snprintf(buf, PATH_MAX, "match/%s/%s/desk_area/y", b->client.name,
b->client.class);
b->client.matched.desk_area.matched =
e_db_int_get(db, buf, &(b->client.matched.desk_area.y));
snprintf(buf, PATH_MAX, "match/%s/%s/size/w", b->client.name,
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)
{
@ -63,8 +86,12 @@ e_match_set_props(E_Border *b)
}
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.y += (b->client.matched.desk_area.y - b->desk->desk.area.y) * b->desk->real.h;
b->client.pos.x +=
(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.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.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)
{
b->client.desk = b->client.matched.desktop.desk;
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;
}
if (b->client.matched.sticky.matched)
@ -103,28 +132,35 @@ e_match_save_props(E_Border *b)
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"));
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);
if (b->client.matched.location.matched)
{
b->client.matched.location.x = b->current.x;
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);
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);
}
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);
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);
}
@ -132,51 +168,61 @@ e_match_save_props(E_Border *b)
{
b->client.matched.size.w = b->client.w;
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);
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);
}
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);
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);
}
if (b->client.matched.desktop.matched)
{
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);
}
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);
}
if (b->client.matched.sticky.matched)
{
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);
}
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);
}
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);
}
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);
}

View File

@ -9,4 +9,3 @@ void e_match_set_props(E_Border *b);
void e_match_save_props(E_Border * b);
#endif

View File

@ -64,7 +64,8 @@ e_scroller_timer(int val, void *data)
}
if (scroll)
{
if (scroll > scroll_speed) scroll = scroll_speed;
if (scroll > scroll_speed)
scroll = scroll_speed;
e_menu_scroll_all_by(-scroll, 0);
ok = 1;
}
@ -83,7 +84,8 @@ e_scroller_timer(int val, void *data)
}
if (scroll)
{
if (scroll > scroll_speed) scroll = scroll_speed;
if (scroll > scroll_speed)
scroll = scroll_speed;
e_menu_scroll_all_by(scroll, 0);
ok = 1;
}
@ -102,7 +104,8 @@ e_scroller_timer(int val, void *data)
}
if (scroll)
{
if (scroll > scroll_speed) scroll = scroll_speed;
if (scroll > scroll_speed)
scroll = scroll_speed;
e_menu_scroll_all_by(0, -scroll);
ok = 1;
}
@ -121,13 +124,15 @@ e_scroller_timer(int val, void *data)
}
if (scroll)
{
if (scroll > scroll_speed) scroll = scroll_speed;
if (scroll > scroll_speed)
scroll = scroll_speed;
e_menu_scroll_all_by(0, scroll);
ok = 1;
}
}
if ((ok) && (open_menus))
ecore_add_event_timer("menu_scroller", 0.02, e_scroller_timer, val + 1, NULL);
ecore_add_event_timer("menu_scroller", 0.02, e_scroller_timer, val + 1,
NULL);
D_RETURN;
UN(data);
@ -230,7 +235,8 @@ e_key_down(Ecore_Event * ev)
e = ev->event;
ok = 0;
if (e->win == menu_event_win) ok = 1;
if (e->win == menu_event_win)
ok = 1;
else
{
Evas_List l;
@ -385,14 +391,15 @@ e_mouse_up(Ecore_Event * ev)
{
m = l->data;
/* Ensure that the item is actually selected and
that the mouse pointer really is over it: */
* that the mouse pointer really is over it: */
if (m->selected)
{
if (INTERSECTS(m->selected->x + m->current.x,
m->selected->y + m->current.y,
m->selected->size.w,
m->selected->size.h + m->sel_border.b,
mouse_x, mouse_y, 0, 0))
m->selected->size.h +
m->sel_border.b, mouse_x, mouse_y, 0,
0))
{
e_menu_callback_item(m, m->selected);
}
@ -440,8 +447,7 @@ e_mouse_move(Ecore_Event * ev)
m = l->data;
evas_event_move(m->evas,
e->rx - m->current.x,
e->ry - m->current.y);
e->rx - m->current.x, e->ry - m->current.y);
}
}
else
@ -457,8 +463,7 @@ e_mouse_move(Ecore_Event * ev)
m = l->data;
evas_event_move(m->evas,
e->rx - m->current.x,
e->ry - m->current.y);
e->rx - m->current.x, e->ry - m->current.y);
}
}
e_scroller_timer(0, NULL);
@ -673,20 +678,24 @@ e_menu_callback_item(E_Menu *m, E_Menu_Item *mi)
{
D_ENTER;
if (mi->func_select) mi->func_select(m, mi, mi->func_select_data);
if (mi->func_select)
mi->func_select(m, mi, mi->func_select_data);
D_RETURN;
}
void
e_menu_hide_callback(E_Menu *m, void (*func) (E_Menu *m, void *data), void *data)
e_menu_hide_callback(E_Menu * m, void (*func) (E_Menu * m, void *data),
void *data)
{
m->func_hide = func;
m->func_hide_data = data;
}
void
e_menu_item_set_callback(E_Menu_Item *mi, void (*func) (E_Menu *m, E_Menu_Item *mi, void *data), void *data)
e_menu_item_set_callback(E_Menu_Item * mi,
void (*func) (E_Menu * m, E_Menu_Item * mi,
void *data), void *data)
{
D_ENTER;
@ -807,8 +816,11 @@ e_menu_select(int dx, int dy)
if (mi->submenu && mi->submenu->entries)
{
e_menu_move_to(mi->submenu,
mi->menu->current.x + mi->menu->current.w,
mi->menu->current.y + mi->y - mi->menu->border.t);
mi->menu->current.x +
mi->menu->current.w,
mi->menu->current.y +
mi->y -
mi->menu->border.t);
e_menu_show(mi->submenu);
}
}
@ -822,8 +834,10 @@ e_menu_select(int dx, int dy)
int ok = 0;
/* Only carry on if appropriate submenus exist: */
if ((dx < 0) && (l->prev)) ok = 1;
else if ((dx > 0) && (l->next)) ok = 1;
if ((dx < 0) && (l->prev))
ok = 1;
else if ((dx > 0) && (l->next))
ok = 1;
if (ok)
{
E_Menu_Item *mi = NULL;
@ -840,7 +854,8 @@ e_menu_select(int dx, int dy)
E_Menu_Item *mmi;
mmi = ll->data;
if (mmi->submenu == m) mi = mmi;
if (mmi->submenu == m)
mi = mmi;
}
}
/* Moving into a submenu: */
@ -861,8 +876,10 @@ e_menu_select(int dx, int dy)
if (mi->submenu && mi->submenu->entries)
{
e_menu_move_to(mi->submenu,
mi->menu->current.x + mi->menu->current.w,
mi->menu->current.y + mi->y - mi->menu->border.t);
mi->menu->current.x +
mi->menu->current.w,
mi->menu->current.y + mi->y -
mi->menu->border.t);
e_menu_show(mi->submenu);
}
e_menu_update_visibility(mm);
@ -888,7 +905,8 @@ e_menu_select(int dx, int dy)
{
e_menu_move_to(mi->submenu,
mi->menu->current.x + mi->menu->current.w,
mi->menu->current.y + mi->y - mi->menu->border.t);
mi->menu->current.y + mi->y -
mi->menu->border.t);
e_menu_show(mi->submenu);
}
}
@ -926,13 +944,16 @@ e_menu_event_win_show(void)
if (!menu_event_win)
{
menu_event_win = ecore_window_input_new(0, 0, 0, screen_w, screen_h);
ecore_window_set_events(menu_event_win, XEV_MOUSE_MOVE | XEV_BUTTON | XEV_IN_OUT | XEV_KEY);
ecore_window_set_events(menu_event_win,
XEV_MOUSE_MOVE | XEV_BUTTON | XEV_IN_OUT |
XEV_KEY);
ecore_window_show(menu_event_win);
ecore_keyboard_grab(menu_event_win);
ecore_grab_mouse(menu_event_win, 1, 0);
}
/* raise it */
if (menu_event_win) ecore_window_raise(menu_event_win);
if (menu_event_win)
ecore_window_raise(menu_event_win);
if ((!ecore_grab_window_get()) || (!ecore_keyboard_grab_window_get()))
{
Evas_List l;
@ -942,7 +963,8 @@ e_menu_event_win_show(void)
E_Menu *m;
m = l->data;
if (m->current.visible) e_menu_hide(m);
if (m->current.visible)
e_menu_hide(m);
}
e_menu_event_win_hide();
}
@ -988,14 +1010,17 @@ e_menu_set_background(E_Menu *m)
part = "base.bits.db";
snprintf(buf, PATH_MAX, "%s%s", menus, part);
if ((m->bg_file) && (!strcmp(m->bg_file, buf))) D_RETURN;
if ((m->bg_file) && (!strcmp(m->bg_file, buf)))
D_RETURN;
IF_FREE(m->bg_file);
m->bg_file = strdup(buf);
if (m->bg) ebits_free(m->bg);
if (m->bg)
ebits_free(m->bg);
m->bg = ebits_load(m->bg_file);
if (m->bg) ebits_set_color_class(m->bg, "Menu BG", 100, 200, 255, 255);
if (m->bg)
ebits_set_color_class(m->bg, "Menu BG", 100, 200, 255, 255);
pl = pr = pt = pb = 0;
if (m->bg)
@ -1032,20 +1057,24 @@ e_menu_set_sel(E_Menu *m, E_Menu_Item *mi)
if (!mi->separator)
{
selected = mi->selected;
if (mi->submenu) has_sub = 1;
if (mi->submenu)
has_sub = 1;
snprintf(buf, PATH_MAX, "%sselected-%i.submenu-%i.bits.db", menus,
selected, has_sub);
if ((mi->bg_file) && (!strcmp(mi->bg_file, buf))) D_RETURN;
if ((mi->bg_file) && (!strcmp(mi->bg_file, buf)))
D_RETURN;
}
IF_FREE(mi->bg_file);
if (!mi->separator)
mi->bg_file = strdup(buf);
else
mi->bg_file = NULL;
if (mi->bg) ebits_free(mi->bg);
if (mi->bg)
ebits_free(mi->bg);
if (mi->bg_file)
mi->bg = ebits_load(mi->bg_file);
if (mi->bg) ebits_set_color_class(mi->bg, "Menu BG", 100, 200, 255, 255);
if (mi->bg)
ebits_set_color_class(mi->bg, "Menu BG", 100, 200, 255, 255);
pl = pr = pt = pb = 0;
if (mi->bg)
@ -1054,10 +1083,26 @@ e_menu_set_sel(E_Menu *m, E_Menu_Item *mi)
ebits_add_to_evas(mi->bg, m->evas);
ebits_set_layer(mi->bg, 1);
}
if (m->sel_border.l < pl) {m->sel_border.l = pl; m->recalc_entries = 1;}
if (m->sel_border.r < pr) {m->sel_border.r = pr; m->recalc_entries = 1;}
if (m->sel_border.t < pt) {m->sel_border.t = pt; m->recalc_entries = 1;}
if (m->sel_border.b < pb) {m->sel_border.b = pb; m->recalc_entries = 1;}
if (m->sel_border.l < pl)
{
m->sel_border.l = pl;
m->recalc_entries = 1;
}
if (m->sel_border.r < pr)
{
m->sel_border.r = pr;
m->recalc_entries = 1;
}
if (m->sel_border.t < pt)
{
m->sel_border.t = pt;
m->recalc_entries = 1;
}
if (m->sel_border.b < pb)
{
m->sel_border.b = pb;
m->recalc_entries = 1;
}
m->redo_sel = 1;
m->changed = 1;
@ -1075,14 +1120,17 @@ e_menu_set_sep(E_Menu *m, E_Menu_Item *mi)
menus = e_config_get("menus");
snprintf(buf, PATH_MAX, "%sseparator.bits.db", menus);
if ((mi->sep_file) && (!strcmp(mi->sep_file, buf))) D_RETURN;
if ((mi->sep_file) && (!strcmp(mi->sep_file, buf)))
D_RETURN;
IF_FREE(mi->sep_file);
mi->sep_file = strdup(buf);
if (mi->sep) ebits_free(mi->sep);
if (mi->sep)
ebits_free(mi->sep);
mi->sep = ebits_load(mi->sep_file);
if (mi->sep) ebits_set_color_class(mi->sep, "Menu BG", 100, 200, 255, 255);
if (mi->sep)
ebits_set_color_class(mi->sep, "Menu BG", 100, 200, 255, 255);
pl = pr = pt = pb = 0;
minx = 0;
@ -1094,8 +1142,10 @@ e_menu_set_sep(E_Menu *m, E_Menu_Item *mi)
ebits_set_layer(mi->sep, 1);
ebits_get_min_size(mi->sep, &minx, &miny);
}
if (mi->size.min.w < minx) mi->size.min.w = minx;
if (mi->size.min.h < miny) mi->size.min.h = miny;
if (mi->size.min.w < minx)
mi->size.min.w = minx;
if (mi->size.min.h < miny)
mi->size.min.h = miny;
m->redo_sel = 1;
m->changed = 1;
@ -1118,14 +1168,17 @@ e_menu_set_state(E_Menu *m, E_Menu_Item *mi)
snprintf(buf, PATH_MAX, "%scheck-%i.bits.db", menus, on);
else
snprintf(buf, PATH_MAX, "%sradio-%i.bits.db", menus, on);
if ((mi->state_file) && (!strcmp(mi->state_file, buf))) D_RETURN;
if ((mi->state_file) && (!strcmp(mi->state_file, buf)))
D_RETURN;
IF_FREE(mi->state_file);
mi->state_file = strdup(buf);
if (mi->state) ebits_free(mi->state);
if (mi->state)
ebits_free(mi->state);
mi->state = ebits_load(mi->state_file);
if (mi->state) ebits_set_color_class(mi->state, "Menu BG", 100, 200, 255, 255);
if (mi->state)
ebits_set_color_class(mi->state, "Menu BG", 100, 200, 255, 255);
pl = pr = pt = pb = 0;
minx = 0;
@ -1137,8 +1190,10 @@ e_menu_set_state(E_Menu *m, E_Menu_Item *mi)
ebits_set_layer(mi->state, 2);
ebits_get_min_size(mi->state, &minx, &miny);
}
if (mi->size.min.w < minx) mi->size.min.w = minx;
if (mi->size.min.h < miny) mi->size.min.h = miny;
if (mi->size.min.w < minx)
mi->size.min.w = minx;
if (mi->size.min.h < miny)
mi->size.min.h = miny;
m->redo_sel = 1;
m->changed = 1;
@ -1200,10 +1255,7 @@ e_menu_new(void)
m->win.main,
0, 0, 1, 1,
RENDER_METHOD_ALPHA_SOFTWARE,
max_colors,
font_cache,
image_cache,
font_dir);
max_colors, font_cache, image_cache, font_dir);
/* aaaaaaaaah. this makes building the menu fast - moves the mouse far */
/* far far far far away so callbacks and events arent triggerd as we */
/* create objects that ofter hang around 0,0 - the default place for */
@ -1221,7 +1273,9 @@ e_menu_new(void)
evas_event_move(m->evas, -999999999, -99999999);
m->win.evas = evas_get_window(m->evas);
ecore_window_set_events(m->win.evas, XEV_EXPOSE | XEV_MOUSE_MOVE | XEV_BUTTON | XEV_IN_OUT | XEV_KEY);
ecore_window_set_events(m->win.evas,
XEV_EXPOSE | XEV_MOUSE_MOVE | XEV_BUTTON | XEV_IN_OUT
| XEV_KEY);
ecore_window_set_events(m->win.main, XEV_IN_OUT | XEV_KEY);
ecore_window_show(m->win.evas);
@ -1241,7 +1295,6 @@ e_menu_hide(E_Menu *m)
{
D_ENTER;
if (m->selected)
{
m->selected->selected = 0;
@ -1286,8 +1339,7 @@ e_menu_show_at_mouse(E_Menu *m, int x, int y, Time t)
m->current.x = x;
m->current.y = y;
m->time = t;
D("show menu\n")
e_menu_show(m);
D("show menu\n") e_menu_show(m);
D_RETURN;
}
@ -1317,7 +1369,8 @@ e_menu_del_item(E_Menu *m, E_Menu_Item *mi)
e_menu_item_unrealize(m, mi);
IF_FREE(mi->str);
IF_FREE(mi->icon);
if (mi->menu->selected == mi) mi->menu->selected = NULL;
if (mi->menu->selected == mi)
mi->menu->selected = NULL;
free(mi);
mi->menu = NULL;
@ -1335,62 +1388,81 @@ e_menu_item_update(E_Menu *m, E_Menu_Item *mi)
if (mi->sep)
{
ebits_move(mi->sep, mi->x, mi->y);
ebits_resize(mi->sep, mi->size.w + m->sel_border.l + m->sel_border.r, mi->size.h);
ebits_resize(mi->sep, mi->size.w + m->sel_border.l + m->sel_border.r,
mi->size.h);
ebits_show(mi->sep);
}
else
{
rx = 0; ry = 0; rh = 0;
rx = 0;
ry = 0;
rh = 0;
rw = m->size.state;
if (mi->state)
{
ebits_get_min_size(mi->state, &rw, &rh);
rx = 0;
ry = ((mi->size.h - rh) / 2);
ebits_move(mi->state, m->sel_border.l + mi->x + rx, m->sel_border.t + mi->y + ry);
ebits_move(mi->state, m->sel_border.l + mi->x + rx,
m->sel_border.t + mi->y + ry);
ebits_resize(mi->state, rw, rh);
}
tx = 0; ty = 0; tw = 0; th = 0;
tx = 0;
ty = 0;
tw = 0;
th = 0;
if (mi->obj_text)
{
evas_get_geometry(m->evas, mi->obj_text, NULL, NULL, &dtw, &dth);
tw = (int)dtw; th = (int)dth;
tw = (int)dtw;
th = (int)dth;
}
ix = 0; iy = 0; iw = 0; ih = 0;
ix = 0;
iy = 0;
iw = 0;
ih = 0;
if (mi->obj_icon)
{
int sh;
evas_get_image_size(m->evas, mi->obj_icon, &iw, &ih);
sh = th;
if (rh > th) sh = rh;
if (rh > th)
sh = rh;
if ((mi->scale_icon) && (ih > sh) && (mi->str))
{
iw = (iw * sh) / ih;
ih = sh;
}
if (m->size.state) ix = rx + m->size.state + m->pad.state;
if (m->size.state)
ix = rx + m->size.state + m->pad.state;
ix += ((m->size.icon - iw) / 2);
iy = ((mi->size.h - ih) / 2);
evas_move(m->evas, mi->obj_icon, m->sel_border.l + mi->x + ix, m->sel_border.t + mi->y + iy);
evas_move(m->evas, mi->obj_icon, m->sel_border.l + mi->x + ix,
m->sel_border.t + mi->y + iy);
evas_resize(m->evas, mi->obj_icon, iw, ih);
evas_set_image_fill(m->evas, mi->obj_icon, 0, 0, iw, ih);
}
if (mi->obj_text)
{
if (m->size.state) tx = rx + m->size.state + m->pad.state;
if (m->size.icon) tx += m->size.icon + m->pad.icon;
if (m->size.state)
tx = rx + m->size.state + m->pad.state;
if (m->size.icon)
tx += m->size.icon + m->pad.icon;
ty = ((mi->size.h - th) / 2);
evas_move(m->evas, mi->obj_text, m->sel_border.l + mi->x + tx, m->sel_border.t + mi->y + ty);
evas_move(m->evas, mi->obj_text, m->sel_border.l + mi->x + tx,
m->sel_border.t + mi->y + ty);
}
if (mi->obj_entry)
{
evas_move(m->evas, mi->obj_entry, mi->x, mi->y);
evas_resize(m->evas, mi->obj_entry, mi->size.w + m->sel_border.l + m->sel_border.r, mi->size.h + m->sel_border.t + m->sel_border.b);
evas_resize(m->evas, mi->obj_entry,
mi->size.w + m->sel_border.l + m->sel_border.r,
mi->size.h + m->sel_border.t + m->sel_border.b);
}
if (mi->state)
{
@ -1406,21 +1478,27 @@ e_menu_item_unrealize(E_Menu *m, E_Menu_Item *mi)
{
D_ENTER;
if (mi->bg) ebits_free(mi->bg);
if (mi->bg)
ebits_free(mi->bg);
mi->bg = NULL;
IF_FREE(mi->bg_file);
mi->bg_file = NULL;
if (mi->obj_entry) evas_del_object(m->evas, mi->obj_entry);
if (mi->obj_entry)
evas_del_object(m->evas, mi->obj_entry);
mi->obj_entry = NULL;
if (mi->obj_text) evas_del_object(m->evas, mi->obj_text);
if (mi->obj_text)
evas_del_object(m->evas, mi->obj_text);
mi->obj_text = NULL;
if (mi->obj_icon) evas_del_object(m->evas, mi->obj_icon);
if (mi->obj_icon)
evas_del_object(m->evas, mi->obj_icon);
mi->obj_icon = NULL;
if (mi->state) ebits_free(mi->state);
if (mi->state)
ebits_free(mi->state);
mi->state = NULL;
IF_FREE(mi->state_file);
mi->state_file = NULL;
if (mi->sep) ebits_free(mi->sep);
if (mi->sep)
ebits_free(mi->sep);
mi->sep = NULL;
IF_FREE(mi->sep_file);
mi->sep_file = NULL;
@ -1459,21 +1537,31 @@ e_menu_item_realize(E_Menu *m, E_Menu_Item *mi)
evas_set_layer(m->evas, mi->obj_entry, 11);
evas_set_color(m->evas, mi->obj_entry, 0, 0, 0, 0);
evas_show(m->evas, mi->obj_entry);
tw = 0; th = 0;
if (mi->obj_text) evas_get_geometry(m->evas, mi->obj_text, NULL, NULL, &tw, &th);
iw = 0; ih = 0;
if (mi->obj_icon) evas_get_image_size(m->evas, mi->obj_icon, &iw, &ih);
rw = 0; rh = 0;
if (mi->state) ebits_get_min_size(mi->state, &rw, &rh);
tw = 0;
th = 0;
if (mi->obj_text)
evas_get_geometry(m->evas, mi->obj_text, NULL, NULL, &tw, &th);
iw = 0;
ih = 0;
if (mi->obj_icon)
evas_get_image_size(m->evas, mi->obj_icon, &iw, &ih);
rw = 0;
rh = 0;
if (mi->state)
ebits_get_min_size(mi->state, &rw, &rh);
mi->size.min.w = (int)tw + rw;
if (rh > th) th = (double)rh;
if (((!mi->scale_icon) && (ih > th)) ||
((!mi->str) && (ih > th))) th = (double)ih;
if (rh > th)
th = (double)rh;
if (((!mi->scale_icon) && (ih > th)) || ((!mi->str) && (ih > th)))
th = (double)ih;
mi->size.min.h = (int)th;
evas_callback_add(m->evas, mi->obj_entry, CALLBACK_MOUSE_IN, e_menu_item_in_cb, mi);
evas_callback_add(m->evas, mi->obj_entry, CALLBACK_MOUSE_OUT, e_menu_item_out_cb, mi);
evas_callback_add(m->evas, mi->obj_entry, CALLBACK_MOUSE_IN,
e_menu_item_in_cb, mi);
evas_callback_add(m->evas, mi->obj_entry, CALLBACK_MOUSE_OUT,
e_menu_item_out_cb, mi);
e_menu_set_sel(m, mi);
if ((mi->radio) || (mi->check)) e_menu_set_state(m, mi);
if ((mi->radio) || (mi->check))
e_menu_set_state(m, mi);
}
D_RETURN;
@ -1489,7 +1577,8 @@ e_menu_item_new(char *str)
mi = NEW(E_Menu_Item, 1);
ZERO(mi, E_Menu_Item, 1);
if (str) mi->str = strdup(str);
if (str)
mi->str = strdup(str);
D_RETURN_(mi);
}
@ -1503,20 +1592,16 @@ e_menu_obscure_outside_screen(E_Menu *m)
evas_clear_obscured_rects(m->evas);
evas_add_obscured_rect(m->evas,
-m->current.x - 100000,
-m->current.y - 100000,
200000 + screen_w, 100000);
-m->current.y - 100000, 200000 + screen_w, 100000);
evas_add_obscured_rect(m->evas,
-m->current.x - 100000,
-m->current.y - 100000,
100000, 200000 + screen_h);
-m->current.y - 100000, 100000, 200000 + screen_h);
evas_add_obscured_rect(m->evas,
-m->current.x - 100000,
screen_h - m->current.y,
200000 + screen_w, 100000);
screen_h - m->current.y, 200000 + screen_w, 100000);
evas_add_obscured_rect(m->evas,
screen_w - m->current.x,
-m->current.y - 100000,
100000, 200000 + screen_h);
-m->current.y - 100000, 100000, 200000 + screen_h);
D_RETURN;
}
@ -1548,8 +1633,7 @@ e_menu_scroll_all_by(int dx, int dy)
m = l->data;
evas_event_move(m->evas,
mouse_x - m->current.x,
mouse_y - m->current.y);
mouse_x - m->current.x, mouse_y - m->current.y);
}
}
@ -1579,10 +1663,12 @@ e_menu_update_visibility(E_Menu *m)
else
e_menu_scroll_all_by(0, -m->current.y);
}
else if ((m->current.y + m->sel_border.t + mi->y + mi->size.h) > screen_h)
else if ((m->current.y + m->sel_border.t + mi->y + mi->size.h) >
screen_h)
{
if ((m->current.y + m->current.h - screen_h) < (screen_h / 4))
e_menu_scroll_all_by(0, -(m->current.y + m->current.h - screen_h));
e_menu_scroll_all_by(0,
-(m->current.y + m->current.h - screen_h));
else
e_menu_scroll_all_by(0, -(screen_h / 4));
}
@ -1599,8 +1685,8 @@ e_menu_update_base(E_Menu *m)
D_ENTER;
if (!m->changed) D_RETURN;
if (!m->changed)
D_RETURN;
if (m->recalc_entries)
{
@ -1615,7 +1701,8 @@ e_menu_update_base(E_Menu *m)
E_Menu_Item *mi;
mi = l->data;
if (mi->size.min.h > max_h) max_h = mi->size.min.h;
if (mi->size.min.h > max_h)
max_h = mi->size.min.h;
}
m->size.state = 0;
m->size.icon = 0;
@ -1629,29 +1716,43 @@ e_menu_update_base(E_Menu *m)
mi = l->data;
if (!mi->separator)
{
tw = 0; th = 0;
if (mi->obj_text) evas_get_geometry(m->evas, mi->obj_text, NULL, NULL, &tw, &th);
iw = 0; ih = 0;
if (mi->obj_icon) evas_get_image_size(m->evas, mi->obj_icon, &iw, &ih);
rw = 0; rh = 0;
if (mi->state) ebits_get_min_size(mi->state, &rw, &rh);
if (m->size.text < tw) m->size.text = tw;
if (m->size.state < rw) m->size.state = rw;
tw = 0;
th = 0;
if (mi->obj_text)
evas_get_geometry(m->evas, mi->obj_text, NULL, NULL, &tw,
&th);
iw = 0;
ih = 0;
if (mi->obj_icon)
evas_get_image_size(m->evas, mi->obj_icon, &iw, &ih);
rw = 0;
rh = 0;
if (mi->state)
ebits_get_min_size(mi->state, &rw, &rh);
if (m->size.text < tw)
m->size.text = tw;
if (m->size.state < rw)
m->size.state = rw;
if ((mi->scale_icon) && (iw > 0) && (ih > 0) && (mi->str))
{
int iiw;
iiw = iw;
if (ih > (int)th) iiw = (iw * (int)th) / ih;
if (m->size.icon < iiw) m->size.icon = iiw;
if (ih > (int)th)
iiw = (iw * (int)th) / ih;
if (m->size.icon < iiw)
m->size.icon = iiw;
}
else if (m->size.icon < iw) m->size.icon = iw;
else if (m->size.icon < iw)
m->size.icon = iw;
}
}
max_w = m->size.state;
if (m->size.state) max_w += m->pad.state;
if (m->size.state)
max_w += m->pad.state;
max_w += m->size.icon;
if (m->size.icon) max_w += m->pad.icon;
if (m->size.icon)
max_w += m->pad.icon;
max_w += m->size.text;
i = m->border.t;
@ -1661,8 +1762,10 @@ e_menu_update_base(E_Menu *m)
mi = l->data;
mi->size.w = max_w;
if (mi->separator) mi->size.h = mi->size.min.h;
else mi->size.h = max_h;
if (mi->separator)
mi->size.h = mi->size.min.h;
else
mi->size.h = max_h;
mi->x = m->border.l;
mi->y = i;
if (!mi->separator)
@ -1673,7 +1776,9 @@ e_menu_update_base(E_Menu *m)
i += max_h;
e_menu_item_update(m, mi);
}
m->current.w = m->border.l + m->border.r + max_w + m->sel_border.l + m->sel_border.r;
m->current.w =
m->border.l + m->border.r + max_w + m->sel_border.l +
m->sel_border.r;
m->current.h = m->border.b + i;
m->recalc_entries = 0;
@ -1694,8 +1799,10 @@ e_menu_update_base(E_Menu *m)
{
ebits_move(mi->bg, mi->x, mi->y);
ebits_resize(mi->bg,
mi->size.w + m->sel_border.l + m->sel_border.r,
mi->size.h + m->sel_border.t + m->sel_border.b);
mi->size.w + m->sel_border.l +
m->sel_border.r,
mi->size.h + m->sel_border.t +
m->sel_border.b);
ebits_show(mi->bg);
}
}
@ -1703,16 +1810,15 @@ e_menu_update_base(E_Menu *m)
m->redo_sel = 0;
}
if ((m->current.x != m->previous.x) ||
(m->current.y != m->previous.y))
if ((m->current.x != m->previous.x) || (m->current.y != m->previous.y))
location_changed = 1;
if ((m->current.w != m->previous.w) ||
(m->current.h != m->previous.h))
if ((m->current.w != m->previous.w) || (m->current.h != m->previous.h))
size_changed = 1;
if ((location_changed) && (size_changed))
{
ecore_window_move_resize(m->win.main, m->current.x, m->current.y, m->current.w, m->current.h);
ecore_window_move_resize(m->win.main, m->current.x, m->current.y,
m->current.w, m->current.h);
e_menu_obscure_outside_screen(m);
}
else if (location_changed)
@ -1729,7 +1835,8 @@ e_menu_update_base(E_Menu *m)
ecore_window_resize(m->win.evas, m->current.w, m->current.h);
evas_set_output_size(m->evas, m->current.w, m->current.h);
evas_set_output_viewport(m->evas, 0, 0, m->current.w, m->current.h);
if (m->bg) ebits_resize(m->bg, m->current.w, m->current.h);
if (m->bg)
ebits_resize(m->bg, m->current.w, m->current.h);
}
D_RETURN;
@ -1740,7 +1847,8 @@ e_menu_update_finish(E_Menu *m)
{
D_ENTER;
if (!m->changed) D_RETURN;
if (!m->changed)
D_RETURN;
m->previous = m->current;
m->changed = 0;
@ -1752,7 +1860,8 @@ e_menu_update_shows(E_Menu *m)
{
D_ENTER;
if (!m->changed) D_RETURN;
if (!m->changed)
D_RETURN;
if (m->current.visible != m->previous.visible)
{
if (m->current.visible)
@ -1760,7 +1869,8 @@ e_menu_update_shows(E_Menu *m)
ecore_window_raise(m->win.main);
e_menu_event_win_show();
ecore_window_show(m->win.main);
if (!open_menus) keyboard_nav = 0;
if (!open_menus)
keyboard_nav = 0;
open_menus = evas_list_append(open_menus, m);
}
}
@ -1773,7 +1883,8 @@ e_menu_update_hides(E_Menu *m)
{
D_ENTER;
if (!m->changed) D_RETURN;
if (!m->changed)
D_RETURN;
if (m->current.visible != m->previous.visible)
{
if (!m->current.visible)
@ -1791,8 +1902,10 @@ e_menu_update_hides(E_Menu *m)
{
ebits_move(mi->bg, mi->x, mi->y);
ebits_resize(mi->bg,
mi->size.w + m->sel_border.l + m->sel_border.r,
mi->size.h + m->sel_border.t + m->sel_border.b);
mi->size.w + m->sel_border.l +
m->sel_border.r,
mi->size.h + m->sel_border.t +
m->sel_border.b);
ebits_show(mi->bg);
}
}
@ -1802,7 +1915,8 @@ e_menu_update_hides(E_Menu *m)
}
open_menus = evas_list_remove(open_menus, m);
ecore_window_hide(m->win.main);
if (!open_menus) e_menu_event_win_hide();
if (!open_menus)
e_menu_event_win_hide();
if (m->func_hide)
m->func_hide(m, m->func_hide_data);
}
@ -1831,7 +1945,8 @@ e_menu_item_set_icon(E_Menu_Item *mi, char *icon)
IF_FREE(mi->icon);
mi->icon = NULL;
if (icon) mi->icon = strdup(icon);
if (icon)
mi->icon = strdup(icon);
if (mi->menu)
{
mi->menu->recalc_entries = 1;
@ -1848,7 +1963,8 @@ e_menu_item_set_text(E_Menu_Item *mi, char *text)
IF_FREE(mi->str);
mi->str = NULL;
if (text) mi->str = strdup(text);
if (text)
mi->str = strdup(text);
if (mi->menu)
{
mi->menu->recalc_entries = 1;
@ -1924,7 +2040,8 @@ e_menu_item_set_submenu(E_Menu_Item *mi, E_Menu *submenu)
{
D_ENTER;
if (mi->submenu) e_menu_hide(mi->submenu);
if (mi->submenu)
e_menu_hide(mi->submenu);
mi->submenu = submenu;
if (mi->menu)
{

View File

@ -11,16 +11,22 @@ struct _E_Menu
{
E_Object o;
struct {
struct
{
int x, y, w, h;
int visible;
} current, previous;
struct {
}
current , previous;
struct
{
int l, r, t, b;
} border, sel_border;
struct {
}
border , sel_border;
struct
{
Window main, evas;
} win;
}
win;
Evas evas;
Ebits_Object bg;
Evas_List entries;
@ -34,12 +40,16 @@ struct _E_Menu
int delete_me;
struct {
struct
{
int state, icon, text;
} size;
struct {
}
size;
struct
{
int icon, state;
} pad;
}
pad;
E_Menu_Item *selected;
@ -52,12 +62,16 @@ struct _E_Menu
struct _E_Menu_Item
{
int x, y;
struct {
struct {
struct
{
struct
{
int w, h;
} min;
}
min;
int w, h;
} size;
}
size;
Ebits_Object bg;
char *bg_file;
@ -87,11 +101,11 @@ struct _E_Menu_Item
E_Menu *menu;
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;
};
/**
* e_menu_init - Menu event handling initalization.
*
@ -101,8 +115,14 @@ struct _E_Menu_Item
void e_menu_init(void);
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_hide_callback(E_Menu *m, void (*func) (E_Menu *m, void *data), void *data);
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_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_event_win_show(void);

View File

@ -13,21 +13,27 @@
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, void *data);
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,
void *data);
static void e_build_menu_unbuild(E_Build_Menu * bm);
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,
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_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 void e_build_menu_iconified_borders_changed(E_Observer *
observer,
E_Observee *
observee,
E_Event_Type event);
/* ------------ various callbacks ---------------------- */
static void
@ -119,10 +125,8 @@ e_build_menu_unbuild(E_Build_Menu *bm)
D_RETURN;
}
/* BUILDING from DB's */
static void
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_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);
@ -162,14 +167,16 @@ e_build_menu_gnome_apps_poll(int val, void *data)
mod = e_file_mod_time(bm->file);
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;
}
bm->mod_time = mod;
e_build_menu_unbuild(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);
@ -187,7 +194,8 @@ e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
D_ENTER;
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();
e_menu_set_padding_icon(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);
menuitem = e_menu_item_new(text);
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(icon);
if (sep) e_menu_item_set_separator(menuitem, 1);
if (sep)
e_menu_item_set_separator(menuitem, 1);
else
{
if (ok)
@ -253,20 +263,21 @@ e_build_menu_db_build(E_Build_Menu *bm)
e_db_flush();
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 (num > 0) bm->menu = e_build_menu_db_build_number(bm, db, 0);
if (!e_db_int_get(db, "/menu/count", &num))
goto error;
if (num > 0)
bm->menu = e_build_menu_db_build_number(bm, db, 0);
error:
e_db_close(db);
D_RETURN;
}
/* BUILD from GNOME APPS directory structure */
static E_Menu *
e_build_menu_gnome_apps_build_dir(E_Build_Menu * bm, char *dir)
{
@ -330,7 +341,8 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
}
free(s);
}
if (dirlist) evas_list_free(dirlist);
if (dirlist)
evas_list_free(dirlist);
}
/* now go thru list... */
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");
}
/* doesnt exist at all? next item */
else continue;
else
continue;
if (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];
snprintf(buf2, PATH_MAX, "/usr/share/pixmaps/%s", eq +1);
snprintf(buf2, PATH_MAX,
"/usr/share/pixmaps/%s", eq + 1);
icon = strdup(buf2);
}
}
@ -418,23 +432,28 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
fclose(f);
}
if (!name) name = strdup(s);
if (!name)
name = strdup(s);
menuitem = e_menu_item_new(name);
if (icon) e_menu_item_set_icon(menuitem, icon);
if ((icon) && (name)) e_menu_item_set_scale_icon(menuitem, 1);
if (icon)
e_menu_item_set_icon(menuitem, icon);
if ((icon) && (name))
e_menu_item_set_scale_icon(menuitem, 1);
if (exe)
{
e_menu_item_set_callback(menuitem, e_build_menu_cb_exec, 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);
IF_FREE(name);
IF_FREE(icon);
free(s);
}
if (entries) evas_list_free(entries);
if (entries)
evas_list_free(entries);
bm->menus = evas_list_prepend(bm->menus, menu);
D_RETURN_(menu);
@ -476,7 +495,8 @@ e_build_menu_new_from_db(char *file)
D_ENTER;
if (!file) D_RETURN_(NULL);
if (!file)
D_RETURN_(NULL);
bm = NEW(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;
if (!dir) D_RETURN_(NULL);
if (!dir)
D_RETURN_(NULL);
bm = NEW(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);
/* 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)
{
E_Border *b = l->data;
e_observer_register_observee(E_OBSERVER(bm), E_OBSERVEE(b));
}
bm->menu = e_build_menu_iconified_borders_build(bm);
@ -552,7 +576,9 @@ e_build_menu_iconified_borders_rebuild(E_Build_Menu *bm)
}
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;
@ -561,7 +587,8 @@ e_build_menu_iconified_borders_changed(E_Observer *observer, E_Observee *observe
if (event & E_EVENT_BORDER_NEW)
{
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)

View File

@ -29,7 +29,6 @@ e_object_cleanup(E_Object *obj)
D_RETURN;
}
void
e_object_ref(E_Object * obj)
{
@ -66,7 +65,6 @@ e_object_unref(E_Object *obj)
D_RETURN_(obj->references);
}
int
e_object_get_usecount(E_Object * obj)
{

View File

@ -13,7 +13,8 @@ typedef struct _e_object
int references;
E_Cleanup_Func cleanup_func;
} E_Object;
}
E_Object;
/**
* e_object_init - Initializes an E object

View File

@ -7,8 +7,7 @@ static Evas_List observers;
void
e_observer_init(E_Observer * obs, E_Event_Type event,
E_Notify_Func notify_func,
E_Cleanup_Func cleanup_func)
E_Notify_Func notify_func, E_Cleanup_Func cleanup_func)
{
D_ENTER;
@ -78,7 +77,6 @@ e_observer_unregister_observee(E_Observer *observer, E_Observee *observee)
D_RETURN;
}
/* --------------------- Observee code below */
void
@ -96,7 +94,6 @@ e_observee_init(E_Observee *obs, E_Cleanup_Func cleanup_func)
D_RETURN;
}
void
e_observee_notify_observers(E_Observee * o, E_Event_Type event)
{
@ -171,4 +168,3 @@ e_observee_cleanup(E_Observee *obs)
D_RETURN;
}

View File

@ -39,9 +39,12 @@ typedef enum _e_event_type
/* ALL events */
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
{
@ -59,7 +62,6 @@ struct _e_observee
Evas_List observers; /* list<E_Observer> */
};
/**
* e_observer_init - Initializes an observer
* @obs: The observer to initialize
@ -91,7 +93,8 @@ void e_observer_cleanup(E_Observer *obs);
*
* 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
@ -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.
*/
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.
@ -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
* 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.
@ -130,8 +135,8 @@ void e_observee_cleanup(E_Observee *obs);
* and calls the notify_func() of the observers that are
* 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
@ -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
* 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

View File

@ -20,7 +20,8 @@ e_mouse_down(Ecore_Event * ev)
D_ENTER;
e = ev->event;
if (!win_place) D_RETURN;
if (!win_place)
D_RETURN;
D_RETURN;
}
@ -33,9 +34,11 @@ e_mouse_up(Ecore_Event * ev)
D_ENTER;
e = ev->event;
if (!win_place) D_RETURN;
if (!win_place)
D_RETURN;
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);
win_place = 0;
@ -50,10 +53,11 @@ e_mouse_move(Ecore_Event * ev)
D_ENTER;
e = ev->event;
if (!win_place) D_RETURN;
if (!win_place)
D_RETURN;
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,
e->rx - prx, e->ry - pry);
ECORE_EVENT_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx,
e->ry, e->rx - prx, e->ry - pry);
prx = e->rx;
pry = e->ry;
@ -66,7 +70,9 @@ e_place_manual(E_Border *b, E_Desktop *desk, int *x, int *y)
int w, h;
int mx, my, rx, ry;
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;
@ -102,9 +108,11 @@ e_place_manual(E_Border *b, E_Desktop *desk, int *x, int *y)
/* start a move mode */
e_action_stop_by_type("Window_Place");
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);
}
@ -149,18 +157,21 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
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)
{
a_w++;
REALLOC(a_x, int, a_w);
for (j = a_w - 1; j > i; j--)
a_x[j] = a_x[j - 1];
a_x[i] = bd->current.x;
ok = 0;
}
}
if (!ok) break;
if (!ok)
break;
}
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 (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)
{
a_w++;
REALLOC(a_x, int, a_w);
for (j = a_w - 1; j > i; j--)
a_x[j] = a_x[j - 1];
a_x[i] = bd->current.x + bd->current.w;
ok = 0;
}
}
if (!ok) break;
if (!ok)
break;
}
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 (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)
{
a_h++;
REALLOC(a_y, int, a_h);
for (j = a_h - 1; j > i; j--)
a_y[j] = a_y[j - 1];
a_y[i] = bd->current.y;
ok = 0;
}
}
if (!ok) break;
if (!ok)
break;
}
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 (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)
{
a_h++;
REALLOC(a_y, int, a_h);
for (j = a_h - 1; j > i; j--)
a_y[j] = a_y[j - 1];
a_y[i] = bd->current.y + bd->current.h;
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;
x0 = x1;
if (x1 < x2) x0 = x2;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2) y0 = y2;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
@ -275,11 +299,11 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar;
*x = a_x[i];
*y = a_y[j];
if (ar == 0) goto done;
if (ar == 0)
goto done;
}
}
if ((a_x[i + 1] - w > 0) &&
(a_y[j] < (desk->real.h - h)))
if ((a_x[i + 1] - w > 0) && (a_y[j] < (desk->real.h - h)))
{
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;
x0 = x1;
if (x1 < x2) x0 = x2;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2) y0 = y2;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
@ -323,11 +351,11 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar;
*x = a_x[i + 1] - w;
*y = a_y[j];
if (ar == 0) goto done;
if (ar == 0)
goto done;
}
}
if ((a_x[i + 1] - w > 0) &&
(a_y[j + 1] - h > 0))
if ((a_x[i + 1] - w > 0) && (a_y[j + 1] - h > 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;
x0 = x1;
if (x1 < x2) x0 = x2;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2) y0 = y2;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
@ -371,11 +403,11 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar;
*x = a_x[i + 1] - w;
*y = a_y[j + 1] - h;
if (ar == 0) goto done;
if (ar == 0)
goto done;
}
}
if ((a_x[i] < (desk->real.w - w)) &&
(a_y[j + 1] - h > 0))
if ((a_x[i] < (desk->real.w - w)) && (a_y[j + 1] - h > 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;
x0 = x1;
if (x1 < x2) x0 = x2;
if (x1 < x2)
x0 = x2;
x00 = (x1 + w1);
if ((x2 + w2) < (x1 + w1)) x00 = (x2 + w2);
if ((x2 + w2) < (x1 + w1))
x00 = (x2 + w2);
y0 = y1;
if (y1 < y2) y0 = y2;
if (y1 < y2)
y0 = y2;
y00 = (y1 + h1);
if ((y2 + h2) < (y1 + h1)) y00 = (y2 + h2);
if ((y2 + h2) < (y1 + h1))
y00 = (y2 + h2);
iw = x00 - x0;
ih = y00 - y0;
@ -419,7 +455,8 @@ e_place_smart(E_Border *b, E_Desktop *desk, int *x, int *y)
area = ar;
*x = a_x[i];
*y = a_y[j + 1] - h;
if (ar == 0) goto done;
if (ar == 0)
goto done;
}
}
}
@ -458,11 +495,14 @@ e_place_cascade(E_Border *b, E_Desktop *desk, int *x, int *y)
D_ENTER;
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;
h = b->current.requested.h;
if ((count_x + w) > desk->real.w) count_x = 0;
if ((count_y + h) > desk->real.h) count_y = 0;
if ((count_x + w) > desk->real.w)
count_x = 0;
if ((count_y + h) > desk->real.h)
count_y = 0;
*x = count_x;
*y = count_y;
count_x += pl;
@ -495,7 +535,8 @@ e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y)
}
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;

View File

@ -35,7 +35,7 @@ void e_place_init(void);
* and returns them in the @x and @y pointers. It does not actually
* 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

View File

@ -10,16 +10,17 @@ e_resist_border(E_Border *b)
int resist = 1;
int desk_resist = 32;
int win_resist = 12;
/* int ok = 0; */
int dx, dy, d;
int resist_x = 0, resist_y = 0;
Evas_List l, rects = NULL;
E_Rect *r;
E_CFG_INT(cfg_resist, "settings", "/move/resist", 1);
E_CFG_INT(cfg_desk_resist, "settings", "/move/resist/desk", 32);
E_CFG_INT(cfg_win_resist, "settings", "/move/resist/win", 12);
D_ENTER;
E_CONFIG_INT_GET(cfg_resist, resist);
@ -31,7 +32,8 @@ e_resist_border(E_Border *b)
b->current.y = b->current.requested.y;
D_RETURN;
}
if (!b->desk) D_RETURN;
if (!b->desk)
D_RETURN;
dx = b->current.requested.x - b->previous.requested.x;
dy = b->current.requested.y - b->previous.requested.y;
/* 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; \
rects = evas_list_append(rects, r); \
}
OBSTACLE(-1000000, -1000000, 2000000 + b->desk->real.w, 1000000, desk_resist);
OBSTACLE(-1000000, -1000000, 1000000, 2000000 + b->desk->real.h, 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);
OBSTACLE(-1000000, -1000000, 2000000 + b->desk->real.w, 1000000,
desk_resist);
OBSTACLE(-1000000, -1000000, 1000000, 2000000 + b->desk->real.h,
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 */
/* here if need be - ie xinerama middle between screens and panels etc. */
{
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)
@ -63,6 +70,7 @@ rects = evas_list_append(rects, r); \
if (bd != b)
{
r = NEW(struct _E_Rect, 1);
r->x = bd->current.x;
r->y = bd->current.y;
r->w = bd->current.w;
@ -83,7 +91,8 @@ rects = evas_list_append(rects, r); \
d = r->x - (b->current.requested.x + b->current.w);
if ((d < 0) && (d >= -r->v1))
{
if (resist_x > d) resist_x = d;
if (resist_x > d)
resist_x = d;
}
}
else if (dx < 0)
@ -92,7 +101,8 @@ rects = evas_list_append(rects, r); \
d = b->current.requested.x - (r->x + r->w);
if ((d < 0) && (d >= -r->v1))
{
if (resist_x > d) resist_x = -d;
if (resist_x > d)
resist_x = -d;
}
}
}
@ -104,7 +114,8 @@ rects = evas_list_append(rects, r); \
d = r->y - (b->current.requested.y + b->current.h);
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)
@ -113,7 +124,8 @@ rects = evas_list_append(rects, r); \
d = b->current.requested.y - (r->y + r->h);
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 ((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;
else
b->current.x = b->current.requested.x + resist_x;
@ -138,8 +151,9 @@ rects = evas_list_append(rects, r); \
if (dy != 0)
{
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;
else
b->current.y = b->current.requested.y + resist_y;

View File

@ -5,15 +5,24 @@
static void e_scrollbar_recalc(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_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_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_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_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_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_scrollbar_cleanup(E_Scrollbar * sb);
static void
e_scrollbar_recalc(E_Scrollbar * sb)
{
@ -23,8 +32,7 @@ e_scrollbar_recalc(E_Scrollbar *sb)
{
double x, y, w, h;
ebits_get_named_bit_geometry(sb->base, "Trough_Area",
&x, &y, &w, &h);
ebits_get_named_bit_geometry(sb->base, "Trough_Area", &x, &y, &w, &h);
sb->bar_area.x = x + sb->x;
sb->bar_area.y = y + sb->y;
sb->bar_area.w = w;
@ -71,16 +79,20 @@ e_scrollbar_setup_bits(E_Scrollbar *sb)
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);
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);
}
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);
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);
}
if (sb->base)
@ -92,26 +104,41 @@ e_scrollbar_setup_bits(E_Scrollbar *sb)
sb->w = w;
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", 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);
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",
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)
{
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", 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);
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",
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;
}
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;
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;
sb = data;
if (sb->mouse_down) D_RETURN;
if (sb->mouse_down)
D_RETURN;
sb->mouse_down = bt;
if (!class) D_RETURN;
if (!class)
D_RETURN;
prev = sb->val;
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("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 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 );
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 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"))
{
@ -168,41 +199,55 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
if (inc < 0) /* scroll up (or left) */
{
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) */
{
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 */
sb->val += sb->scroll_step;
if (sb->val < 0) sb->val = 0;
if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range;
if (sb->val < 0)
sb->val = 0;
if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
/* set a timer to keep on scrolling */
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
{
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
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 + sb->range) > sb->max) sb->val = sb->max - sb->range;
if (sb->val < 0)
sb->val = 0;
if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
}
}
e_scrollbar_recalc(sb);
if (sb->bar) 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->bar)
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 (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;
@ -214,7 +259,8 @@ e_sb_base_down_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y,
}
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;
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;
sb = data;
if (bt == sb->mouse_down) sb->mouse_down = 0;
else D_RETURN;
if (!class) D_RETURN;
if (bt == sb->mouse_down)
sb->mouse_down = 0;
else
D_RETURN;
if (!class)
D_RETURN;
if (!strcmp(class, "Scrollbar_Arrow1"))
{
@ -247,13 +296,15 @@ e_sb_base_up_cb(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
if (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);
}
else if (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);
}
}
@ -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
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;
D_ENTER;
sb = data;
if (sb->mouse_down) D_RETURN;
if (sb->mouse_down)
D_RETURN;
sb->mouse_down = bt;
sb->down_x = x;
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
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;
@ -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
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;
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;
sb = data;
if (!sb->mouse_down) D_RETURN;
if (!sb->mouse_down)
D_RETURN;
dx = x - sb->mouse_x;
dy = y - sb->mouse_y;
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;
if (sb->direction)
{
if (sb->bar_area.h > sb->bar_pos.h) sb->val +=
((double)dy * sb->max) / sb->bar_area.h;
else sb->val = 0;
if (sb->bar_area.h > sb->bar_pos.h)
sb->val += ((double)dy * sb->max) / sb->bar_area.h;
else
sb->val = 0;
}
else
{
if (sb->bar_area.w > sb->bar_pos.w) sb->val +=
((double)dx * sb->max) / sb->bar_area.w;
else sb->val = 0;
if (sb->bar_area.w > sb->bar_pos.w)
sb->val += ((double)dx * sb->max) / sb->bar_area.w;
else
sb->val = 0;
}
if (sb->val < 0) sb->val = 0;
if ((sb->val + sb->range) > sb->max) sb->val = sb->max - sb->range;
if (sb->val < 0)
sb->val = 0;
if ((sb->val + sb->range) > sb->max)
sb->val = sb->max - sb->range;
if (prev != sb->val)
{
e_scrollbar_recalc(sb);
if (sb->bar) 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->func_change) sb->func_change(sb->func_data, sb, sb->val);
if (sb->bar)
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->func_change)
sb->func_change(sb->func_data, sb, sb->val);
}
D_RETURN;
@ -380,7 +443,8 @@ e_sb_scroll_timer(int val, void *data)
if (sb->scroll_step < 0)
{
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);
ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0, sb);
@ -389,23 +453,25 @@ e_sb_scroll_timer(int val, void *data)
else if (sb->scroll_step > 0)
{
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);
ecore_add_event_timer(name, sb->scroll_speed, e_sb_scroll_timer, 0, sb);
}
e_scrollbar_recalc(sb);
if (sb->bar) 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->func_change) sb->func_change(sb->func_data, sb, sb->val);
if (sb->bar)
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->func_change)
sb->func_change(sb->func_data, sb, sb->val);
D_RETURN;
UN(val);
}
E_Scrollbar *
e_scrollbar_new(void)
{
@ -435,8 +501,10 @@ e_scrollbar_cleanup(E_Scrollbar *sb)
if (sb->evas)
{
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
if (sb->base)
ebits_free(sb->base);
if (sb->bar)
ebits_free(sb->bar);
}
IF_FREE(sb->dir);
@ -457,24 +525,34 @@ e_scrollbar_add_to_evas(E_Scrollbar *sb, Evas evas)
if (sb->evas)
{
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
if (sb->base)
ebits_free(sb->base);
if (sb->bar)
ebits_free(sb->bar);
}
sb->evas = evas;
if (sb->evas)
{
e_scrollbar_setup_bits(sb);
if (sb->base) ebits_set_layer(sb->base, sb->layer);
if (sb->bar) 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);
if (sb->base)
ebits_set_layer(sb->base, sb->layer);
if (sb->bar)
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);
if (sb->bar) 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->bar)
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->base) ebits_show(sb->base);
if (sb->bar) ebits_show(sb->bar);
if (sb->base)
ebits_show(sb->base);
if (sb->bar)
ebits_show(sb->bar);
}
}
@ -486,10 +564,13 @@ e_scrollbar_show(E_Scrollbar *sb)
{
D_ENTER;
if (sb->visible) D_RETURN;
if (sb->visible)
D_RETURN;
sb->visible = 1;
if (sb->base) ebits_show(sb->base);
if (sb->bar) ebits_show(sb->bar);
if (sb->base)
ebits_show(sb->base);
if (sb->bar)
ebits_show(sb->bar);
D_RETURN;
}
@ -499,10 +580,13 @@ e_scrollbar_hide(E_Scrollbar *sb)
{
D_ENTER;
if (!sb->visible) D_RETURN;
if (!sb->visible)
D_RETURN;
sb->visible = 0;
if (sb->base) ebits_hide(sb->base);
if (sb->bar) ebits_hide(sb->bar);
if (sb->base)
ebits_hide(sb->base);
if (sb->bar)
ebits_hide(sb->bar);
D_RETURN;
}
@ -512,8 +596,10 @@ e_scrollbar_raise(E_Scrollbar *sb)
{
D_ENTER;
if (sb->base) ebits_raise(sb->base);
if (sb->bar) ebits_raise(sb->bar);
if (sb->base)
ebits_raise(sb->base);
if (sb->bar)
ebits_raise(sb->bar);
D_RETURN;
}
@ -523,8 +609,10 @@ e_scrollbar_lower(E_Scrollbar *sb)
{
D_ENTER;
if (sb->bar) ebits_lower(sb->bar);
if (sb->base) ebits_lower(sb->base);
if (sb->bar)
ebits_lower(sb->bar);
if (sb->base)
ebits_lower(sb->base);
D_RETURN;
}
@ -534,10 +622,13 @@ e_scrollbar_set_layer(E_Scrollbar *sb, int l)
{
D_ENTER;
if (l == sb->layer) D_RETURN;
if (l == sb->layer)
D_RETURN;
sb->layer = l;
if (sb->base) ebits_set_layer(sb->base, sb->layer);
if (sb->bar) ebits_set_layer(sb->bar, sb->layer);
if (sb->base)
ebits_set_layer(sb->base, sb->layer);
if (sb->bar)
ebits_set_layer(sb->bar, sb->layer);
D_RETURN;
}
@ -547,14 +638,17 @@ e_scrollbar_set_direction(E_Scrollbar *sb, int d)
{
D_ENTER;
if (d == sb->direction) D_RETURN;
if (d == sb->direction)
D_RETURN;
sb->direction = d;
if (sb->evas)
{
Evas evas;
if (sb->base) ebits_free(sb->base);
if (sb->bar) ebits_free(sb->bar);
if (sb->base)
ebits_free(sb->base);
if (sb->bar)
ebits_free(sb->bar);
evas = sb->evas;
sb->evas = NULL;
e_scrollbar_add_to_evas(sb, evas);
@ -568,12 +662,15 @@ e_scrollbar_move(E_Scrollbar *sb, double x, double y)
{
D_ENTER;
if ((x == sb->x) && (y == sb->y)) D_RETURN;
if ((x == sb->x) && (y == sb->y))
D_RETURN;
sb->x = x;
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);
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;
}
@ -583,21 +680,25 @@ e_scrollbar_resize(E_Scrollbar *sb, double w, double h)
{
D_ENTER;
if ((w == sb->w) && (h == sb->h)) D_RETURN;
if ((w == sb->w) && (h == sb->h))
D_RETURN;
sb->w = w;
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);
if (sb->bar) 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->bar)
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;
}
void
e_scrollbar_set_change_func(E_Scrollbar * sb,
void (*func_change) (void *_data, E_Scrollbar *sb, double val),
void *data)
void (*func_change) (void *_data, E_Scrollbar * sb,
double val), void *data)
{
D_ENTER;
@ -612,14 +713,20 @@ e_scrollbar_set_value(E_Scrollbar *sb, double val)
{
D_ENTER;
if (val > sb->max - sb->range) val = sb->max - sb->range;
if (val < 0 ) val = 0;
if (sb->val == val) D_RETURN;
if (val > sb->max - sb->range)
val = sb->max - sb->range;
if (val < 0)
val = 0;
if (sb->val == val)
D_RETURN;
sb->val = val;
e_scrollbar_recalc(sb);
if (sb->bar) 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->func_change) sb->func_change(sb->func_data, sb, sb->val);
if (sb->bar)
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->func_change)
sb->func_change(sb->func_data, sb, sb->val);
D_RETURN;
}
@ -629,11 +736,14 @@ e_scrollbar_set_range(E_Scrollbar *sb, double range)
{
D_ENTER;
if (sb->range == range) D_RETURN;
if (sb->range == range)
D_RETURN;
sb->range = range;
e_scrollbar_recalc(sb);
if (sb->bar) 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->bar)
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;
}
@ -643,11 +753,14 @@ e_scrollbar_set_max(E_Scrollbar *sb, double max)
{
D_ENTER;
if (sb->max == max) D_RETURN;
if (sb->max == max)
D_RETURN;
sb->max = max;
e_scrollbar_recalc(sb);
if (sb->bar) 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->bar)
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;
}
@ -677,15 +790,19 @@ e_scrollbar_get_max(E_Scrollbar *sb)
}
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;
if (x) *x = sb->x;
if (y) *y = sb->y;
if (w) *w = sb->w;
if (h) *h = sb->h;
if (x)
*x = sb->x;
if (y)
*y = sb->y;
if (w)
*w = sb->w;
if (h)
*h = sb->h;
D_RETURN;
}

View File

@ -31,14 +31,19 @@ struct _E_Scrollbar
int scroll_step;
double scroll_speed;
struct {
struct
{
double x, y, w, h;
} bar_area;
struct {
}
bar_area;
struct
{
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;
};
@ -53,7 +58,12 @@ void e_scrollbar_set_direction(E_Scrollbar *sb, int d);
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_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 e_scrollbar_set_value(E_Scrollbar * sb, double val);
void e_scrollbar_set_range(E_Scrollbar * sb, double range);
@ -61,4 +71,5 @@ void e_scrollbar_set_max(E_Scrollbar *sb, double max);
double e_scrollbar_get_value(E_Scrollbar * sb);
double e_scrollbar_get_range(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);
ZERO(t, E_Text, 1);
t->state = strdup("normal");
if (class) t->class = strdup(class);
else t->class = strdup("");
if (text) t->text = strdup(text);
else t->text = strdup("");
if (class)
t->class = strdup(class);
else
t->class = strdup("");
if (text)
t->text = strdup(text);
else
t->text = strdup("");
t->evas = evas;
t->obj.o1 = evas_add_text(t->evas, "borzoib", 8, t->text);
t->obj.o2 = evas_add_text(t->evas, "borzoib", 8, t->text);
@ -78,8 +82,10 @@ e_text_set_text(E_Text *t, char *text)
{
D_ENTER;
if (!text) text = "";
if (!strcmp(t->text, text)) D_RETURN;
if (!text)
text = "";
if (!strcmp(t->text, text))
D_RETURN;
FREE(t->text);
t->text = strdup(text);
evas_set_text(t->evas, t->obj.o1, t->text);
@ -102,7 +108,8 @@ e_text_set_layer(E_Text *t, int l)
{
D_ENTER;
if (t->layer == l) D_RETURN;
if (t->layer == l)
D_RETURN;
t->layer = l;
evas_set_layer(t->evas, t->obj.o1, t->layer);
evas_set_layer(t->evas, t->obj.o2, t->layer);
@ -174,7 +181,8 @@ e_text_show(E_Text *t)
{
D_ENTER;
if (t->visible) D_RETURN;
if (t->visible)
D_RETURN;
t->visible = 1;
evas_show(t->evas, t->obj.o1);
evas_show(t->evas, t->obj.o2);
@ -190,7 +198,8 @@ e_text_hide(E_Text *t)
{
D_ENTER;
if (!t->visible) D_RETURN;
if (!t->visible)
D_RETURN;
t->visible = 0;
evas_hide(t->evas, t->obj.o1);
evas_hide(t->evas, t->obj.o2);
@ -207,14 +216,14 @@ e_text_set_color(E_Text *t, int r, int g, int b, int a)
D_ENTER;
if ((r == t->color.r) &&
(g == t->color.g) &&
(b == t->color.b) &&
(a == t->color.a)) D_RETURN;
(g == t->color.g) && (b == t->color.b) && (a == t->color.a))
D_RETURN;
t->color.r = r;
t->color.g = g;
t->color.b = b;
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;
}
@ -224,7 +233,8 @@ e_text_move(E_Text *t, double x, double y)
{
D_ENTER;
if ((t->x == x) && (t->y == y)) D_RETURN;
if ((t->x == x) && (t->y == y))
D_RETURN;
t->x = x;
t->y = y;
evas_move(t->evas, t->obj.o1, t->x + 1, t->y);
@ -241,7 +251,6 @@ e_text_resize(E_Text *t, double w, double h)
{
D_ENTER;
D_RETURN;
UN(t);
UN(w);
@ -253,10 +262,14 @@ e_text_get_geometry(E_Text *t, double *x, double *y, double *w, double *h)
{
D_ENTER;
if (x) *x = t->x;
if (y) *y = t->y;
if (w) *w = t->w;
if (h) *h = t->h;
if (x)
*x = t->x;
if (y)
*y = t->y;
if (w)
*w = t->w;
if (h)
*h = t->h;
D_RETURN;
}
@ -266,8 +279,10 @@ e_text_get_min_size(E_Text *t, double *w, double *h)
{
D_ENTER;
if (w) *w = t->min.w;
if (h) *h = t->min.h;
if (w)
*w = t->min.w;
if (h)
*h = t->min.h;
D_RETURN;
}
@ -277,8 +292,10 @@ e_text_get_max_size(E_Text *t, double *w, double *h)
{
D_ENTER;
if (w) *w = t->max.w;
if (h) *h = t->max.h;
if (w)
*w = t->max.w;
if (h)
*h = t->max.h;
D_RETURN;
}
@ -310,7 +327,6 @@ e_text_update_class(E_Text *t)
{
D_ENTER;
D_RETURN;
UN(t);
}

View File

@ -13,22 +13,28 @@ struct _E_Text
int visible;
double x, y, w, h;
struct {
struct
{
double w, h;
} min, max;
struct {
}
min , max;
struct
{
int r, g, b, a;
} color;
}
color;
int layer;
Evas evas;
struct {
struct
{
Evas_Object text;
Evas_Object o1;
Evas_Object o2;
Evas_Object o3;
Evas_Object o4;
} obj;
}
obj;
};
E_Text *e_text_new(Evas evas, char *text, char *class);
@ -44,7 +50,8 @@ 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_move(E_Text * t, double x, double y);
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,
double *w, double *h);
void e_text_get_min_size(E_Text * t, double *w, double *h);
void e_text_get_max_size(E_Text * t, double *w, double *h);
void e_text_set_state(E_Text * t, char *state);

View File

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

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;
#endif
typedef enum {
typedef enum
{
E_DND_NONE,
E_DND_COPY,
E_DND_MOVE,
@ -40,7 +40,8 @@ typedef enum {
E_DND_DELETED,
E_DND_COPIED,
E_DND_ICONBAR_ADD
} E_dnd_enum ;
}
E_dnd_enum;
struct _E_View
{
@ -50,29 +51,40 @@ struct _E_View
E_View_Model *model;
struct {
struct
{
Evas_Render_Method render_method;
int back_pixmap;
} options;
}
options;
Evas evas;
struct {
struct
{
Window base;
Window main;
} win;
}
win;
Pixmap pmap;
struct {
struct
{
int w, h;
int force;
} size;
struct {
}
size;
struct
{
int x, y;
} scroll;
struct {
}
scroll;
struct
{
int x, y;
} location;
}
location;
struct {
struct
{
/* +-----------------+
* | Wt |
* | +-----------+ |
@ -85,38 +97,51 @@ struct _E_View
* | Wb |
* +-----------------+
*/
struct {
struct
{
int l, r, t, b;
} window;
struct {
}
window;
struct
{
int s, g, b;
} icon;
} spacing;
struct {
}
icon;
}
spacing;
struct
{
int on;
/* The number of selected icons. */
int count;
/* The number of icons we selected the last time.
If this is > 0, we don't pop up menus when
the user clicks in a view. */
* If this is > 0, we don't pop up menus when
* the user clicks in a view. */
int last_count;
int x, y, w, h;
struct {
struct
{
int x, y;
} down;
}
down;
struct {
struct {
struct
{
struct
{
int r, g, b, a;
}
edge_l , edge_r, edge_t, edge_b,
middle,
grad_l, grad_r, grad_t, grad_b;
struct {
middle, grad_l, grad_r, grad_t, grad_b;
struct
{
int l, r, t, b;
} grad_size;
} config;
struct {
}
grad_size;
}
config;
struct
{
Evas_Object clip;
Evas_Object edge_l;
Evas_Object edge_r;
@ -127,41 +152,51 @@ struct _E_View
Evas_Object grad_r;
Evas_Object grad_t;
Evas_Object grad_b;
} obj;
} select;
}
obj;
}
select;
struct {
struct
{
int started;
Window win;
int x, y;
struct {
struct
{
int x, y;
} offset;
}
offset;
int update;
int drop_mode;
int icon_hide;
int icon_show;
int matching_drop_attempt;
} drag;
struct {
}
drag;
struct
{
int valid;
double x1, x2, y1, y2;
} extents;
}
extents;
E_Background bg;
struct {
struct
{
EfsdCmdId x, y, w, h;
int busy;
} geom_get;
}
geom_get;
EfsdCmdId getbg;
struct {
struct
{
E_Scrollbar *h, *v;
} scrollbar;
}
scrollbar;
int is_listing;
@ -177,8 +212,6 @@ struct _E_View
Ebits_Object epplet_layout;
};
/**
* e_view_init - View event handlers initialization.
*
@ -193,13 +226,17 @@ void e_view_deselect_all(E_View *v);
void e_view_deselect_all_except(E_Icon * not_ic);
Ecore_Event *e_view_get_current_event(void);
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,
int *max_x, int *max_y);
void e_view_icons_apply_xy(E_View * v);
void e_view_scroll_to(E_View * v, int sx, int sy);
void e_view_scroll_by(E_View * v, int sx, int sy);
void e_view_scroll_to_percent(E_View *v, double psx, 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_scroll_to_percent(E_View * v, double psx,
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_arrange(E_View * v);
@ -255,7 +292,6 @@ void e_view_realize(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);