1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

nvidia: convert to callbacks.print

This commit is contained in:
Phil Sutter 2009-11-16 22:54:30 +01:00
parent 0188eb0aaa
commit bb70c21c36
4 changed files with 5 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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