i've been working on the railroad... all the long long day...


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 21 years ago
parent 61c2054c73
commit 4b8d85b97d
  1. 4
      src/border.c
  2. 168
      src/config.c
  3. 46
      src/config.h
  4. 8
      src/desktops.c
  5. 4
      src/match.c

@ -1205,8 +1205,6 @@ e_border_adopt(Window win, int use_client_pos)
/* we have now placed the bugger */
b->placed = 1;
/* desk area */
e_icccm_set_desk_area(win, 0, 0);
e_icccm_set_desk(win, e_desktops_get_current());
if (use_client_pos)
{
int x, y;
@ -1219,6 +1217,8 @@ e_border_adopt(Window win, int use_client_pos)
/* reparent the window finally */
e_window_reparent(win, b->win.container, 0, 0);
e_match_set_props(b);
e_icccm_set_desk_area(win, b->client.area.x, b->client.area.y);
e_icccm_set_desk(win, b->client.desk);
/* figure what border to use */
e_border_apply_border(b);
{

@ -105,6 +105,9 @@ e_config_init(void)
e_file_cp(PACKAGE_DATA_DIR"/data/config/behavior/default/apps_menu.db", buf);
sprintf(buf, "%sappearance/borders/border.bits.db", e_config_user_dir());
#endif
#if 0
ts();
#endif
}
void
@ -143,3 +146,168 @@ e_config_user_dir(void)
#endif
return cfg_user_dir;
}
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)
{
E_Config_Node *cfg_node;
cfg_node = NEW(E_Config_Node, 1);
ZERO(cfg_node, E_Config_Node, 1);
cfg_node->prefix = strdup(prefix);
cfg_node->type = type;
cfg_node->sub_type = list_type;
cfg_node->offset = offset;
base->nodes = evas_list_append(base->nodes, cfg_node);
}
E_Config_Base_Type *
e_config_type_new(void)
{
E_Config_Base_Type *t;
t = NEW(E_Config_Base_Type, 1);
ZERO(t, E_Config_Base_Type, 1);
return t;
}
void *
e_config_load(char *file, char *prefix, E_Config_Base_Type *type)
{
E_DB_File *db;
char buf[4096];
Evas_List l;
char *data;
if (!e_file_exists(file)) return NULL;
db = e_db_open_read(file);
if (!db) return NULL;
data = NEW(char, type->size);
ZERO(data, char , type->size);
for (l = type->nodes; l; l = l->next)
{
E_Config_Node *node;
node = l->data;
switch (node->type)
{
case E_CFG_TYPE_INT:
{
int val;
val = 0;
sprintf(buf, "%s/%s", prefix, node->prefix);
e_db_int_get(db, buf, &val);
(*((int *)(&(data[node->offset])))) = val;
}
break;
case E_CFG_TYPE_STR:
{
char * val;
sprintf(buf, "%s/%s", prefix, node->prefix);
val = e_db_str_get(db, buf);
(*((char **)(&(data[node->offset])))) = val;
}
break;
case E_CFG_TYPE_FLOAT:
{
float val;
val = 0;
sprintf(buf, "%s/%s", prefix, node->prefix);
e_db_float_get(db, buf, &val);
(*((float *)(&(data[node->offset])))) = val;
}
break;
case E_CFG_TYPE_LIST:
{
Evas_List l2;
int i, count;
l2 = NULL;
sprintf(buf, "%s/%s/count", prefix, node->prefix);
count = 0;
e_db_int_get(db, buf, &count);
for (i = 0; i < count; i++)
{
void *data2;
sprintf(buf, "%s/%s/%i", prefix, node->prefix, i);
data2 = e_config_load(file, buf, node->sub_type);
l2 = evas_list_append(l2, data2);
}
(*((Evas_List *)(&(data[node->offset])))) = l2;
}
break;
default:
break;
}
}
e_db_close(db);
return data;
}
#if 0
typedef struct _list_base List_Base;
typedef struct _list_element List_Element;
struct _list_base
{
Evas_List elements;
};
struct _list_element
{
char *name;
int size;
float perc;
};
/* eg: */
void ts(void)
{
E_Config_Base_Type *cf_list;
E_Config_Base_Type *cf_element;
cf_element = e_config_type_new();
E_CONFIG_NODE(cf_element, "name", E_CFG_TYPE_STR, NULL, List_Element, name);
E_CONFIG_NODE(cf_element, "size", E_CFG_TYPE_INT, NULL, List_Element, size);
E_CONFIG_NODE(cf_element, "perc", E_CFG_TYPE_FLOAT, NULL, List_Element, perc);
cf_list = e_config_type_new();
E_CONFIG_NODE(cf_list, "list", E_CFG_TYPE_LIST, cf_element, List_Base, elements);
{
List_Base *cfg_data;
cfg_data = e_config_load("test.db", "", cf_list);
if (!cfg_data)
{
printf("no load!\n");
}
else
{
Evas_List l;
for (l = cfg_data->elements; l; l = l->next)
{
List_Element *cfg_element;
printf("element\n");
cfg_element = l->data;
printf("... name %s\n", cfg_element->name);
printf("... size %i\n", cfg_element->size);
printf("... perc %3.3f\n", cfg_element->perc);
}
}
exit(0);
}
}
#endif

