Okay Raster, don't shoot me. I've cleaned up the whole thing. I've

added header files for most of the logical units, which greatly
reduces the size of e.h. The dependencies are probably still a bit
too dense, I'll look at that next. Things don't get rebuilt completely
any more when efsd is updated. I've also started command line options.
Only version info and the display variable are recognized so far.
I see no warnings here on my machine. Hope I didn't break anything.


SVN revision: 5014
This commit is contained in:
cpk 2001-07-30 16:59:37 +00:00 committed by cpk
parent f1689e5a66
commit 637e5ce74b
38 changed files with 1207 additions and 938 deletions

View File

@ -1,3 +1,3 @@
The Rasterman <raster@rasterman.com>
Christian Kreibich <cK@whoop.org>, <kreibich@aciri.org>
Christian Kreibich <cK@whoop.org>
Burra <burra@colorado.edu>

View File

@ -1,3 +1,7 @@
#undef ENLIGHTENMENT_VERSION
#undef ENLIGHTENMENT_MAJOR
#undef ENLIGHTENMENT_MINOR
#undef ENLIGHTENMENT_MICRO
#undef ENABLE_NLS
#undef HAVE_CATGETS
#undef HAVE_GETTEXT

View File

@ -1,9 +1,26 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(configure.in)
AM_INIT_AUTOMAKE(enlightenment, 0.17.pre_0)
ENLIGHTENMENT_MAJOR=0
ENLIGHTENMENT_MINOR=17
ENLIGHTENMENT_MICRO=pre_0
ENLIGHTENMENT_VERSION=$ENLIGHTENMENT_MAJOR.$ENLIGHTENMENT_MINOR.$ENLIGHTENMENT_MICRO
VERSION=$ENLIGHTENMENT_VERSION
AM_INIT_AUTOMAKE(enlightenment, $VERSION)
AM_CONFIG_HEADER(config.h)
AC_DEFINE_UNQUOTED(ENLIGHTENMENT_VERSION, "$ENLIGHTENMENT_VERSION")
AC_SUBST(ENLIGHTENMENT_VERSION)
AC_DEFINE_UNQUOTED(ENLIGHTENMENT_MAJOR, "$ENLIGHTENMENT_MAJOR")
AC_SUBST(ENLIGHTENMENT_MAJOR)
AC_DEFINE_UNQUOTED(ENLIGHTENMENT_MINOR, "$ENLIGHTENMENT_MINOR")
AC_SUBST(ENLIGHTENMENT_MINOR)
AC_DEFINE_UNQUOTED(ENLIGHTENMENT_MICRO, "$ENLIGHTENMENT_MICRO")
AC_SUBST(ENLIGHTENMENT_MICRO)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC

View File

@ -7,27 +7,27 @@ INCLUDES = \
bin_PROGRAMS = enlightenment
enlightenment_SOURCES = \
actions.c \
background.c \
border.c \
config.c \
desktops.c \
entry.c \
exec.c \
fs.c \
icccm.c \
icons.c \
ipc.c \
keys.c \
main.c \
menu.c \
menubuild.c \
pack.c \
resist.c \
shelf.c \
util.c \
view.c \
e.h
actions.h actions.c \
background.h background.c \
border.h border.c \
config.h config.c \
destops.h desktops.c \
entry.h entry.c \
exec.h exec.c \
fs.h fs.c \
icccm.h icccm.c \
icons.h icons.c \
ipc.h ipc.c \
keys.h keys.c \
main.c \
menu.h menu.c \
menubuild.h menubuild.c \
pack.c \
resist.h resist.c \
shelf.c \
util.h util.c \
view.h view.c \
e.h
enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm -lc $(INTLLIBS)

View File

