* Replaced all the 4096's with PATH_MAX, added a default setting if

it doesn't exist.

* Renamed E_Action_Proto to E_Action_Impl. I think that's more intuitive

* Renamed the xxx_go functions to xxx_cont. It took me a while to understand the difference between "start" and "go".

* Some line wrapping and cosmetics.


SVN revision: 5475
This commit is contained in:
cpk 2001-10-12 20:13:01 +00:00 committed by cpk
parent d0d83ea1ca
commit a41a7d8875
17 changed files with 227 additions and 153 deletions

View File

@ -9,7 +9,7 @@
#include "util.h"
#include "guides.h"
static Evas_List action_protos = NULL;
static Evas_List action_impls = NULL;
static Evas_List current_actions = NULL;
static Evas_List current_timers = NULL;
@ -18,19 +18,19 @@ static void e_action_free(E_Action *a);
static void e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_move_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_move_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_move_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_resize_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_resize_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_resize_h_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_resize_h_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_resize_h_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_resize_v_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_resize_v_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_resize_v_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_resize_v_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
static void e_act_close_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
@ -103,7 +103,7 @@ e_action_find(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
if (!e_db_int_get(db, "/actions/count", &num)) goto error;
for (i = 0; i < num; i++)
{
char buf[4096];
char buf[PATH_MAX];
sprintf(buf, "/actions/%i/name", i);
a_name = e_db_str_get(db, buf);
@ -132,7 +132,7 @@ e_action_find(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
a->button = a_button;
a->key = a_key;
a->modifiers = a_modifiers;
a->action_proto = NULL;
a->action_impl = NULL;
a->object = NULL;
a->started = 0;
actions = evas_list_append(actions, a);
@ -172,9 +172,9 @@ e_action_find(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
(act <= ACT_KEY_UP) &&
(!((a->modifiers == -1) ||
(a->modifiers == (int)mods)))) goto next;
for (ll = action_protos; ll; ll = ll->next)
for (ll = action_impls; ll; ll = ll->next)
{
E_Action_Proto *ap;
E_Action_Impl *ap;
ap = ll->data;
if (!strcmp(ap->action, a->action))
@ -193,7 +193,7 @@ e_action_find(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
aa->button = a->button;
e_strdup(aa->key, a->key);
aa->modifiers = a->modifiers;
aa->action_proto = ap;
aa->action_impl = ap;
aa->object = o;
aa->started = 0;
current_actions = evas_list_append(current_actions, aa);
@ -235,9 +235,9 @@ e_action_start(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mo
a = l->data;
if (!a->started)
{
if (a->action_proto->func_stop)
if (a->action_impl->func_stop)
a->started = 1;
if (a->action_proto->func_start)
if (a->action_impl->func_start)
{
E_Object *obj;
@ -247,7 +247,7 @@ e_action_start(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mo
if (a->started)
OBJ_REF(obj);
}
a->action_proto->func_start(a->object, a, data, x, y, rx, ry);
a->action_impl->func_start(a->object, a, data, x, y, rx, ry);
}
}
if (!a->started)
@ -270,7 +270,7 @@ e_action_stop(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
E_Action *a;
a = l->data;
if ((a->started) && (a->action_proto->func_stop))
if ((a->started) && (a->action_impl->func_stop))
{
int ok = 0;
@ -309,7 +309,7 @@ e_action_stop(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
obj = a->object;
OBJ_UNREF(obj);
}
a->action_proto->func_stop(a->object, a, data, x, y, rx, ry);
a->action_impl->func_stop(a->object, a, data, x, y, rx, ry);
a->started = 0;
}
}
@ -327,7 +327,8 @@ e_action_stop(char *action, E_Action_Type act, int button, char *key, Ev_Key_Mod
}
void
e_action_go(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry, int dx, int dy)
e_action_cont(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods,
void *o, void *data, int x, int y, int rx, int ry, int dx, int dy)
{
Evas_List l;
@ -336,8 +337,8 @@ e_action_go(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modif
E_Action *a;
a = l->data;
if ((a->started) && (a->action_proto->func_go))
a->action_proto->func_go(a->object, a, data, x, y, rx, ry, dx, dy);
if ((a->started) && (a->action_impl->func_cont))
a->action_impl->func_cont(a->object, a, data, x, y, rx, ry, dx, dy);
}
return;
UN(action);
@ -369,8 +370,8 @@ e_action_stop_by_object(void *o, void *data, int x, int y, int rx, int ry)
obj = a->object;
OBJ_UNREF(obj);
}
if (a->action_proto->func_stop)
a->action_proto->func_stop(a->object, a, data, x, y, rx, ry);
if (a->action_impl->func_stop)
a->action_impl->func_stop(a->object, a, data, x, y, rx, ry);
a->started = 0;
current_actions = evas_list_remove(current_actions, a);
OBJ_DO_FREE(a);
@ -389,7 +390,7 @@ e_action_stop_by_type(char *action)
E_Action *a;
a = l->data;
if ((a->started) && (a->action_proto->func_stop) &&
if ((a->started) && (a->action_impl->func_stop) &&
(action) && (!strcmp(action, a->name)))
{
E_Object *obj;
@ -399,7 +400,7 @@ e_action_stop_by_type(char *action)
obj = a->object;
OBJ_UNREF(obj);
}
a->action_proto->func_stop(a->object, a, NULL, 0, 0, 0, 0);
a->action_impl->func_stop(a->object, a, NULL, 0, 0, 0, 0);
a->started = 0;
}
}
@ -409,20 +410,20 @@ e_action_stop_by_type(char *action)
void
e_action_add_proto(char *action,
void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry),
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry),
void (*func_go) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy))
void (*func_cont) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy),
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry))
{
E_Action_Proto *ap;
E_Action_Impl *ap;
ap = NEW(E_Action_Proto, 1);
ap = NEW(E_Action_Impl, 1);
OBJ_INIT(ap, NULL);
e_strdup(ap->action, action);
ap->func_start = func_start;
ap->func_cont = func_cont;
ap->func_stop = func_stop;
ap->func_go = func_go;
action_protos = evas_list_append(action_protos, ap);
action_impls = evas_list_append(action_impls, ap);
}
void
@ -486,10 +487,10 @@ e_action_del_timer_object(void *o)
void
e_action_init(void)
{
e_action_add_proto("Window_Move", e_act_move_start, e_act_move_stop, e_act_move_go);
e_action_add_proto("Window_Resize", e_act_resize_start, e_act_resize_stop, e_act_resize_go);
e_action_add_proto("Window_Resize_Horizontal", e_act_resize_h_start, e_act_resize_h_stop, e_act_resize_h_go);
e_action_add_proto("Window_Resize_Vertical", e_act_resize_v_start, e_act_resize_v_stop, e_act_resize_v_go);
e_action_add_proto("Window_Move", e_act_move_start, e_act_move_cont, e_act_move_stop);
e_action_add_proto("Window_Resize", e_act_resize_start, e_act_resize_cont, e_act_resize_stop);
e_action_add_proto("Window_Resize_Horizontal", e_act_resize_h_start, e_act_resize_h_cont, e_act_resize_h_stop);
e_action_add_proto("Window_Resize_Vertical", e_act_resize_v_start, e_act_resize_v_cont, e_act_resize_v_stop);
e_action_add_proto("Window_Close", e_act_close_start, NULL, NULL);
e_action_add_proto("Window_Kill", e_act_kill_start, NULL, NULL);
e_action_add_proto("Window_Shade", e_act_shade_start, NULL, NULL);
@ -555,7 +556,7 @@ e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
b->previous.requested.dx = 0;
b->previous.requested.dy = 0;
{
char buf[4096];
char buf[PATH_MAX];
e_border_print_pos(buf, b);
e_guides_set_display_alignment(align_x, align_y);
@ -611,7 +612,7 @@ e_act_move_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
}
static void
e_act_move_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
e_act_move_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
{
E_Border *b;
@ -709,7 +710,7 @@ e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int
}
}
{
char buf[4096];
char buf[PATH_MAX];
e_border_print_size(buf, b);
e_guides_set_display_alignment(align_x, align_y);
@ -761,7 +762,7 @@ e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int
}
static void
e_act_resize_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
e_act_resize_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
{
E_Border *b;
@ -858,7 +859,7 @@ e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, in
/* e_border_set_gravity(b, NorthEastGravity);*/
}
{
char buf[4096];
char buf[PATH_MAX];
e_border_print_size(buf, b);
e_guides_set_display_alignment(align_x, align_y);
@ -910,7 +911,7 @@ e_act_resize_h_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in
}
static void
e_act_resize_h_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
e_act_resize_h_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
{
E_Border *b;
@ -994,7 +995,7 @@ e_act_resize_v_start (void *o, E_Action *a, void *data, int x, int y, int rx, in
/* e_border_set_gravity(b, SouthWestGravity);*/
}
{
char buf[4096];
char buf[PATH_MAX];
e_border_print_size(buf, b);
e_guides_set_display_alignment(align_x, align_y);
@ -1046,7 +1047,7 @@ e_act_resize_v_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in
}
static void
e_act_resize_v_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
e_act_resize_v_cont (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy)
{
E_Border *b;

View File

@ -4,7 +4,7 @@
#include "e.h"
typedef struct _E_Action E_Action;
typedef struct _E_Action_Proto E_Action_Proto;
typedef struct _E_Action_Impl E_Action_Impl;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
typedef enum e_action_type
@ -39,20 +39,20 @@ struct _E_Action
int button;
char *key;
int modifiers;
E_Action_Proto *action_proto;
E_Action_Impl *action_impl;
void *object;
int started;
int grabbed;
};
struct _E_Action_Proto
struct _E_Action_Impl
{
OBJ_PROPERTIES;
char *action;
void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
void (*func_cont) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
void (*func_go) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy);
};
@ -62,15 +62,15 @@ void e_action_start(char *action, E_Action_Type act, int button, char *key,
void e_action_stop(char *action, E_Action_Type act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry);
void e_action_go(char *action, E_Action_Type act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry, int dx, int dy);
void e_action_cont(char *action, E_Action_Type act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry, int dx, int dy);
void e_action_stop_by_object(void *o, void *data, int x, int y, int rx, int ry);
void e_action_stop_by_type(char *action);
void e_action_add_proto(char *action,
void (*func_start) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry),
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry),
void (*func_go) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy));
void (*func_cont) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry, int dx, int dy),
void (*func_stop) (void *o, E_Action *a, void *data, int x, int y, int rx, int ry));
void e_action_del_timer(void *o, char *name);
void e_action_add_timer(void *o, char *name);
void e_action_del_timer_object(void *o);

