mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 02:55:12 +00:00
nvidia: convert to callbacks.print
This commit is contained in:
parent
0188eb0aaa
commit
bb70c21c36
@ -1550,11 +1550,6 @@ void generate_text_internal(char *p, int p_max_size,
|
||||
}
|
||||
snprintf(p, p_max_size, "%s", buf);
|
||||
}
|
||||
#ifdef NVIDIA
|
||||
OBJ(nvidia) {
|
||||
print_nvidia_value(obj, display, p, p_max_size);
|
||||
}
|
||||
#endif /* NVIDIA */
|
||||
break;
|
||||
}
|
||||
#undef DO_JUMP
|
||||
|
@ -1401,6 +1401,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
CRIT_ERR(obj, free_at_crash, "nvidia: invalid argument"
|
||||
" specified: '%s'\n", arg);
|
||||
}
|
||||
obj->callbacks.print = &print_nvidia_value;
|
||||
obj->callbacks.free = &free_nvidia;
|
||||
#endif /* NVIDIA */
|
||||
#ifdef APCUPSD
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "logging.h"
|
||||
#include "nvidia.h"
|
||||
#include "temphelper.h"
|
||||
#include "x11.h"
|
||||
#include <NVCtrl/NVCtrlLib.h>
|
||||
|
||||
const int nvidia_query_to_attr[] = {NV_CTRL_GPU_CORE_TEMPERATURE,
|
||||
@ -105,13 +106,13 @@ int set_nvidia_type(struct text_object *obj, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void print_nvidia_value(struct text_object *obj, Display *dpy, char *p, int p_max_size)
|
||||
void print_nvidia_value(struct text_object *obj, char *p, int p_max_size)
|
||||
{
|
||||
int value;
|
||||
struct nvidia_s *nvs = obj->data.opaque;
|
||||
|
||||
if (!nvs ||
|
||||
(value = get_nvidia_value(nvs->type, dpy)) == -1) {
|
||||
(value = get_nvidia_value(nvs->type, display)) == -1) {
|
||||
snprintf(p, p_max_size, "N/A");
|
||||
return;
|
||||
}
|
||||
|
@ -31,11 +31,8 @@
|
||||
#ifndef NVIDIA_CONKY_H
|
||||
#define NVIDIA_CONKY_H
|
||||
|
||||
#include "text_object.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
int set_nvidia_type(struct text_object *, const char *);
|
||||
void print_nvidia_value(struct text_object *, Display *, char *, int);
|
||||
void print_nvidia_value(struct text_object *, char *, int);
|
||||
void free_nvidia(struct text_object *);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user