1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Merge branch 'master' of git.omp.am:/home/omp/git/conky into lua

Conflicts:
	src/specials.c
This commit is contained in:
Brenden Matthews 2009-05-16 17:05:30 -06:00
commit dd606eb5ae
4 changed files with 23 additions and 7 deletions

View File

@ -725,9 +725,9 @@ static void free_text_objects(struct text_object *root, int internal)
case OBJ_image:
case OBJ_eval:
case OBJ_exec:
case OBJ_execbar:
#ifdef X11
case OBJ_execgauge:
case OBJ_execbar:
case OBJ_execgraph:
#endif
case OBJ_execp:
@ -1559,13 +1559,13 @@ static struct text_object *construct_text_object(const char *s,
obj->a = default_##arg##_width; \
obj->b = default_##arg##_height; \
}
END OBJ(execbar, 0)
SIZE_DEFAULTS(bar);
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
#ifdef X11
END OBJ(execgauge, 0)
SIZE_DEFAULTS(gauge);
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
END OBJ(execbar, 0)
SIZE_DEFAULTS(bar);
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
END OBJ(execgraph, 0)
SIZE_DEFAULTS(graph);
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
@ -3881,17 +3881,31 @@ static void generate_text_internal(char *p, int p_max_size,
new_gauge(p, obj->a, obj->b, round_to_int(barnum * 255.0));
}
}
#endif
OBJ(execbar) {
double barnum;
int i;
read_exec(obj->data.s, p, text_buffer_size);
barnum = get_barnum(p);
if (barnum >= 0.0) {
#ifdef X11
barnum /= 100;
new_bar(p, obj->a, obj->b, round_to_int(barnum * 255.0));
#else
barnum = round_to_int( ( barnum * obj->a ) / 100);
for(i=0; i<barnum; i++) {
*(p+i)='#';
}
for(; i < obj->a; i++) {
*(p+i)='_';
}
*(p+i)=0;
#endif
}
}
#ifdef X11
OBJ(execgraph) {
char showaslog = FALSE;
double barnum;
@ -7280,7 +7294,6 @@ static void load_config_file(const char *f)
CONF_ERR;
}
}
#ifdef X11
CONF("default_bar_size") {
char err = 0;
if (value) {
@ -7294,6 +7307,7 @@ static void load_config_file(const char *f)
CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')")
}
}
#ifdef X11
CONF("default_graph_size") {
char err = 0;
if (value) {

View File

@ -46,11 +46,13 @@ unsigned int special_count;
int default_bar_width = 0, default_bar_height = 6;
int default_graph_width = 0, default_graph_height = 25;
int default_gauge_width = 40, default_gauge_height = 25;
#endif
/*
* Scanning arguments to various special text objects
*/
#ifdef X11
const char *scan_gauge(const char *args, int *w, int *h)
{
/*width and height*/

View File

@ -76,9 +76,9 @@ struct special_t {
extern struct special_t *specials;
extern unsigned int special_count;
#ifdef X11
extern int default_bar_width;
extern int default_bar_height;
#ifdef X11
extern int default_graph_width;
extern int default_graph_height;
extern int default_gauge_width;

View File

@ -104,9 +104,9 @@ enum text_object_type {
OBJ_exec,
OBJ_execi,
OBJ_texeci,
OBJ_execbar,
#ifdef X11
OBJ_execgauge,
OBJ_execbar,
OBJ_execgraph,
OBJ_execibar,
OBJ_execigraph,