@ -1,4 +1,11 @@
#include "e.h"
#include "actions.h"
#include "config.h"
#include "border.h"
#include "desktops.h"
#include "exec.h"
#include "icccm.h"
#include "keys.h"
#include "view.h"
static Evas_List action_protos = NULL;
static Evas_List current_actions = NULL;
@ -57,6 +64,14 @@ static void e_act_zoom_start (void *o, E_Action *a, void *data, int x, int y, in
static void e_act_desk_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
#define SET_BORDER_GRAVITY(_b, _grav) \
e_window_gravity_set(_b->win.container, _grav); \
e_window_gravity_set(_b->win.input, _grav); \
e_window_gravity_set(_b->win.l, _grav); \
e_window_gravity_set(_b->win.r, _grav); \
e_window_gravity_set(_b->win.t, _grav); \
e_window_gravity_set(_b->win.b, _grav);
static void
_e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o)
{
@ -343,7 +358,7 @@ e_action_stop_by_object(void *o, void *data, int x, int y, int rx, int ry)
{
Evas_List l;
e_actions_del_timer_object(o);
e_action_del_timer_object(o);
again:
for (l = current_actions; l; l = l->next)
{
@ -389,7 +404,7 @@ e_action_add_proto(char *action,
}
void
e_actions_del_timer(void *o, char *name)
e_action_del_timer(void *o, char *name)
{
Evas_List l;
@ -414,7 +429,7 @@ e_actions_del_timer(void *o, char *name)
}
void
e_actions_add_timer(void *o, char *name)
e_action_add_timer(void *o, char *name)
{
E_Active_Action_Timer *at;
@ -425,7 +440,7 @@ e_actions_add_timer(void *o, char *name)
}
void
e_actions_del_timer_object(void *o)
e_action_del_timer_object(void *o)
{
Evas_List l;
@ -447,7 +462,7 @@ e_actions_del_timer_object(void *o)
}
void
e_actions_init(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);
@ -473,13 +488,12 @@ e_actions_init(void)
}
/* FIXME: these REALLY need to go into other file(s) but it's not worht it */
/* yet at this point. it can be done later */
/* Erm is that really true? They're all static, all called through the
above functions -- so it's good to have them encapsulated here? --cK */
static void
e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
{
@ -923,8 +937,8 @@ e_act_cb_shade(int val, void *data)
OBJ_REF(b);
t = e_get_time();
e_window_gravity_set(b->win.client, SouthWestGravity);
e_actions_del_timer(b, "shader");
e_actions_add_timer(b, "shader");
e_action_del_timer(b, "shader");
e_action_add_timer(b, "shader");
}
dif = e_get_time() - t;
@ -939,7 +953,7 @@ e_act_cb_shade(int val, void *data)
e_add_event_timer("shader", 0.01, e_act_cb_shade, 1, data);
else
{
e_actions_del_timer(b, "shader");
e_action_del_timer(b, "shader");
e_window_gravity_reset(b->win.client);
OBJ_UNREF(b);
}
@ -963,8 +977,8 @@ e_act_cb_unshade(int val, void *data)
OBJ_REF(b);
t = e_get_time();
e_window_gravity_set(b->win.client, SouthWestGravity);
e_actions_del_timer(b, "shader");
e_actions_add_timer(b, "shader");
e_action_del_timer(b, "shader");
e_action_add_timer(b, "shader");
}
dif = e_get_time() - t;
@ -980,7 +994,7 @@ e_act_cb_unshade(int val, void *data)
e_add_event_timer("shader", 0.01, e_act_cb_unshade, 1, data);
else
{
e_actions_del_timer(b, "shader");
e_action_del_timer(b, "shader");
e_window_gravity_reset(b->win.client);
OBJ_UNREF(b);
}

59
src/actions.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef E_ACTIONS_H
#define E_ACTIONS_H
#include "e.h"
struct _E_Active_Action_Timer
{
void *object;
char *name;
};
struct _E_Action
{
OBJ_PROPERTIES;
char *name;
char *action;
char *params;
int event;
int button;
char *key;
int modifiers;
E_Action_Proto *action_proto;
void *object;
int started;
int grabbed;
};
struct _E_Action_Proto
{
OBJ_PROPERTIES;
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 e_action_start(char *action, int act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry);
void e_action_stop(char *action, int 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, int 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_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 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);
void e_action_init(void);
#endif

View File

@ -1,4 +1,35 @@
#include "e.h"
#include "background.h"
typedef struct _E_Background_Layer
{
int mode;
int type;
int inlined;
struct {
float x, y;
} scroll;
struct {
float x, y;
} pos;
struct {
float w, h;
struct {
int w, h;
} orig;
} size, fill;
char *color_class;
char *file;
double angle;
struct {
int r, g, b, a;
} fg, bg;
double x, y, w, h, fw, fh;
Evas_Object obj;
}
E_Background_Layer;
void
e_background_free(E_Background *bg)
@ -89,7 +120,7 @@ e_background_load(char *file)
sprintf(buf, "/layers/%i/fill.h", i); e_db_float_get(db, buf, &(bl->fill.h));
sprintf(buf, "/layers/%i/fill.orig.w", i); e_db_int_get(db, buf, &(bl->fill.orig.w));
sprintf(buf, "/layers/%i/fill.orig.h", i); e_db_int_get(db, buf, &(bl->fill.orig.h));
sprintf(buf, "/layers/%i/angle", i); e_db_float_get(db, buf, &(bl->angle));
sprintf(buf, "/layers/%i/angle", i); e_db_float_get(db, buf, (float*)&(bl->angle));
sprintf(buf, "/layers/%i/fg.r", i); e_db_int_get(db, buf, &(bl->fg.r));
sprintf(buf, "/layers/%i/fg.g", i); e_db_int_get(db, buf, &(bl->fg.g));
sprintf(buf, "/layers/%i/fg.b", i); e_db_int_get(db, buf, &(bl->fg.b));

31
src/background.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef E_BACKGROUND_H
#define E_BACKGROUND_H
#include "e.h"
struct _E_Background
{
OBJ_PROPERTIES;
Evas evas;
char *file;
struct {
int sx, sy;
int w, h;
} geom;
Evas_List layers;
Evas_Object base_obj;
};
void e_background_free(E_Background *bg);
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);
#endif

View File

@ -1,4 +1,10 @@
#include "e.h"
#include "border.h"
#include "config.h"
#include "actions.h"
#include "desktops.h"
#include "resist.h"
#include "icccm.h"
#include "util.h"
/* Window border rendering, querying, setting & modification code */
@ -1196,7 +1202,7 @@ e_border_adopt(Window win, int use_client_pos)
b->changed = 1;
}
{
int x, y, w, h;
int x, y;
int pl, pr, pt, pb;
pl = pr = pt = pb = 0;

140
src/border.h Normal file
View File

@ -0,0 +1,140 @@
#ifndef E_BORDER_H
#define E_BORDER_H
#include "e.h"
struct _E_Grab
{
int button;
Ev_Key_Modifiers mods;
int any_mod;
int remove_after;
int allow;
};
struct _E_Border
{
OBJ_PROPERTIES;
struct {
Window main;
Window l, r, t, b;
Window input;
Window container;
Window client;
} win;
struct {
Evas l, r, t, b;
} evas;
struct {
struct {
Evas_Object l, r, t, b;
} title;
struct {
Evas_Object l, r, t, b;
} title_clip;
} obj;
struct {
Pixmap l, r, t, b;
} pixmap;
struct {
int new;
Ebits_Object l, r, t, b;
} bits;
struct {
struct {
int x, y, w, h;
int visible;
int dx, dy;
} requested;
int x, y, w, h;
int visible;
int selected;
int select_lost_from_grab;
int shaded;
int has_shape;
int shape_changes;
int shaped_client;
} current, previous;
struct {
struct {
int w, h;
double aspect;
} base, min, max, step;
int layer;
char *title;
char *name;
char *class;
char *command;
Window group;
int takes_focus;
int sticky;
Colormap colormap;
int fixed;
int arrange_ignore;
int hidden;
int iconified;
int titlebar;
int border;
int handles;
int w, h;
struct {
int requested;
int x, y;
int gravity;
} pos;
} client;
struct {
int move, resize;
} mode;
struct {
int x, y, w, h;
int is;
} max;
int ignore_unmap;
int shape_changed;
int placed;
Evas_List grabs;
E_Desktop *desk;
char *border_file;
int first_expose;
int changed;
};
void e_border_apply_border(E_Border *b);
void e_border_reshape(E_Border *b);
E_Border *e_border_adopt(Window win, int use_client_pos);
E_Border *e_border_new(void);
void e_border_free(E_Border *b);
void e_border_remove_mouse_grabs(E_Border *b);
void e_border_attach_mouse_grabs(E_Border *b);
void e_border_remove_all_mouse_grabs(void);
void e_border_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_adjust_limits(E_Border *b);
void e_border_update(E_Border *b);
void e_border_set_layer(E_Border *b, int layer);
void e_border_raise(E_Border *b);
void e_border_lower(E_Border *b);
void e_border_raise_above(E_Border *b, E_Border *above);
void e_border_lower_below(E_Border *b, E_Border *below);
void e_border_init(void);
void e_border_adopt_children(Window win);
E_Border *e_border_current_focused(void);
void e_border_focus_grab_ended(void);
#endif

View File

@ -1,4 +1,5 @@
#include "e.h"
#include "config.h"
#include "util.h"
static char cfg_root[] = "";

148
src/config.h Normal file
View File

@ -0,0 +1,148 @@
#ifndef E_CONFIG_H
#define E_CONFIG_H
#include "e.h"
/* something to check validity of config files where we get data from */
/* for now its just a 5 second timout so it will only invalidate */
/* if we havent looked for 5 seconds... BUT later when efsd is more solid */
/* we should use that to tell us when its invalid */
struct _E_Config_File
{
char *src;
double last_fetch;
};
struct _E_Config_Element
{
char *src;
char *key;
double last_fetch;
int type;
int def_int_val;
float def_float_val;
char *def_str_val;
void *def_data_val;
int def_data_val_size;
int cur_int_val;
float cur_float_val;
char *cur_str_val;
void *cur_data_val;
int cur_data_val_size;
};
#define E_CFG_FILE(_var, _src) \
static E_Config_File _var = {_src, 0.0}
#define E_CONFIG_CHECK_VALIDITY(_var, _src) \
{ \
double __time; \
__time = e_get_time(); \
if (_var.last_fetch < (__time - 5.0)) { \
_var.last_fetch = __time;
#define E_CONFIG_CHECK_VALIDITY_END \
} \
}
#define E_CFG_INT_T 123
#define E_CFG_FLOAT_T 1234
#define E_CFG_STR_T 12345
#define E_CFG_DATA_T 123456
#define E_CFG_INT(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_INT_T, \
_default, 0.0, NULL, NULL, 0, \
0, 0.0, NULL, NULL, 0, \
}
#define E_CFG_FLOAT(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_FLOAT_T, \
0, _default, NULL, NULL, 0, \
0, 0.0, NULL, NULL, 0, \
}
#define E_CFG_STR(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_STR_T, \
0, 0.0, _default, NULL, 0, \
0, 0.0, NULL, NULL, 0, \
}
#define E_CFG_DATA(_var, _src, _key, _default, _default_size) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_DATAT_T, \
0, 0.0, NULL, _default, _default_size, \
0, 0.0, NULL, NULL, 0, \
}
/* yes for now it only fetches them every 5 seconds - in the end i need a */
/* validity flag for the database file to know if it changed and only then */
/* get the value again. this is waiting for efsd to become more solid */
#define E_CFG_VALIDITY_CHECK(_var) \
{ \
double __time; \
__time = e_get_time(); \
if (_var.last_fetch < (__time - 5.0)) { \
int __cfg_ok = 0; \
_var.last_fetch = __time;
#define E_CFG_END_VALIDITY_CHECK \
} \
}
#define E_CONFIG_INT_GET(_var, _val) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
E_DB_INT_GET(e_config_get(_var.src), _var.key, _var.cur_int_val, __cfg_ok); \
if (!__cfg_ok) _var.cur_int_val = _var.def_int_val; \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_int_val;}
#define E_CONFIG_FLOAT_GET(_var, _val) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
E_DB_FLOAT_GET(e_config_get(_var.src), _var.key, _var.cur_float_val, __cfg_ok); \
if (!__cfg_ok) _var.cur_float_val = _var.def_float_val; \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_float_val;}
#define E_CONFIG_STR_GET(_var, _val) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
if (_var.cur_str_val) free(_var.cur_str_val); \
_var.cur_str_val = NULL; \
E_DB_STR_GET(e_config_get(_var.src), _var.key, _var.cur_str_val, __cfg_ok); \
if (!__cfg_ok) _var.cur_str_val = _var.def_str_val \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_str_val;}
#define E_CONFIG_DATA_GET(_var, _val, _size) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
if (_var.cur_data_val) free(_var.cur_data_val); \
_var.cur_data_val = NULL; \
_var.cur_data_size = 0; \
{ E_DB_File *__db; \
__db = e_db_open_read(e_config_get(_var.src)); \
if (__db) { \
_var.cur_data_val = e_db_data_get(__db, _var.key, &(_var.cur_data_size)); \
if (_var.cur_data_val) __cfg_ok = 1; \
e_db_close(__db); \
} \
} \
if (!__cfg_ok) { \
_var.cur_data_val = e_memdup(_var.def_data_val, _var.def_data_size); \
_var.cur_data_size = _var.def_data_size; \
} \
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);
char *e_config_user_dir(void);
#endif

