1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-14 19:39:47 +00:00

convert swap_barval to double

This commit is contained in:
Phil Sutter 2009-12-04 01:25:41 +01:00
parent c5a8949784
commit db2b056969
3 changed files with 4 additions and 4 deletions

View File

@ -525,11 +525,11 @@ uint8_t swap_percentage(struct text_object *obj)
return (info.swapmax ? round_to_int(info.swap * 100 / info.swapmax) : 0);
}
uint8_t swap_barval(struct text_object *obj)
double swap_barval(struct text_object *obj)
{
(void)obj;
return round_to_int(info.swapmax ? (info.swap * 255 / info.swapmax) : 0);
return info.swapmax ? ((double)info.swap / info.swapmax) : 0;
}
void print_kernel(struct text_object *obj, char *p, int p_max_size)

View File

@ -83,7 +83,7 @@ void print_swapmax(struct text_object *, char *, int);
uint8_t mem_percentage(struct text_object *);
double mem_barval(struct text_object *);
uint8_t swap_percentage(struct text_object *);
uint8_t swap_barval(struct text_object *);
double swap_barval(struct text_object *);
void print_kernel(struct text_object *, char *, int);
void print_machine(struct text_object *, char *, int);

View File

@ -1032,7 +1032,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
END OBJ(swapperc, &update_meminfo)
obj->callbacks.percentage = &swap_percentage;
END OBJ(swapbar, &update_meminfo)
scan_bar(obj, arg, 255);
scan_bar(obj, arg, 1);
obj->callbacks.barval = &swap_barval;
/* XXX: swapgraph, swapgauge? */
END OBJ(sysname, 0)