@ -152,4 +152,50 @@ void e_config_init(void);
void e_config_set_user_dir(char *dir);
char *e_config_user_dir(void);
typedef struct _e_config_base_type E_Config_Base_Type;
typedef struct _e_config_node E_Config_Node;
typedef enum _e_config_datatype E_Config_Datatype;
enum _e_config_datatype
{
E_CFG_TYPE_INT,
E_CFG_TYPE_STR,
E_CFG_TYPE_FLOAT,
E_CFG_TYPE_LIST
};
struct _e_config_base_type
{
int size;
Evas_List nodes;
};
struct _e_config_node
{
char *prefix;
E_Config_Datatype type;
int offset;
E_Config_Base_Type *sub_type;
};
#define E_CONFIG_NODE(var, prefix, type, sub, struct_type, struct_member) \
{ \
struct_type _cfg_dummy; \
char *_cfg_p1, *_cfg_p2; \
int _cfg_offset; \
\
_cfg_p1 = (char *)(&(_cfg_dummy)); \
_cfg_p2 = (char *)(&(_cfg_dummy.struct_member)); \
_cfg_offset = (int)(_cfg_p2 - _cfg_p1); \
\
e_config_type_add_node(var, prefix, type, sub, _cfg_offset); \
var->size = sizeof(struct_type); \
}
E_Config_Base_Type *e_config_type_new(void);
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);
void *e_config_load(char *file, char *prefix, E_Config_Base_Type *type);
#endif

@ -10,7 +10,6 @@
static Evas_List desktops = NULL;
static Window e_base_win = 0;
static int screen_w, screen_h;
static int current_desk = 0;
static void e_idle(void *data);
@ -297,7 +296,12 @@ e_desktops_get(int d)
int
e_desktops_get_current(void)
{
return current_desk;
E_Desktop *desk;
desk = e_desktops_get(0);
if (desk)
return desk->desk.desk;
return 0;
}
void

@ -18,6 +18,8 @@ e_match_set_props(E_Border *b)
/* if we have a match specifying desk area (only valid with loc match */
b->client.pos.x += (match_area_x - b->desk->desk.area.x) * b->desk->real.w;
b->client.pos.y += (match_area_y - b->desk->desk.area.y) * b->desk->real.h;
b->client.area.x = match_area_x;
b->client.area.y = match_area_y;
/* if we have a match specifying a size */
b->current.requested.w = match_w;
b->current.requested.h = match_h;
@ -29,5 +31,7 @@ e_match_set_props(E_Border *b)
b->client.no_place = 1;
/* if we have a match specifying stickyness */
b->client.sticky = match_sticky;
/* if we have a match specifying layer */
b->client.layer = match_layer;
#endif
}

Loading…
Cancel
Save