View File

@ -1,4 +1,11 @@
#include "e.h"
#include "desktops.h"
#include "config.h"
#include "actions.h"
#include "border.h"
#include "background.h"
#include "view.h"
#include "icccm.h"
#include "util.h"
static Evas_List desktops = NULL;
static Window e_base_win = 0;
@ -164,20 +171,25 @@ e_desktops_init_file_display(E_Desktop *desk)
desk->view->size.w = desk->real.w;
desk->view->size.h = desk->real.h;
desk->view->is_desktop = 1;
/* FIXME: load bg here */
{
char buf[4096];
sprintf(buf, "%s/default.bg.db", e_config_get("backgrounds"));
desk->view->bg = e_background_load(buf);
printf("**** load %s = %p\n", buf, desk->view->bg);
}
{
char buf[4096];
sprintf(buf, "%s/default.bg.db", e_config_get("backgrounds"));
desk->view->bg = e_background_load(buf);
printf("**** load %s = %p\n", buf, desk->view->bg);
}
/* fixme: later */
/* uncomment this and comment out the next line for some tress testing */
/* desk->view->dir = strdup("/dev"); */
desk->view->dir = strdup(e_file_home());
/* desk->view->dir = strdup("/dev"); */
desk->view->dir = strdup(e_file_home());
e_view_realize(desk->view);
if (desk->view->options.back_pixmap) e_view_update(desk->view);
if (desk->view->options.back_pixmap)
e_view_update(desk->view);
desk->win.desk = desk->view->win.base;
e_window_reparent(desk->win.desk, desk->win.container, 0, 0);
e_window_show(desk->win.desk);

