1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

convert mem_barval to double

This commit is contained in:
Phil Sutter 2009-12-04 01:22:36 +01:00
parent d46a2cb1b2
commit c5a8949784
3 changed files with 6 additions and 6 deletions

View File

@ -511,11 +511,11 @@ uint8_t mem_percentage(struct text_object *obj)
return (info.memmax ? round_to_int(info.mem * 100 / info.memmax) : 0);
}
uint8_t mem_barval(struct text_object *obj)
double mem_barval(struct text_object *obj)
{
(void)obj;
return round_to_int(info.memmax ? (info.mem * 255 / info.memmax) : 0);
return info.memmax ? ((double)info.mem / info.memmax) : 0;
}
uint8_t swap_percentage(struct text_object *obj)

View File

@ -81,7 +81,7 @@ void print_swap(struct text_object *, char *, int);
void print_swapfree(struct text_object *, char *, int);
void print_swapmax(struct text_object *, char *, int);
uint8_t mem_percentage(struct text_object *);
uint8_t mem_barval(struct text_object *);
double mem_barval(struct text_object *);
uint8_t swap_percentage(struct text_object *);
uint8_t swap_barval(struct text_object *);

View File

@ -812,15 +812,15 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(memperc, &update_meminfo)
obj->callbacks.percentage = &mem_percentage;
END OBJ(memgauge, &update_meminfo)
scan_gauge(obj, arg, 255);
scan_gauge(obj, arg, 1);
obj->callbacks.gaugeval = &mem_barval;
END OBJ(membar, &update_meminfo)
scan_bar(obj, arg, 255);
scan_bar(obj, arg, 1);
obj->callbacks.barval = &mem_barval;
#ifdef X11
END OBJ(memgraph, &update_meminfo)
char *buf = 0;
buf = scan_graph(obj, arg, 255);
buf = scan_graph(obj, arg, 1);
if (buf) free(buf);
obj->callbacks.graphval = &mem_barval;