View File

@ -61,7 +61,7 @@ e_background_load(char *file)
for (i = 0; i < num; i++)
{
E_Background_Layer *bl;
char buf[4096];
char buf[PATH_MAX];
bl = NEW(E_Background_Layer, 1);
ZERO(bl, E_Background_Layer, 1);

View File

@ -46,11 +46,16 @@ static void e_mouse_in(Eevent * ev);
static void e_mouse_out(Eevent * ev);
static void e_window_expose(Eevent * ev);
static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt,
int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt,
int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt,
int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt,
int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt,
int x, int y, int ox, int oy, int ow, int oh);
static void e_cb_border_mouse_in(E_Border *b, Eevent *e);
static void e_cb_border_mouse_out(E_Border *b, Eevent *e);
@ -428,7 +433,7 @@ e_focus_out(Eevent * ev)
/* char *settings_db; */
/* E_DB_File *db; */
int focus_mode;
/* char buf[4096]; */
/* char buf[PATH_MAX]; */
E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0);
E_CONFIG_INT_GET(cfg_focus_mode, focus_mode);
@ -448,7 +453,8 @@ e_focus_out(Eevent * ev)
g->any_mod = 1;
g->remove_after = 1;
b->grabs = evas_list_append(b->grabs, g);
e_button_grab(b->win.main, 0, XEV_BUTTON | XEV_MOUSE_MOVE, EV_KEY_MODIFIER_NONE, 1);
e_button_grab(b->win.main, 0,
XEV_BUTTON | XEV_MOUSE_MOVE, EV_KEY_MODIFIER_NONE, 1);
}
}
b->changed = 1;
@ -751,7 +757,8 @@ e_window_expose(Eevent * ev)
/* what to do with border events */
static void
e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
e_cb_mouse_in(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Border *b;
@ -762,8 +769,11 @@ e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int
if (class) e_cursors_display_in_window(b->win.main, class);
else e_cursors_display_in_window(b->win.main, "Default");
if (!current_ev) return;
e_action_stop(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_stop(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
return;
UN(o);
UN(bt);
@ -774,7 +784,8 @@ e_cb_mouse_in(void *data, Ebits_Object o, char *class, int bt, int x, int y, int
}
static void
e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
e_cb_mouse_out(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Border *b;
@ -784,8 +795,10 @@ e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, in
border_mouse_y = mouse_y;
if (!current_ev) return;
e_cursors_display_in_window(b->win.main, "Default");
e_action_stop(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_stop(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
return;
UN(o);
UN(bt);
@ -796,7 +809,8 @@ e_cb_mouse_out(void *data, Ebits_Object o, char *class, int bt, int x, int y, in
}
static void
e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
e_cb_mouse_down(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Border *b;
@ -811,10 +825,16 @@ e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
mods = ((Ev_Mouse_Down *)(current_ev->event))->mods;
act = ACT_MOUSE_CLICK;
if (((Ev_Mouse_Down *)(current_ev->event))->double_click) act = ACT_MOUSE_DOUBLE;
else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click) act = ACT_MOUSE_TRIPLE;
e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
if (((Ev_Mouse_Down *)(current_ev->event))->double_click)
act = ACT_MOUSE_DOUBLE;
else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click)
act = ACT_MOUSE_TRIPLE;
e_action_stop(class, act, bt, NULL, mods, b,
NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b,
NULL, x, y, border_mouse_x, border_mouse_y);
}
return;
UN(o);
@ -825,7 +845,8 @@ e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
}
static void
e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
e_cb_mouse_up(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Border *b;
@ -840,17 +861,22 @@ e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int
mods = ((Ev_Mouse_Up *)(current_ev->event))->mods;
act = ACT_MOUSE_UP;
if ((x >= ox) && (x < (ox + ow)) && (y >= oy) && (y < (oy + oh)))
act = ACT_MOUSE_CLICKED;
e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_stop(class, act, bt, NULL, mods, b,
NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b,
NULL, x, y, border_mouse_x, border_mouse_y);
}
return;
UN(o);
}
static void
e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, int ox, int oy, int ow, int oh)
e_cb_mouse_move(void *data, Ebits_Object o, char *class,
int bt, int x, int y, int ox, int oy, int ow, int oh)
{
E_Border *b;
int dx, dy;
@ -860,8 +886,13 @@ e_cb_mouse_move(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
dy = mouse_y - border_mouse_y;
border_mouse_x = mouse_x;
border_mouse_y = mouse_y;
if (!current_ev) return;
e_action_go(class, ACT_MOUSE_MOVE, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y, dx, dy);
if (!current_ev)
return;
e_action_cont(class, ACT_MOUSE_MOVE, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y, dx, dy);
return;
UN(o);
UN(bt);
@ -886,10 +917,14 @@ e_cb_border_mouse_in(E_Border *b, Eevent *e)
border_mouse_y = mouse_y;
border_mouse_buttons = mouse_buttons;
if (!current_ev) return;
x = ((Ev_Window_Enter *)(e->event))->x;
y = ((Ev_Window_Enter *)(e->event))->y;
e_action_stop(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_stop(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_IN, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
}
static void
@ -908,8 +943,11 @@ e_cb_border_mouse_out(E_Border *b, Eevent *e)
border_mouse_y = mouse_y;
border_mouse_buttons = mouse_buttons;
if (!current_ev) return;
e_action_stop(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_stop(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, ACT_MOUSE_OUT, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y);
return;
UN(e);
}
@ -961,10 +999,16 @@ e_cb_border_mouse_down(E_Border *b, Eevent *e)
mods = ((Ev_Mouse_Down *)(current_ev->event))->mods;
act = ACT_MOUSE_CLICK;
if (((Ev_Mouse_Down *)(current_ev->event))->double_click) act = ACT_MOUSE_DOUBLE;
else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click) act = ACT_MOUSE_TRIPLE;
e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
if (((Ev_Mouse_Down *)(current_ev->event))->double_click)
act = ACT_MOUSE_DOUBLE;
else if (((Ev_Mouse_Down *)(current_ev->event))->triple_click)
act = ACT_MOUSE_TRIPLE;
e_action_stop(class, act, bt, NULL, mods, b, NULL,
x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b, NULL,
x, y, border_mouse_x, border_mouse_y);
}
/*
* e_pointer_ungrab(((Ev_Mouse_Up *)(e->event))->time);
@ -992,8 +1036,10 @@ e_cb_border_mouse_up(E_Border *b, Eevent *e)
mods = ((Ev_Mouse_Up *)(current_ev->event))->mods;
act = ACT_MOUSE_UP;
e_action_stop(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b, NULL, x, y, border_mouse_x, border_mouse_y);
e_action_stop(class, act, bt, NULL, mods, b,
NULL, x, y, border_mouse_x, border_mouse_y);
e_action_start(class, act, bt, NULL, mods, b,
NULL, x, y, border_mouse_x, border_mouse_y);
}
}
@ -1011,7 +1057,8 @@ e_cb_border_mouse_move(E_Border *b, Eevent *e)
if (!current_ev) return;
x = ((Ev_Mouse_Move *)(e->event))->x;
y = ((Ev_Mouse_Move *)(e->event))->y;
e_action_go(class, ACT_MOUSE_MOVE, 0, NULL, EV_KEY_MODIFIER_NONE, b, NULL, x, y, border_mouse_x, border_mouse_y, dx, dy);
e_action_cont(class, ACT_MOUSE_MOVE, 0, NULL, EV_KEY_MODIFIER_NONE,
b, NULL, x, y, border_mouse_x, border_mouse_y, dx, dy);
}
static void
@ -1041,7 +1088,7 @@ void
e_border_apply_border(E_Border *b)
{
int pl, pr, pt, pb;
char *borders, buf[4096], border[4096], *style = NULL, *match_style;
char *borders, buf[PATH_MAX], border[PATH_MAX], *style = NULL, *match_style;
int prop_selected = 0, prop_sticky = 0, prop_shaded = 0;
style = "default";
@ -1080,15 +1127,18 @@ e_border_reshape(E_Border *b)
(b->current.has_shape == b->previous.has_shape) &&
(!b->shape_changed))
return;
if (!shape_win) shape_win = e_window_override_new(0, 0, 0, 1, 1);
pl = pr = pt = pb = 0;
if (b->bits.t) ebits_get_insets(b->bits.t, &pl, &pr, &pt, &pb);
b->shape_changed = 0;
if ((!b->current.shaped_client) && (!b->current.has_shape))
{
e_window_set_shape_mask(b->win.main, 0);
return;
}
if ((b->current.shaped_client) && (!b->current.has_shape))
{
XRectangle rects[4];
@ -1104,15 +1154,20 @@ e_border_reshape(E_Border *b)
e_window_resize(shape_win, b->current.w, b->current.h);
e_window_set_shape_window(shape_win, b->win.client, pl, pt - b->current.shaded);
e_window_clip_shape_by_rectangle(shape_win, pl, pt, b->current.w - pl - pr, b->current.h - pt - pb);
e_window_clip_shape_by_rectangle(shape_win, pl, pt,
b->current.w - pl - pr, b->current.h - pt - pb);
e_window_add_shape_rectangles(shape_win, rects, 4);
e_window_set_shape_window(b->win.main, shape_win, 0, 0);
return;
}
if ((!b->current.shaped_client) && (b->current.has_shape))
{
e_window_resize(shape_win, b->current.w, b->current.h);
e_window_set_shape_rectangle(shape_win, pl, pt - b->current.shaded, b->current.w - pl - pr, b->current.h - pt - pb);
e_window_set_shape_rectangle(shape_win, pl, pt - b->current.shaded,
b->current.w - pl - pr, b->current.h - pt - pb);
/* FIXME: later when i actually generate shape masks for borders */
{
XRectangle rects[4];
@ -1134,7 +1189,9 @@ e_border_reshape(E_Border *b)
{
e_window_resize(shape_win, b->current.w, b->current.h);
e_window_set_shape_window(shape_win, b->win.client, pl, pt - b->current.shaded);
e_window_clip_shape_by_rectangle(shape_win, pl, pt, b->current.w - pl - pr, b->current.h - pt - pb);
e_window_clip_shape_by_rectangle(shape_win, pl, pt,
b->current.w - pl - pr, b->current.h - pt - pb);
/* FIXME: later when i actually generate shape masks for borders */
{
XRectangle rects[4];
@ -1149,6 +1206,7 @@ e_border_reshape(E_Border *b)
rects[3].width = b->current.w; rects[3].height = pb;
e_window_add_shape_rectangles(shape_win, rects, 4);
}
e_window_set_shape_window(b->win.main, shape_win, 0, 0);
return;
}
@ -1544,7 +1602,7 @@ e_border_attach_mouse_grabs(E_Border *b)
char *grabs_db;
E_DB_File *db;
int focus_mode;
char buf[4096];
char buf[PATH_MAX];
E_CFG_INT(cfg_focus_mode, "settings", "/focus/mode", 0);
E_CONFIG_INT_GET(cfg_focus_mode, focus_mode);

View File

@ -13,21 +13,21 @@ static char cfg_root[] = "";
} \
}
static char cfg_grabs_db[4096] = "";
static char cfg_settings_db[4096] = "";
static char cfg_actions_db[4096] = "";
static char cfg_borders_db[4096] = "";
static char cfg_apps_menu_db[4096] = "";
static char cfg_menus_dir[4096] = "";
static char cfg_entries_dir[4096] = "";
static char cfg_selections_dir[4096] = "";
static char cfg_scrollbars_dir[4096] = "";
static char cfg_guides_dir[4096] = "";
static char cfg_user_dir[4096] = "";
static char cfg_images_dir[4096] = "";
static char cfg_cursors_dir[4096] = "";
static char cfg_backgrounds_dir[4096] = "";
static char cfg_fonts_dir[4096] = "";
static char cfg_grabs_db[PATH_MAX] = "";
static char cfg_settings_db[PATH_MAX] = "";
static char cfg_actions_db[PATH_MAX] = "";
static char cfg_borders_db[PATH_MAX] = "";
static char cfg_apps_menu_db[PATH_MAX] = "";
static char cfg_menus_dir[PATH_MAX] = "";
static char cfg_entries_dir[PATH_MAX] = "";
static char cfg_selections_dir[PATH_MAX] = "";
static char cfg_scrollbars_dir[PATH_MAX] = "";
static char cfg_guides_dir[PATH_MAX] = "";
static char cfg_user_dir[PATH_MAX] = "";
static char cfg_images_dir[PATH_MAX] = "";
static char cfg_cursors_dir[PATH_MAX] = "";
static char cfg_backgrounds_dir[PATH_MAX] = "";
static char cfg_fonts_dir[PATH_MAX] = "";
char *
e_config_get(char *type)
@ -81,7 +81,7 @@ e_config_get(char *type)
void
e_config_init(void)
{
char buf[4096];
char buf[PATH_MAX];
#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());
@ -179,7 +179,7 @@ void *
e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
{
E_DB_File *db;
char buf[4096];
char buf[PATH_MAX];
Evas_List l;
char *data;

View File

@ -61,7 +61,7 @@ e_cursors_find(char *type)
c = l->data;
if (!strcmp(c->type, type))
{
char buf[4096];
char buf[PATH_MAX];
sprintf(buf, "%s/%s.db", e_config_get("cursors"), type);
if (e_file_modified_time(buf) > c->mod)
@ -93,7 +93,7 @@ e_cursors_display_in_window(Window win, char *type)
int br = 0, bg = 0, bb = 0;
int w = 32, h = 32;
int ok;
char buf[4096];
char buf[PATH_MAX];
Imlib_Image im;
c = NEW(E_Cursor, 1);

View File

@ -187,7 +187,7 @@ e_desktops_init_file_display(E_Desktop *desk)
/* FIXME: load bg here */
{
char buf[4096];
char buf[PATH_MAX];
sprintf(buf, "%s/default.bg.db", e_config_get("backgrounds"));
v->bg = e_background_load(buf);

View File

@ -8,6 +8,7 @@
#include <unistd.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ipc.h>
@ -25,6 +26,10 @@
#include <Ecore.h>
#include <Edb.h>
#ifndef PATH_MAX
#define PATH_MAX 4095
#endif
#if 0
#include <execinfo.h>
#define BT \

View File

@ -201,7 +201,7 @@ static void
e_entry_realize(E_Entry *entry)
{
char *entries;
char buf[4096];
char buf[PATH_MAX];
entries = e_config_get("entries");
sprintf(buf, "%s/%s", entries, "base.bits.db");

View File

@ -16,7 +16,7 @@ void
e_exec_restart(void)
{
int i, num;
char exe[4096];
char exe[PATH_MAX];
printf("e_exec_restart()\n");
/* unset events on root */
@ -75,8 +75,8 @@ pid_t
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[4096];
char preload[4096];
char preload_paths[PATH_MAX];
char preload[PATH_MAX];
char *exe2;
pid_t pid;

View File

@ -151,7 +151,7 @@ e_guides_update(void)
if ((guides.win.display) && (redraw))
{
int dx, dy, dw, dh, sw, sh, mw, mh;
char file[4096];
char file[PATH_MAX];
if (!guides.disp.text)
{

View File

@ -712,7 +712,7 @@ void
e_menu_set_background(E_Menu *m)
{
char *menus;
char buf[4096];
char buf[PATH_MAX];
char *style = "default";
char *part;
int pl, pr, pt, pb;
@ -752,7 +752,7 @@ void
e_menu_set_sel(E_Menu *m, E_Menu_Item *mi)
{
char *menus;
char buf[4096];
char buf[PATH_MAX];
char *style = "default";
int pl, pr, pt, pb;
int has_sub = 0;
@ -796,7 +796,7 @@ void
e_menu_set_sep(E_Menu *m, E_Menu_Item *mi)
{
char *menus;
char buf[4096];
char buf[PATH_MAX];
char *style = "default";
int pl, pr, pt, pb, minx, miny;
@ -831,7 +831,7 @@ void
e_menu_set_state(E_Menu *m, E_Menu_Item *mi)
{
char *menus;
char buf[4096];
char buf[PATH_MAX];
char *style = "default";
int on;
int pl, pr, pt, pb, minx, miny;

View File

@ -138,7 +138,7 @@ static E_Menu *
e_build_menu_db_build_number(E_Build_Menu *bm, E_DB_File *db, int num)
{
E_Menu *menu;
char buf[4096];
char buf[PATH_MAX];
int num2, i2;
sprintf(buf, "/menu/%i/count", num);
@ -229,7 +229,7 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
/* build the order of things to scan ...*/
{
FILE *f;
char buf[4096];
char buf[PATH_MAX];
Evas_List dirlist = NULL;
/* read .order file */
@ -237,7 +237,7 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
f = fopen(buf, "rb");
if (f)
{
while (fgets(buf, 4096, f))
while (fgets(buf, PATH_MAX, f))
{
int buf_len;
@ -284,7 +284,7 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
for (l = entries; l; l = l->next)
{
char *s;
char buf[4096];
char buf[PATH_MAX];
E_Menu_Item *menuitem;
char *icon, *name, *exe;
E_Menu *sub;
@ -316,7 +316,7 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
else continue;
if (f)
{
while (fgets(buf, 4096, f))
while (fgets(buf, PATH_MAX, f))
{
int buf_len;
@ -345,7 +345,7 @@ e_build_menu_gnome_apps_build_dir(E_Build_Menu *bm, char *dir)
eq = strchr(buf, '=');
if (eq)
{
char buf2[4096];
char buf2[PATH_MAX];
sprintf(buf2, "/usr/share/pixmaps/%s", eq +1);
icon = strdup(buf2);

View File

@ -40,9 +40,9 @@ e_mouse_move(Eevent * ev)
e = ev->event;
if (!win_place) return;
e_action_go("Window_Place", ACT_MOUSE_MOVE, 1, NULL,
EV_KEY_MODIFIER_NONE, NULL, NULL, e->x, e->y, e->rx, e->ry,
e->rx - prx, e->ry - pry);
e_action_cont("Window_Place", ACT_MOUSE_MOVE, 1, NULL,
EV_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;
}
@ -454,22 +454,32 @@ e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y)
w = b->current.requested.w;
h = b->current.requested.h;
if (w < desk->real.w) *x = (rand() % (desk->real.w - w));
else *x = 0;
if (h < desk->real.h) *y = (rand() % (desk->real.h - h));
else *y = 0;
if (w < desk->real.w)
*x = (rand() % (desk->real.w - w));
else
*x = 0;
if (h < desk->real.h)
*y = (rand() % (desk->real.h - h));
else
*y = 0;
return 1;
}
int
e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode)
{
if (b->client.no_place) return 1;
if (b->client.no_place)
return 1;
if (mode == E_PLACE_MANUAL) return e_place_manual (b, desk, x, y);
if (mode == E_PLACE_SMART) return e_place_smart (b, desk, x, y);
if (mode == E_PLACE_MIDDLE) return e_place_middle (b, desk, x, y);
if (mode == E_PLACE_CASCADE) return e_place_cascade(b, desk, x, y);
if (mode == E_PLACE_RANDOM) return e_place_random (b, desk, x, y);
return 1;
}

View File

@ -57,7 +57,7 @@ e_scrollbar_recalc(E_Scrollbar *sb)
static void
e_scrollbar_setup_bits(E_Scrollbar *sb)
{
char buf[4096];
char buf[PATH_MAX];
if (sb->direction == 1)
{

View File

@ -12,7 +12,7 @@ e_file_modified_time(char *file)
void
e_set_env(char *variable, char *content)
{
char env[4096];
char env[PATH_MAX];
sprintf(env, "%s=%s", variable, content);
putenv(env);
@ -62,7 +62,7 @@ int
e_file_cp(char *src, char *dst)
{
FILE *f1, *f2;
char buf[4096];
char buf[PATH_MAX];
size_t num;
f1 = fopen(src, "rb");
@ -73,7 +73,7 @@ e_file_cp(char *src, char *dst)
fclose(f1);
return 0;
}
while ((num = fread(buf, 1, 4096, f1)) > 0) fwrite(buf, 1, num, f2);
while ((num = fread(buf, 1, PATH_MAX, f1)) > 0) fwrite(buf, 1, num, f2);
fclose(f1);
fclose(f2);
return 1;
@ -82,7 +82,7 @@ e_file_cp(char *src, char *dst)
char *
e_file_real(char *file)
{
char buf[4096];
char buf[PATH_MAX];
char *f;
if (!realpath(file, buf)) return strdup("");
@ -111,7 +111,7 @@ e_file_get_dir(char *file)
{
char *p;
char *f;
char buf[4096];
char buf[PATH_MAX];
strcpy(buf, file);
p = strrchr(buf, '/');
@ -174,7 +174,7 @@ e_file_can_exec(struct stat *st)
char *
e_file_link(char *link)
{
char buf[4096];
char buf[PATH_MAX];
char *f;
int count;

View File

@ -64,7 +64,7 @@ e_view_write_icon_xy_timeout(int val, void *data)
ic = l->data;
if (ic->q.write_xy)
{
char buf[4096];
char buf[PATH_MAX];
ic->q.write_xy = 0;
sprintf(buf, "%s/%s", ic->view->dir, ic->file);
@ -451,7 +451,7 @@ e_bg_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
void
e_view_icon_update_state(E_Icon *ic)
{
char icon[4096];
char icon[PATH_MAX];
int iw, ih;
int gw, gh;
@ -476,7 +476,7 @@ e_view_icon_update_state(E_Icon *ic)
(!ic->obj.sel.under.icon) &&
(!ic->obj.sel.over.icon))
{
char file[4096];
char file[PATH_MAX];
/*
sprintf(file, "%s/file.bits.db", e_config_get("selections"));
@ -609,7 +609,7 @@ e_view_icon_exec(E_Icon *ic)
if (!strcmp(ic->info.mime.base, "dir"))
{
E_View *v;
char buf[4096];
char buf[PATH_MAX];
v = e_view_new();
v->size.w = 400;
@ -617,7 +617,7 @@ e_view_icon_exec(E_Icon *ic)
v->options.back_pixmap = 0;
/* Load default bg then handle bg in metadata */
{
char buf[4096];
char buf[PATH_MAX];
sprintf(buf, "%s/view.bg.db", e_config_get("backgrounds"));
v->bg = e_background_load(buf);
@ -1051,7 +1051,7 @@ e_icon_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y)
double ix, iy;
int icx, icy;
Imlib_Image im2;
char icon[4096];
char icon[PATH_MAX];
evas_get_geometry(ic->view->evas,
ic->obj.icon,
@ -1189,7 +1189,7 @@ e_view_geometry_record_timeout(int val, void *data)
void
e_view_queue_geometry_record(E_View *v)
{
char name[4096];
char name[PATH_MAX];
sprintf(name, "geometry_record.%s", v->dir);
e_add_event_timer(name, 0.10, e_view_geometry_record_timeout, 0, v);
@ -1198,7 +1198,7 @@ e_view_queue_geometry_record(E_View *v)
void
e_view_queue_icon_xy_record(E_View *v)
{
char name[4096];
char name[PATH_MAX];
sprintf(name, "icon_xy_record.%s", v->dir);
e_add_event_timer(name, 0.10, e_view_write_icon_xy_timeout, 0, v);
@ -1944,7 +1944,7 @@ e_view_resort_timeout(int val, void *data)
void
e_view_queue_resort(E_View *v)
{
char name[4096];
char name[PATH_MAX];
if (v->have_resort_queued) return;
v->have_resort_queued = 1;
@ -2013,8 +2013,8 @@ e_view_icon_set_mime(E_Icon *ic, char *base, char *mime)
}
/* find an icon */
{
char icon[4096];
char type[4096];
char icon[PATH_MAX];
char type[PATH_MAX];
char *p;
int done = 0;
@ -2185,7 +2185,7 @@ e_view_find_by_monitor_id(int id)
void
e_view_free(E_View *v)
{
char name[4096];
char name[PATH_MAX];
sprintf(name, "resort_timer.%s", v->dir);
e_del_event_timer(name);
@ -2534,7 +2534,7 @@ e_view_handle_fs(EfsdEvent *ev)
(ev->efsd_reply_event.data))
{
char *m, *p;
char mime[4096], base[4096];
char mime[PATH_MAX], base[PATH_MAX];
m = ev->efsd_reply_event.data;
p = strchr(m, '/');