mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
convert lua_barval to double
This commit is contained in:
parent
f1a57e40aa
commit
2fc1efa8d5
@ -1449,7 +1449,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &print_lua_parse;
|
obj->callbacks.print = &print_lua_parse;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
END OBJ_ARG(lua_bar, 0, "lua_bar needs arguments: <height>,<width> <function name> [function parameters]")
|
END OBJ_ARG(lua_bar, 0, "lua_bar needs arguments: <height>,<width> <function name> [function parameters]")
|
||||||
arg = scan_bar(obj, arg, 255);
|
arg = scan_bar(obj, arg, 100);
|
||||||
if(arg) {
|
if(arg) {
|
||||||
obj->data.s = strndup(arg, text_buffer_size);
|
obj->data.s = strndup(arg, text_buffer_size);
|
||||||
} else {
|
} else {
|
||||||
@ -1460,7 +1460,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
#ifdef X11
|
#ifdef X11
|
||||||
END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: <function name> [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]")
|
END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: <function name> [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]")
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
buf = scan_graph(obj, arg, 255);
|
buf = scan_graph(obj, arg, 100);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
obj->data.s = buf;
|
obj->data.s = buf;
|
||||||
} else {
|
} else {
|
||||||
@ -1470,7 +1470,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
END OBJ_ARG(lua_gauge, 0, "lua_gauge needs arguments: <height>,<width> <function name> [function parameters]")
|
END OBJ_ARG(lua_gauge, 0, "lua_gauge needs arguments: <height>,<width> <function name> [function parameters]")
|
||||||
arg = scan_gauge(obj, arg, 255);
|
arg = scan_gauge(obj, arg, 100);
|
||||||
if (arg) {
|
if (arg) {
|
||||||
obj->data.s = strndup(arg, text_buffer_size);
|
obj->data.s = strndup(arg, text_buffer_size);
|
||||||
} else {
|
} else {
|
||||||
|
@ -546,11 +546,11 @@ void print_lua_parse(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t lua_barval(struct text_object *obj)
|
double lua_barval(struct text_object *obj)
|
||||||
{
|
{
|
||||||
double per;
|
double per;
|
||||||
if (llua_getnumber(obj->data.s, &per)) {
|
if (llua_getnumber(obj->data.s, &per)) {
|
||||||
return round_to_int(per * 2.55);
|
return per;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,6 @@ void llua_update_info(struct information *i, double u_interval);
|
|||||||
|
|
||||||
void print_lua(struct text_object *, char *, int);
|
void print_lua(struct text_object *, char *, int);
|
||||||
void print_lua_parse(struct text_object *, char *, int);
|
void print_lua_parse(struct text_object *, char *, int);
|
||||||
uint8_t lua_barval(struct text_object *);
|
double lua_barval(struct text_object *);
|
||||||
|
|
||||||
#endif /* LUA_H_*/
|
#endif /* LUA_H_*/
|
||||||
|
Loading…
Reference in New Issue
Block a user