mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-18 11:05:18 +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);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
}
|
}
|
||||||
#ifdef NVIDIA
|
|
||||||
OBJ(nvidia) {
|
|
||||||
print_nvidia_value(obj, display, p, p_max_size);
|
|
||||||
}
|
|
||||||
#endif /* NVIDIA */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#undef DO_JUMP
|
#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"
|
CRIT_ERR(obj, free_at_crash, "nvidia: invalid argument"
|
||||||
" specified: '%s'\n", arg);
|
" specified: '%s'\n", arg);
|
||||||
}
|
}
|
||||||
|
obj->callbacks.print = &print_nvidia_value;
|
||||||
obj->callbacks.free = &free_nvidia;
|
obj->callbacks.free = &free_nvidia;
|
||||||
#endif /* NVIDIA */
|
#endif /* NVIDIA */
|
||||||
#ifdef APCUPSD
|
#ifdef APCUPSD
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "nvidia.h"
|
#include "nvidia.h"
|
||||||
#include "temphelper.h"
|
#include "temphelper.h"
|
||||||
|
#include "x11.h"
|
||||||
#include <NVCtrl/NVCtrlLib.h>
|
#include <NVCtrl/NVCtrlLib.h>
|
||||||
|
|
||||||
const int nvidia_query_to_attr[] = {NV_CTRL_GPU_CORE_TEMPERATURE,
|
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;
|
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;
|
int value;
|
||||||
struct nvidia_s *nvs = obj->data.opaque;
|
struct nvidia_s *nvs = obj->data.opaque;
|
||||||
|
|
||||||
if (!nvs ||
|
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");
|
snprintf(p, p_max_size, "N/A");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,8 @@
|
|||||||
#ifndef NVIDIA_CONKY_H
|
#ifndef NVIDIA_CONKY_H
|
||||||
#define NVIDIA_CONKY_H
|
#define NVIDIA_CONKY_H
|
||||||
|
|
||||||
#include "text_object.h"
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
int set_nvidia_type(struct text_object *, const char *);
|
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 *);
|
void free_nvidia(struct text_object *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user