41
src/desktops.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef E_DESKTOPS_H
#define E_DESKTOPS_H
#include "e.h"
struct _E_Desktop
{
OBJ_PROPERTIES;
char *name;
char *dir;
struct {
Window main;
Window container;
Window desk;
} win;
E_View *view;
int x, y;
struct {
int w, h;
} real, virt;
Evas_List windows;
int changed;
};
void e_desktops_init(void);
void e_desktops_scroll(E_Desktop *desk, int dx, int dy);
void e_desktops_free(E_Desktop *desk);
void e_desktops_init_file_display(E_Desktop *desk);
E_Desktop *e_desktops_new(void);
void e_desktops_add_border(E_Desktop *d, E_Border *b);
void e_desktops_del_border(E_Desktop *d, E_Border *b);
void e_desktops_delete(E_Desktop *d);
void e_desktops_show(E_Desktop *d);
void e_desktops_hide(E_Desktop *d);
int e_desktops_get_num(void);
E_Desktop *e_desktops_get(int d);
int e_desktops_get_current(void);
void e_desktops_goto(int d);
#endif

878
src/e.h
View File

@ -1,3 +1,6 @@
#ifndef ENLIGHTENMENT_H
#define ENLIGHTENMENT_H
#include "../config.h"
#include <X11/Xlib.h>
#include <stdio.h>
@ -21,7 +24,6 @@
#include <Ebits.h>
#include <Ecore.h>
#include <Edb.h>
#include <libefsd.h>
/* macros for allowing sections of code to be runtime profiled */
#define E_PROF 1
@ -112,108 +114,6 @@ _e_obj->e_obj_free = (void *) _e_obj_free_func; \
#define ACT_KEY_DOWN 8
#define ACT_KEY_UP 9
/* config macros */
/* something to check validity of config files where we get data from */
/* for now its just a 5 second timout so it will only invalidate */
/* if we havent looked for 5 seconds... BUT later when efsd is more solid */
/* we should use that to tell us when its invalid */
#define E_CFG_FILE(_var, _src) \
static E_Config_File _var = {_src, 0.0}
#define E_CONFIG_CHECK_VALIDITY(_var, _src) \
{ \
double __time; \
__time = e_get_time(); \
if (_var.last_fetch < (__time - 5.0)) { \
_var.last_fetch = __time;
#define E_CONFIG_CHECK_VALIDITY_END \
} \
}
#define E_CFG_INT_T 123
#define E_CFG_FLOAT_T 1234
#define E_CFG_STR_T 12345
#define E_CFG_DATA_T 123456
#define E_CFG_INT(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_INT_T, \
_default, 0.0, NULL, NULL, 0, \
0, 0.0, NULL, NULL, 0, \
}
#define E_CFG_FLOAT(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_FLOAT_T, \
0, _default, NULL, NULL, 0, \
0, 0.0, NULL, NULL, 0, \
}
#define E_CFG_STR(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_STR_T, \
0, 0.0, _default, NULL, 0, \
0, 0.0, NULL, NULL, 0, \
}
#define E_CFG_DATA(_var, _src, _key, _default, _default_size) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_DATAT_T, \
0, 0.0, NULL, _default, _default_size, \
0, 0.0, NULL, NULL, 0, \
}
/* yes for now it only fetches them every 5 seconds - in the end i need a */
/* validity flag for the database file to know if it changed and only then */
/* get the value again. this is waiting for efsd to become more solid */
#define E_CFG_VALIDITY_CHECK(_var) \
{ \
double __time; \
__time = e_get_time(); \
if (_var.last_fetch < (__time - 5.0)) { \
int __cfg_ok = 0; \
_var.last_fetch = __time;
#define E_CFG_END_VALIDITY_CHECK \
} \
}
#define E_CONFIG_INT_GET(_var, _val) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
E_DB_INT_GET(e_config_get(_var.src), _var.key, _var.cur_int_val, __cfg_ok); \
if (!__cfg_ok) _var.cur_int_val = _var.def_int_val; \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_int_val;}
#define E_CONFIG_FLOAT_GET(_var, _val) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
E_DB_FLOAT_GET(e_config_get(_var.src), _var.key, _var.cur_float_val, __cfg_ok); \
if (!__cfg_ok) _var.cur_float_val = _var.def_float_val; \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_float_val;}
#define E_CONFIG_STR_GET(_var, _val) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
if (_var.cur_str_val) free(_var.cur_str_val); \
_var.cur_str_val = NULL; \
E_DB_STR_GET(e_config_get(_var.src), _var.key, _var.cur_str_val, __cfg_ok); \
if (!__cfg_ok) _var.cur_str_val = _var.def_str_val \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_str_val;}
#define E_CONFIG_DATA_GET(_var, _val, _size) \
{{ \
E_CFG_VALIDITY_CHECK(_var) \
if (_var.cur_data_val) free(_var.cur_data_val); \
_var.cur_data_val = NULL; \
_var.cur_data_size = 0; \
{ E_DB_File *__db; \
__db = e_db_open_read(e_config_get(_var.src)); \
if (__db) { \
_var.cur_data_val = e_db_data_get(__db, _var.key, &(_var.cur_data_size)); \
if (_var.cur_data_val) __cfg_ok = 1; \
e_db_close(__db); \
} \
} \
if (!__cfg_ok) { \
_var.cur_data_val = e_memdup(_var.def_data_val, _var.def_data_size); \
_var.cur_data_size = _var.def_data_size; \
} \
E_CFG_END_VALIDITY_CHECK \
} \
_val = _var.cur_data_val; \
_size = _var.cur_data_size;}
/* misc util macros */
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
((x < (xx + ww)) && \
@ -223,34 +123,26 @@ _size = _var.cur_data_size;}
#define SPANS_COMMON(x1, w1, x2, w2) \
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define UN(_blah) _blah = 0
#define SET_BORDER_GRAVITY(_b, _grav) \
e_window_gravity_set(_b->win.container, _grav); \
e_window_gravity_set(_b->win.input, _grav); \
e_window_gravity_set(_b->win.l, _grav); \
e_window_gravity_set(_b->win.r, _grav); \
e_window_gravity_set(_b->win.t, _grav); \
e_window_gravity_set(_b->win.b, _grav);
/* data types */
typedef struct _E_Object E_Object;
typedef struct _E_Border E_Border;
typedef struct _E_Grab E_Grab;
typedef struct _E_Action E_Action;
typedef struct _E_Action_Proto E_Action_Proto;
typedef struct _E_Desktop E_Desktop;
typedef struct _E_Rect E_Rect;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
typedef struct _E_View E_View;
typedef struct _E_Icon E_Icon;
typedef struct _E_Background E_Background;
typedef struct _E_Background_Layer E_Background_Layer;
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
typedef struct _E_Border E_Border;
typedef struct _E_Build_Menu E_Build_Menu;
typedef struct _E_Config_File E_Config_File;
typedef struct _E_Config_Element E_Config_Element;
typedef struct _E_Desktop E_Desktop;
typedef struct _E_Entry E_Entry;
typedef struct _E_FS_Restarter E_FS_Restarter;
typedef struct _E_Config_File E_Config_File;
typedef struct _E_Config_Element E_Config_Element;
typedef struct _E_Grab E_Grab;
typedef struct _E_Icon E_Icon;
typedef struct _E_Menu E_Menu;
typedef struct _E_Menu_Item E_Menu_Item;
typedef struct _E_Object E_Object;
typedef struct _E_Rect E_Rect;
typedef struct _E_View E_View;
/* actual fdata struct members */
struct _E_Object
@ -258,744 +150,4 @@ struct _E_Object
OBJ_PROPERTIES;
};
struct _E_Border
{
OBJ_PROPERTIES;
struct {
Window main;
Window l, r, t, b;
Window input;
Window container;
Window client;
} win;
struct {
Evas l, r, t, b;
} evas;
struct {
struct {
Evas_Object l, r, t, b;
} title;
struct {
Evas_Object l, r, t, b;
} title_clip;
} obj;
struct {
Pixmap l, r, t, b;
} pixmap;
struct {
int new;
Ebits_Object l, r, t, b;
} bits;
struct {
struct {
int x, y, w, h;
int visible;
int dx, dy;
} requested;
int x, y, w, h;
int visible;
int selected;
int select_lost_from_grab;
int shaded;
int has_shape;
int shape_changes;
int shaped_client;
} current, previous;
struct {
struct {
int w, h;
double aspect;
} base, min, max, step;
int layer;
char *title;
char *name;
char *class;
char *command;
Window group;
int takes_focus;
int sticky;
Colormap colormap;
int fixed;
int arrange_ignore;
int hidden;
int iconified;
int titlebar;
int border;
int handles;
int w, h;
struct {
int requested;
int x, y;
int gravity;
} pos;
} client;
struct {
int move, resize;
} mode;
struct {
int x, y, w, h;
int is;
} max;
int ignore_unmap;
int shape_changed;
int placed;
Evas_List grabs;
E_Desktop *desk;
char *border_file;
int first_expose;
int changed;
};
struct _E_Grab
{
int button;
Ev_Key_Modifiers mods;
int any_mod;
int remove_after;
int allow;
};
struct _E_Action
{
OBJ_PROPERTIES;
char *name;
char *action;
char *params;
int event;
int button;
char *key;
int modifiers;
E_Action_Proto *action_proto;
void *object;
int started;
int grabbed;
};
struct _E_Action_Proto
{
OBJ_PROPERTIES;
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);
};
struct _E_Desktop
{
OBJ_PROPERTIES;
char *name;
char *dir;
struct {
Window main;
Window container;
Window desk;
} win;
E_View *view;
int x, y;
struct {
int w, h;
} real, virt;
Evas_List windows;
int changed;
};
struct _E_Rect
{
int x, y, w, h;
int v1, v2, v3, v4;
};
struct _E_Active_Action_Timer
{
void *object;
char *name;
};
struct _E_View
{
OBJ_PROPERTIES;
char *dir;
struct {
Evas_Render_Method render_method;
int back_pixmap;
} options;
Evas evas;
struct {
Window base;
Window main;
} win;
Pixmap pmap;
struct {
int w, h;
} size;
struct {
int x, y;
} location;
struct {
/* +-----------------+
* | Wt |
* | +-----------+ |
* |Wl| |Wr|
* | | [I] Is | |
* | | Ig | |
* | | [txt] | |
* | | Ib | |
* | +-----------+ |
* | Wb |
* +-----------------+
*/
struct {
int l, r, t, b;
} window;
struct {
int s, g, b;
} icon;
} spacing;
struct {
int on;
int x, y, w, h;
struct {
int x, y;
} down;
struct {
struct {
int r, g, b, a;
}
edge_l, edge_r, edge_t, edge_b,
middle,
grad_l, grad_r, grad_t, grad_b;
struct {
int l, r, t, b;
} grad_size;
} config;
struct {
Evas_Object clip;
Evas_Object edge_l;
Evas_Object edge_r;
Evas_Object edge_t;
Evas_Object edge_b;
Evas_Object middle;
Evas_Object grad_l;
Evas_Object grad_r;
Evas_Object grad_t;
Evas_Object grad_b;
} obj;
} select;
struct {
int started;
Window win;
int x, y;
struct {
int x, y;
} offset;
int update;
} drag;
Evas_Object obj_bg;
E_Background *bg;
int is_listing;
int monitor_id;
E_FS_Restarter *restarter;
Evas_List icons;
int is_desktop;
int have_resort_queued;
int sel_count;
int changed;
};
struct _E_Icon
{
OBJ_PROPERTIES;
char *file;
E_View *view;
struct {
char *icon;
char *custom_icon;
char *link;
struct {
char *base;
char *type;
} mime;
} info;
struct {
Evas_Object icon;
Evas_Object text;
Evas_Object event1;
Evas_Object event2;
struct {
struct {
Ebits_Object icon;
Ebits_Object text;
} over, under;
} sel;
} obj;
struct {
int hilited;
int clicked;
int selected;
int running;
int disabled;
int visible;
int just_selected;
int just_executed;
} state;
struct {
int x, y, w, h;
struct {
int w, h;
} icon;
struct {
int w, h;
} text;
} geom;
int changed;
};
struct _E_Background_Layer
{
int mode;
int type;
int inlined;
struct {
float x, y;
} scroll;
struct {
float x, y;
} pos;
struct {
float w, h;
struct {
int w, h;
} orig;
} size, fill;
char *color_class;
char *file;
double angle;
struct {
int r, g, b, a;
} fg, bg;
double x, y, w, h, fw, fh;
Evas_Object obj;
};
struct _E_Background
{
OBJ_PROPERTIES;
Evas evas;
char *file;
struct {
int sx, sy;
int w, h;
} geom;
Evas_List layers;
Evas_Object base_obj;
};
struct _E_Menu
{
OBJ_PROPERTIES;
struct {
int x, y, w, h;
int visible;
} current, previous;
struct {
int l, r, t, b;
} border, sel_border;
struct {
Window main, evas;
} win;
Evas evas;
Ebits_Object bg;
Evas_List entries;
char *bg_file;
int first_expose;
int recalc_entries;
int redo_sel;
int changed;
struct {
int state, icon, text;
} size;
struct {
int icon, state;
} pad;
E_Menu_Item *selected;
Time time;
};
struct _E_Menu_Item
{
OBJ_PROPERTIES;
int x, y;
struct {
struct {
int w, h;
} min;
int w, h;
} size;
Ebits_Object bg;
char *bg_file;
int selected;
Evas_Object obj_entry;
char *str;
Evas_Object obj_text;
char *icon;
Evas_Object obj_icon;
int scale_icon;
Ebits_Object state;
char *state_file;
Ebits_Object sep;
char *sep_file;
int separator;
int radio_group;
int radio;
int check;
int on;
E_Menu *menu;
E_Menu *submenu;
void (*func_select) (E_Menu *m, E_Menu_Item *mi, void *data);
void *func_select_data;
};
struct _E_Build_Menu
{
OBJ_PROPERTIES;
char *file;
time_t mod_time;
E_Menu *menu;
Evas_List menus;
Evas_List commands;
};
struct _E_Entry
{
Evas evas;
char *buffer;
int cursor_pos;
struct {
int start, length, down;
} select;
int mouse_down;
int visible;
int focused;
int scroll_pos;
int x, y, w, h;
int min_size;
Ebits_Object obj_base;
Ebits_Object obj_cursor;
Ebits_Object obj_selection;
Evas_Object event_box;
Evas_Object clip_box;
Evas_Object text;
Window paste_win;
Window selection_win;
int end_width;
void (*func_changed) (E_Entry *entry, void *data);
void *data_changed;
void (*func_enter) (E_Entry *entry, void *data);
void *data_enter;
void (*func_focus_in) (E_Entry *entry, void *data);
void *data_focus_in;
void (*func_focus_out) (E_Entry *entry, void *data);
void *data_focus_out;
};
struct _E_FS_Restarter
{
void (*func) (void *data);
void *data;
};
struct _E_Config_File
{
char *src;
double last_fetch;
};
struct _E_Config_Element
{
char *src;
char *key;
double last_fetch;
int type;
int def_int_val;
float def_float_val;
char *def_str_val;
void *def_data_val;
int def_data_val_size;
int cur_int_val;
float cur_float_val;
char *cur_str_val;
void *cur_data_val;
int cur_data_val_size;
};
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, Ev_Key_Down *e);