mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
Use consistent naming for build option macros.
Probably have broken some build features with this commit.
This commit is contained in:
parent
79be66b15a
commit
7e78f036f0
@ -130,5 +130,8 @@ option(BUILD_WEATHER_XOAP "Enable XOAP weather support" false)
|
|||||||
if(BUILD_WEATHER_METAR OR BUILD_WEATHER_XOAP)
|
if(BUILD_WEATHER_METAR OR BUILD_WEATHER_XOAP)
|
||||||
set(BUILD_CURL true)
|
set(BUILD_CURL true)
|
||||||
endif(BUILD_WEATHER_METAR OR BUILD_WEATHER_XOAP)
|
endif(BUILD_WEATHER_METAR OR BUILD_WEATHER_XOAP)
|
||||||
|
if(BUILD_WEATHER_XOAP)
|
||||||
|
set(XOAP_FILE "$HOME/.xoaprc" CACHE STRING "Path of XOAP file for weather" FORCE)
|
||||||
|
endif(BUILD_WEATHER_XOAP)
|
||||||
|
|
||||||
option(BUILD_APCUPSD "Enable APCUPSD support" true)
|
option(BUILD_APCUPSD "Enable APCUPSD support" true)
|
||||||
|
@ -31,134 +31,57 @@
|
|||||||
#cmakedefine HAVE_FUNOPEN 1
|
#cmakedefine HAVE_FUNOPEN 1
|
||||||
|
|
||||||
#cmakedefine BUILD_X11 1
|
#cmakedefine BUILD_X11 1
|
||||||
#ifdef BUILD_X11
|
|
||||||
#define X11
|
|
||||||
#endif /* BUILD_X11 */
|
|
||||||
|
|
||||||
#cmakedefine OWN_WINDOW 1
|
#cmakedefine OWN_WINDOW 1
|
||||||
|
|
||||||
#cmakedefine BUILD_XDAMAGE 1
|
#cmakedefine BUILD_XDAMAGE 1
|
||||||
#ifdef BUILD_XDAMAGE
|
|
||||||
#define HAVE_XDAMAGE
|
|
||||||
#endif /* BUILD_XDAMAGE */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_XFT 1
|
#cmakedefine BUILD_XFT 1
|
||||||
#ifdef BUILD_XFT
|
|
||||||
#define XFT
|
|
||||||
#endif /* BUILD_XFT */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_ARGB 1
|
#cmakedefine BUILD_ARGB 1
|
||||||
#ifdef BUILD_ARGB
|
|
||||||
#define USE_ARGB
|
|
||||||
#endif /* BUILD_ARGB */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_XDBE 1
|
#cmakedefine BUILD_XDBE 1
|
||||||
#ifdef BUILD_XDBE
|
|
||||||
#define HAVE_XDBE
|
|
||||||
#endif /* BUILD_XDBE */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_LUA 1
|
#cmakedefine BUILD_LUA 1
|
||||||
#ifdef BUILD_LUA
|
|
||||||
#define HAVE_LUA
|
|
||||||
#endif /* BUILD_LUA */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_PORT_MONITORS 1
|
#cmakedefine BUILD_PORT_MONITORS 1
|
||||||
#ifdef BUILD_PORT_MONITORS
|
|
||||||
#define TCP_PORT_MONITOR
|
|
||||||
#endif /* BUILD_PORT_MONITORS */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_AUDACIOUS 1
|
#cmakedefine BUILD_AUDACIOUS 1
|
||||||
#ifdef BUILD_AUDACIOUS
|
|
||||||
#define AUDACIOUS
|
|
||||||
#endif /* BUILD_AUDACIOUS */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_AUDACIOUS_LEGACY 1
|
#cmakedefine BUILD_AUDACIOUS_LEGACY 1
|
||||||
#ifdef BUILD_AUDACIOUS_LEGACY
|
|
||||||
#define AUDACIOUS_LEGACY
|
|
||||||
#endif /* BUILD_AUDACIOUS_LEGACY */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_MPD 1
|
#cmakedefine BUILD_MPD 1
|
||||||
#ifdef BUILD_MPD
|
|
||||||
#define MPD
|
|
||||||
#endif /* BUILD_MPD */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_MOC 1
|
#cmakedefine BUILD_MOC 1
|
||||||
#ifdef BUILD_MOC
|
|
||||||
#define MOC
|
|
||||||
#endif /* BUILD_MOC */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_NVIDIA 0
|
#cmakedefine BUILD_NVIDIA 0
|
||||||
#ifdef BUILD_NVIDIA
|
|
||||||
#define NVIDIA
|
|
||||||
#endif /* BUILD_NVIDIA */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_XMMS2 1
|
#cmakedefine BUILD_XMMS2 1
|
||||||
#ifdef BUILD_XMMS2
|
|
||||||
#define XMMS2
|
|
||||||
#endif /* BUILD_XMMS2 */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_HDDTEMP 1
|
#cmakedefine BUILD_HDDTEMP 1
|
||||||
#ifdef BUILD_HDDTEMP
|
|
||||||
#define HDDTEMP
|
|
||||||
#endif /* BUILD_HDDTEMP */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_EVE 1
|
#cmakedefine BUILD_EVE 1
|
||||||
#ifdef BUILD_EVE
|
|
||||||
#define EVE
|
|
||||||
#define EVEURL_TRAINING "http://api.eve-online.com/char/SkillInTraining.xml.aspx"
|
|
||||||
#define EVEURL_SKILLTREE "http://api.eve-online.com/eve/Skilltree.xml.aspx"
|
|
||||||
#define EVE_OUTPUT_FORMAT "%s %d in %s"
|
|
||||||
#endif /* BUILD_EVE */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_LIBXML2 1
|
#cmakedefine BUILD_LIBXML2 1
|
||||||
|
|
||||||
#cmakedefine BUILD_CURL 1
|
#cmakedefine BUILD_CURL 1
|
||||||
#ifdef BUILD_CURL
|
|
||||||
#define HAVE_CURL
|
|
||||||
#endif /* BUILD_CURL */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_WEATHER_XOAP 1
|
#cmakedefine BUILD_WEATHER_XOAP 1
|
||||||
#cmakedefine BUILD_WEATHER_METAR 1
|
#cmakedefine BUILD_WEATHER_METAR 1
|
||||||
|
|
||||||
#ifdef BUILD_WEATHER_XOAP
|
#define XOAP_FILE "@XOAP_FILE@"
|
||||||
#define XOAP
|
|
||||||
#define WEATHER
|
|
||||||
#define XOAP_FILE "$HOME/.xoaprc"
|
|
||||||
#endif /* BUILD_WEATHER_XOAP */
|
|
||||||
|
|
||||||
#ifdef BUILD_WEATHER_METAR
|
|
||||||
#define WEATHER
|
|
||||||
#endif /* BUILD_WEATHER_METAR */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_IMLIB2 1
|
#cmakedefine BUILD_IMLIB2 1
|
||||||
#ifdef BUILD_IMLIB2
|
|
||||||
#define IMLIB2
|
|
||||||
#endif /* BUILD_IMLIB2 */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_MATH 1
|
#cmakedefine BUILD_MATH 1
|
||||||
#ifdef BUILD_MATH
|
|
||||||
#define MATH
|
|
||||||
#endif /* BUILD_MATH */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_CONFIG_OUTPUT 1
|
#cmakedefine BUILD_CONFIG_OUTPUT 1
|
||||||
#ifdef BUILD_CONFIG_OUTPUT
|
|
||||||
#define CONFIG_OUTPUT
|
|
||||||
#endif /* BUILD_CONFIG_OUTPUT */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_NCURSES 1
|
#cmakedefine BUILD_NCURSES 1
|
||||||
#ifdef BUILD_NCURSES
|
|
||||||
#define NCURSES
|
|
||||||
#endif /* BUILD_NCURSES */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_APCUPSD 1
|
#cmakedefine BUILD_APCUPSD 1
|
||||||
#ifdef BUILD_APCUPSD
|
|
||||||
#define APCUPSD
|
|
||||||
#endif /* BUILD_APCUPSD */
|
|
||||||
|
|
||||||
#cmakedefine BUILD_IOSTATS 1
|
#cmakedefine BUILD_IOSTATS 1
|
||||||
#ifdef BUILD_IOSTATS
|
|
||||||
#define IOSTATS
|
|
||||||
#endif /* BUILD_IOSTATS */
|
|
||||||
|
|
||||||
#cmakedefine HAVE_ICONV 1
|
#cmakedefine HAVE_ICONV 1
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#ifndef AUDACIOUS_LEGACY
|
#ifndef BUILD_AUDACIOUS_LEGACY
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <audacious/audctrl.h>
|
#include <audacious/audctrl.h>
|
||||||
#include <audacious/dbus.h>
|
#include <audacious/dbus.h>
|
||||||
#else
|
#else /* BUILD_AUDACIOUS_LEGACY */
|
||||||
#include <audacious/beepctrl.h>
|
#include <audacious/beepctrl.h>
|
||||||
#define audacious_remote_is_running(x) \
|
#define audacious_remote_is_running(x) \
|
||||||
xmms_remote_is_running(x)
|
xmms_remote_is_running(x)
|
||||||
@ -55,7 +55,7 @@
|
|||||||
xmms_remote_get_playlist_file(x, y)
|
xmms_remote_get_playlist_file(x, y)
|
||||||
#define audacious_remote_get_playlist_length(x) \
|
#define audacious_remote_get_playlist_length(x) \
|
||||||
xmms_remote_get_playlist_length(x)
|
xmms_remote_get_playlist_length(x)
|
||||||
#endif
|
#endif /* BUILD_AUDACIOUS_LEGACY */
|
||||||
|
|
||||||
/* access to this item array is synchronized */
|
/* access to this item array is synchronized */
|
||||||
static audacious_t audacious_items;
|
static audacious_t audacious_items;
|
||||||
@ -125,7 +125,7 @@ void audacious_thread_func(thread_handle &handle)
|
|||||||
gint rate, freq, chans, vol;
|
gint rate, freq, chans, vol;
|
||||||
gchar *psong, *pfilename;
|
gchar *psong, *pfilename;
|
||||||
|
|
||||||
#ifndef AUDACIOUS_LEGACY
|
#ifndef BUILD_AUDACIOUS_LEGACY
|
||||||
DBusGProxy *session = NULL;
|
DBusGProxy *session = NULL;
|
||||||
DBusGConnection *connection = NULL;
|
DBusGConnection *connection = NULL;
|
||||||
#else
|
#else
|
||||||
@ -136,7 +136,7 @@ void audacious_thread_func(thread_handle &handle)
|
|||||||
psong = NULL;
|
psong = NULL;
|
||||||
pfilename = NULL;
|
pfilename = NULL;
|
||||||
|
|
||||||
#ifndef AUDACIOUS_LEGACY
|
#ifndef BUILD_AUDACIOUS_LEGACY
|
||||||
g_type_init();
|
g_type_init();
|
||||||
connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
|
connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
@ -147,7 +147,7 @@ void audacious_thread_func(thread_handle &handle)
|
|||||||
if (!session) {
|
if (!session) {
|
||||||
CRIT_ERR(NULL, NULL, "unable to create dbus proxy");
|
CRIT_ERR(NULL, NULL, "unable to create dbus proxy");
|
||||||
}
|
}
|
||||||
#endif /* AUDACIOUS_LEGACY */
|
#endif /* BUILD_AUDACIOUS_LEGACY */
|
||||||
|
|
||||||
/* Loop until the main thread resets the runnable signal. */
|
/* Loop until the main thread resets the runnable signal. */
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -242,7 +242,7 @@ void audacious_thread_func(thread_handle &handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (handle.test(0)) {
|
if (handle.test(0)) {
|
||||||
#ifndef AUDACIOUS_LEGACY
|
#ifndef BUILD_AUDACIOUS_LEGACY
|
||||||
/* release reference to dbus proxy */
|
/* release reference to dbus proxy */
|
||||||
g_object_unref(session);
|
g_object_unref(session);
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,10 +48,10 @@ typedef char audacious_t[13][128];
|
|||||||
|
|
||||||
/* type for data exchange with main thread */
|
/* type for data exchange with main thread */
|
||||||
typedef struct audacious_s {
|
typedef struct audacious_s {
|
||||||
audacious_t items; /* e.g. items[AUDACIOUS_STATUS] */
|
audacious_t items; /* e.g. items[BUILD_AUDACIOUS_STATUS] */
|
||||||
int max_title_len; /* e.g. ${audacious_title 50} */
|
int max_title_len; /* e.g. ${audacious_title 50} */
|
||||||
timed_thread_ptr p_timed_thread;
|
timed_thread_ptr p_timed_thread;
|
||||||
} AUDACIOUS_S;
|
} audacious_s;
|
||||||
|
|
||||||
/* create a worker thread for audacious media player status */
|
/* create a worker thread for audacious media player status */
|
||||||
int create_audacious_thread(void);
|
int create_audacious_thread(void);
|
||||||
@ -80,4 +80,4 @@ void print_audacious_playlist_position(struct text_object *, char *, int);
|
|||||||
void print_audacious_main_volume(struct text_object *, char *, int);
|
void print_audacious_main_volume(struct text_object *, char *, int);
|
||||||
double audacious_barval(struct text_object *);
|
double audacious_barval(struct text_object *);
|
||||||
|
|
||||||
#endif
|
#endif /* AUDACIOUS_H */
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#include "x11.h"
|
#include "x11.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ static long redmask, greenmask, bluemask;
|
|||||||
static void set_up_gradient(void)
|
static void set_up_gradient(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
if (output_methods & TO_X) {
|
if (output_methods & TO_X) {
|
||||||
colour_depth = DisplayPlanes(display, screen);
|
colour_depth = DisplayPlanes(display, screen);
|
||||||
} else
|
} else
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
{
|
{
|
||||||
colour_depth = 16;
|
colour_depth = 16;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ unsigned long *do_gradient(int width, unsigned long first_colour, unsigned long
|
|||||||
return colours;
|
return colours;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
long get_x11_color(const char *name)
|
long get_x11_color(const char *name)
|
||||||
{
|
{
|
||||||
XColor color;
|
XColor color;
|
||||||
|
@ -468,7 +468,7 @@ void print_loadavg(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void scan_loadgraph_arg(struct text_object *obj, const char *arg)
|
void scan_loadgraph_arg(struct text_object *obj, const char *arg)
|
||||||
{
|
{
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
@ -484,7 +484,7 @@ double loadgraphval(struct text_object *obj)
|
|||||||
|
|
||||||
return info.loadavg[0];
|
return info.loadavg[0];
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
uint8_t cpu_percentage(struct text_object *obj)
|
uint8_t cpu_percentage(struct text_object *obj)
|
||||||
{
|
{
|
||||||
|
@ -75,10 +75,10 @@ void get_battery_short_status(char *buf, unsigned int n, const char *bat);
|
|||||||
|
|
||||||
void scan_loadavg_arg(struct text_object *, const char *);
|
void scan_loadavg_arg(struct text_object *, const char *);
|
||||||
void print_loadavg(struct text_object *, char *, int);
|
void print_loadavg(struct text_object *, char *, int);
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void scan_loadgraph_arg(struct text_object *, const char *);
|
void scan_loadgraph_arg(struct text_object *, const char *);
|
||||||
double loadgraphval(struct text_object *);
|
double loadgraphval(struct text_object *);
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
uint8_t cpu_percentage(struct text_object *);
|
uint8_t cpu_percentage(struct text_object *);
|
||||||
double cpu_barval(struct text_object *);
|
double cpu_barval(struct text_object *);
|
||||||
|
492
src/conky.cc
492
src/conky.cc
File diff suppressed because it is too large
Load Diff
92
src/conky.h
92
src/conky.h
@ -66,66 +66,66 @@ char *strndup(const char *s, size_t n);
|
|||||||
/* forward define to make gcc happy */
|
/* forward define to make gcc happy */
|
||||||
struct text_object;
|
struct text_object;
|
||||||
|
|
||||||
#ifdef BMPX
|
#ifdef BUILD_BMPX
|
||||||
#include "bmpx.h"
|
#include "bmpx.h"
|
||||||
#endif
|
#endif /* BUILD_BMPX */
|
||||||
|
|
||||||
#ifdef EVE
|
#ifdef BUILD_EVE
|
||||||
#include "eve.h"
|
#include "eve.h"
|
||||||
#endif
|
#endif /* BUILD_EVE */
|
||||||
|
|
||||||
#ifdef HDDTEMP
|
#ifdef BUILD_HDDTEMP
|
||||||
#include "hddtemp.h"
|
#include "hddtemp.h"
|
||||||
#endif /* HDDTEMP */
|
#endif /* BUILD_HDDTEMP */
|
||||||
|
|
||||||
#ifdef MOC
|
#ifdef BUILD_MOC
|
||||||
#include "moc.h"
|
#include "moc.h"
|
||||||
#endif
|
#endif /* BUILD_MOC */
|
||||||
|
|
||||||
#ifdef MPD
|
#ifdef BUILD_MPD
|
||||||
#include "mpd.h"
|
#include "mpd.h"
|
||||||
#endif
|
#endif /* BUILD_MPD */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
/* this hack exists only to get around a compilation issue with some files
|
/* this hack exists only to get around a compilation issue with some files
|
||||||
* being converted to C++, will need a better solution */
|
* being converted to C++, will need a better solution */
|
||||||
|
|
||||||
/* C++ headers */
|
/* C++ headers */
|
||||||
#ifdef HAVE_CURL
|
#ifdef BUILD_CURL
|
||||||
#include "ccurl_thread.h"
|
#include "ccurl_thread.h"
|
||||||
#endif /* HAVE_CURL */
|
#endif /* BUILD_CURL */
|
||||||
|
|
||||||
#ifdef AUDACIOUS
|
#ifdef BUILD_AUDACIOUS
|
||||||
#include "audacious.h"
|
#include "audacious.h"
|
||||||
#endif
|
#endif /* BUILD_AUDACIOUS */
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#ifdef RSS
|
#ifdef BUILD_RSS
|
||||||
#include "rss.h"
|
#include "rss.h"
|
||||||
#endif /* RSS */
|
#endif /* BUILD_RSS */
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
#ifndef WEATHER
|
#ifndef BUILD_WEATHER_METAR
|
||||||
#error "WEATHER needs to be defined if XOAP is defined"
|
#error "BUILD_WEATHER_METAR needs to be defined if XOAP is defined"
|
||||||
#endif /* WEATHER */
|
#endif /* BUILD_WEATHER_METAR */
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
#ifdef WEATHER
|
#ifdef BUILD_WEATHER_METAR
|
||||||
#include "weather.h"
|
#include "weather.h"
|
||||||
#endif /* WEATHER */
|
#endif /* BUILD_WEATHER_METAR */
|
||||||
|
|
||||||
#ifdef TCP_PORT_MONITOR
|
#ifdef BUILD_PORT_MONITORS
|
||||||
#include "tcp-portmon.h"
|
#include "tcp-portmon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XMMS2
|
#ifdef BUILD_XMMS2
|
||||||
#include "xmms2.h"
|
#include "xmms2.h"
|
||||||
#endif
|
#endif /* BUILD_XMMS2 */
|
||||||
|
|
||||||
#ifdef APCUPSD
|
#ifdef BUILD_APCUPSD
|
||||||
#include "apcupsd.h"
|
#include "apcupsd.h"
|
||||||
#endif
|
#endif /* BUILD_APCUPSD */
|
||||||
|
|
||||||
/* sony support */
|
/* sony support */
|
||||||
#include "sony.h"
|
#include "sony.h"
|
||||||
@ -142,7 +142,7 @@ struct usr_info {
|
|||||||
int number;
|
int number;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
struct monitor_info {
|
struct monitor_info {
|
||||||
int number;
|
int number;
|
||||||
int current;
|
int current;
|
||||||
@ -161,7 +161,7 @@ struct x11_info {
|
|||||||
struct desktop_info desktop;
|
struct desktop_info desktop;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
/* defined in conky.c */
|
/* defined in conky.c */
|
||||||
extern long default_fg_color, default_bg_color, default_out_color;
|
extern long default_fg_color, default_bg_color, default_out_color;
|
||||||
@ -228,29 +228,29 @@ struct information {
|
|||||||
|
|
||||||
float loadavg[3];
|
float loadavg[3];
|
||||||
|
|
||||||
#ifdef XMMS2
|
#ifdef BUILD_XMMS2
|
||||||
struct xmms2_s xmms2;
|
struct xmms2_s xmms2;
|
||||||
|
#endif /* BUILD_XMMS2 */
|
||||||
|
#ifdef BUILD_AUDACIOUS
|
||||||
|
audacious_s audacious;
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUDACIOUS
|
#ifdef BUILD_BMPX
|
||||||
AUDACIOUS_S audacious;
|
|
||||||
#endif
|
|
||||||
#ifdef BMPX
|
|
||||||
struct bmpx_s bmpx;
|
struct bmpx_s bmpx;
|
||||||
#endif
|
#endif /* BUILD_BMPX */
|
||||||
struct usr_info users;
|
struct usr_info users;
|
||||||
struct process *cpu[10];
|
struct process *cpu[10];
|
||||||
struct process *memu[10];
|
struct process *memu[10];
|
||||||
struct process *time[10];
|
struct process *time[10];
|
||||||
#ifdef IOSTATS
|
#ifdef BUILD_IOSTATS
|
||||||
struct process *io[10];
|
struct process *io[10];
|
||||||
#endif
|
#endif /* BUILD_IOSTATS */
|
||||||
struct process *first_process;
|
struct process *first_process;
|
||||||
unsigned long looped;
|
unsigned long looped;
|
||||||
double music_player_interval;
|
double music_player_interval;
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
struct x11_info x11;
|
struct x11_info x11;
|
||||||
#endif
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
short kflags; /* kernel settings, see enum KFLAG */
|
short kflags; /* kernel settings, see enum KFLAG */
|
||||||
};
|
};
|
||||||
@ -273,9 +273,9 @@ enum {
|
|||||||
|
|
||||||
/* defined in conky.c, needed by top.c */
|
/* defined in conky.c, needed by top.c */
|
||||||
extern int top_cpu, top_mem, top_time;
|
extern int top_cpu, top_mem, top_time;
|
||||||
#ifdef IOSTATS
|
#ifdef BUILD_IOSTATS
|
||||||
extern int top_io;
|
extern int top_io;
|
||||||
#endif
|
#endif /* BUILD_IOSTATS */
|
||||||
extern int top_running;
|
extern int top_running;
|
||||||
|
|
||||||
/* defined in conky.c, needed by top.c */
|
/* defined in conky.c, needed by top.c */
|
||||||
@ -341,16 +341,16 @@ extern unsigned int max_user_text;
|
|||||||
/* path to config file */
|
/* path to config file */
|
||||||
extern char *current_config;
|
extern char *current_config;
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#define TO_X 1
|
#define TO_X 1
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#define TO_STDOUT 2
|
#define TO_STDOUT 2
|
||||||
#define TO_STDERR 4
|
#define TO_STDERR 4
|
||||||
#define OVERWRITE_FILE 8
|
#define OVERWRITE_FILE 8
|
||||||
#define APPEND_FILE 16
|
#define APPEND_FILE 16
|
||||||
#ifdef NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
#define TO_NCURSES 32
|
#define TO_NCURSES 32
|
||||||
#endif /* NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
enum x_initialiser_state {
|
enum x_initialiser_state {
|
||||||
NO = 0,
|
NO = 0,
|
||||||
YES = 1,
|
YES = 1,
|
||||||
|
160
src/core.cc
160
src/core.cc
@ -42,26 +42,26 @@
|
|||||||
#include "i8k.h"
|
#include "i8k.h"
|
||||||
#include "imlib2.h"
|
#include "imlib2.h"
|
||||||
#include "proc.h"
|
#include "proc.h"
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#endif
|
#endif
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
#ifdef IBM
|
#ifdef BUILD_IBM
|
||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include "smapi.h"
|
#include "smapi.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
#include "iconv_tools.h"
|
#include "iconv_tools.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LUA
|
#ifdef BUILD_LUA
|
||||||
#include "llua.h"
|
#include "llua.h"
|
||||||
#endif /* HAVE_LUA */
|
#endif /* BUILD_LUA */
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "mixer.h"
|
#include "mixer.h"
|
||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
#include "mboxscan.h"
|
#include "mboxscan.h"
|
||||||
#include "net_stat.h"
|
#include "net_stat.h"
|
||||||
#ifdef NVIDIA
|
#ifdef BUILD_NVIDIA
|
||||||
#include "nvidia.h"
|
#include "nvidia.h"
|
||||||
#endif
|
#endif
|
||||||
#include "read_tcp.h"
|
#include "read_tcp.h"
|
||||||
@ -75,7 +75,7 @@
|
|||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "users.h"
|
#include "users.h"
|
||||||
|
|
||||||
#ifdef NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
#include <ncurses.h>
|
#include <ncurses.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -157,12 +157,12 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
#define OBJ_IF_ARG(a, n, ...) __OBJ_HEAD(a, n) __OBJ_ARG(__VA_ARGS__) __OBJ_IF; {
|
#define OBJ_IF_ARG(a, n, ...) __OBJ_HEAD(a, n) __OBJ_ARG(__VA_ARGS__) __OBJ_IF; {
|
||||||
#define END } } else
|
#define END } } else
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
if (s[0] == '#') {
|
if (s[0] == '#') {
|
||||||
obj->data.l = get_x11_color(s);
|
obj->data.l = get_x11_color(s);
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
} else
|
} else
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
OBJ(acpitemp, 0)
|
OBJ(acpitemp, 0)
|
||||||
obj->data.i = open_acpi_temperature(arg);
|
obj->data.i = open_acpi_temperature(arg);
|
||||||
@ -335,7 +335,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &print_i8k_ac_status;
|
obj->callbacks.print = &print_i8k_ac_status;
|
||||||
END OBJ(i8k_buttons_status, &update_i8k)
|
END OBJ(i8k_buttons_status, &update_i8k)
|
||||||
obj->callbacks.print = &print_i8k_buttons_status;
|
obj->callbacks.print = &print_i8k_buttons_status;
|
||||||
#if defined(IBM)
|
#if defined(BUILD_IBM)
|
||||||
END OBJ(ibm_fan, 0)
|
END OBJ(ibm_fan, 0)
|
||||||
obj->callbacks.print = &get_ibm_acpi_fan;
|
obj->callbacks.print = &get_ibm_acpi_fan;
|
||||||
END OBJ_ARG(ibm_temps, &get_ibm_acpi_temps, "ibm_temps: needs an argument")
|
END OBJ_ARG(ibm_temps, &get_ibm_acpi_temps, "ibm_temps: needs an argument")
|
||||||
@ -418,7 +418,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
scan_bar(obj, arg, 1);
|
scan_bar(obj, arg, 1);
|
||||||
obj->callbacks.barval = &cpu_barval;
|
obj->callbacks.barval = &cpu_barval;
|
||||||
DBGP2("Adding $cpubar for CPU %d", obj->data.i);
|
DBGP2("Adding $cpubar for CPU %d", obj->data.i);
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(cpugraph, &update_cpu_usage)
|
END OBJ(cpugraph, &update_cpu_usage)
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
SCAN_CPU(arg, obj->data.i);
|
SCAN_CPU(arg, obj->data.i);
|
||||||
@ -429,7 +429,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(loadgraph, &update_load_average)
|
END OBJ(loadgraph, &update_load_average)
|
||||||
scan_loadgraph_arg(obj, arg);
|
scan_loadgraph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &loadgraphval;
|
obj->callbacks.graphval = &loadgraphval;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(diskio, &update_diskio)
|
END OBJ(diskio, &update_diskio)
|
||||||
parse_diskio_arg(obj, arg);
|
parse_diskio_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskio;
|
obj->callbacks.print = &print_diskio;
|
||||||
@ -439,7 +439,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(diskio_write, &update_diskio)
|
END OBJ(diskio_write, &update_diskio)
|
||||||
parse_diskio_arg(obj, arg);
|
parse_diskio_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_diskio_write;
|
obj->callbacks.print = &print_diskio_write;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(diskiograph, &update_diskio)
|
END OBJ(diskiograph, &update_diskio)
|
||||||
parse_diskiograph_arg(obj, arg);
|
parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &diskiographval;
|
obj->callbacks.graphval = &diskiographval;
|
||||||
@ -449,15 +449,15 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(diskiograph_write, &update_diskio)
|
END OBJ(diskiograph_write, &update_diskio)
|
||||||
parse_diskiograph_arg(obj, arg);
|
parse_diskiograph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &diskiographval_write;
|
obj->callbacks.graphval = &diskiographval_write;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(color, 0)
|
END OBJ(color, 0)
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
if (output_methods & TO_X) {
|
if (output_methods & TO_X) {
|
||||||
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
|
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
|
||||||
set_current_text_color(obj->data.l);
|
set_current_text_color(obj->data.l);
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#ifdef NCURSES
|
#ifdef BUILD_NCURSES
|
||||||
if (output_methods & TO_NCURSES) {
|
if (output_methods & TO_NCURSES) {
|
||||||
obj->data.l = COLOR_WHITE;
|
obj->data.l = COLOR_WHITE;
|
||||||
if(arg) {
|
if(arg) {
|
||||||
@ -480,7 +480,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
set_current_text_color(obj->data.l);
|
set_current_text_color(obj->data.l);
|
||||||
init_pair(obj->data.l, obj->data.l, COLOR_BLACK);
|
init_pair(obj->data.l, obj->data.l, COLOR_BLACK);
|
||||||
}
|
}
|
||||||
#endif /* NCURSES */
|
#endif /* BUILD_NCURSES */
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
END OBJ(color0, 0)
|
END OBJ(color0, 0)
|
||||||
obj->data.l = color0;
|
obj->data.l = color0;
|
||||||
@ -522,12 +522,12 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->data.l = color9;
|
obj->data.l = color9;
|
||||||
set_current_text_color(obj->data.l);
|
set_current_text_color(obj->data.l);
|
||||||
obj->callbacks.print = &new_fg;
|
obj->callbacks.print = &new_fg;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(font, 0)
|
END OBJ(font, 0)
|
||||||
scan_font(obj, arg);
|
scan_font(obj, arg);
|
||||||
obj->callbacks.print = &new_font;
|
obj->callbacks.print = &new_font;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(conky_version, 0)
|
END OBJ(conky_version, 0)
|
||||||
obj_be_plain_text(obj, VERSION);
|
obj_be_plain_text(obj, VERSION);
|
||||||
END OBJ(conky_build_date, 0)
|
END OBJ(conky_build_date, 0)
|
||||||
@ -540,11 +540,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(downspeedf, &update_net_stats)
|
END OBJ(downspeedf, &update_net_stats)
|
||||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_downspeedf;
|
obj->callbacks.print = &print_downspeedf;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(downspeedgraph, &update_net_stats)
|
END OBJ(downspeedgraph, &update_net_stats)
|
||||||
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.graphval = &downspeedgraphval;
|
obj->callbacks.graphval = &downspeedgraphval;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(else, 0)
|
END OBJ(else, 0)
|
||||||
obj_be_ifblock_else(ifblock_opaque, obj);
|
obj_be_ifblock_else(ifblock_opaque, obj);
|
||||||
obj->callbacks.iftest = &gen_false_iftest;
|
obj->callbacks.iftest = &gen_false_iftest;
|
||||||
@ -555,12 +555,12 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
obj->callbacks.print = &print_evaluate;
|
obj->callbacks.print = &print_evaluate;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#if defined(IMLIB2) && defined(X11)
|
#if defined(BUILD_IMLIB2) && defined(BUILD_X11)
|
||||||
END OBJ(image, 0)
|
END OBJ(image, 0)
|
||||||
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
obj->data.s = strndup(arg ? arg : "", text_buffer_size);
|
||||||
obj->callbacks.print = &print_image_callback;
|
obj->callbacks.print = &print_image_callback;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
END OBJ(exec, 0)
|
END OBJ(exec, 0)
|
||||||
scan_exec_arg(obj, arg);
|
scan_exec_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_exec;
|
obj->callbacks.print = &print_exec;
|
||||||
@ -578,22 +578,22 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
scan_exec_arg(obj, arg);
|
scan_exec_arg(obj, arg);
|
||||||
obj->callbacks.gaugeval = &execbarval;
|
obj->callbacks.gaugeval = &execbarval;
|
||||||
obj->callbacks.free = &free_exec;
|
obj->callbacks.free = &free_exec;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(execgraph, 0)
|
END OBJ(execgraph, 0)
|
||||||
scan_execgraph_arg(obj, arg);
|
scan_execgraph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &execbarval;
|
obj->callbacks.graphval = &execbarval;
|
||||||
obj->callbacks.free = &free_exec;
|
obj->callbacks.free = &free_exec;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ_ARG(execibar, 0, "execibar needs arguments")
|
END OBJ_ARG(execibar, 0, "execibar needs arguments")
|
||||||
scan_execi_bar_arg(obj, arg);
|
scan_execi_bar_arg(obj, arg);
|
||||||
obj->callbacks.barval = &execi_barval;
|
obj->callbacks.barval = &execi_barval;
|
||||||
obj->callbacks.free = &free_execi;
|
obj->callbacks.free = &free_execi;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ_ARG(execigraph, 0, "execigraph needs arguments")
|
END OBJ_ARG(execigraph, 0, "execigraph needs arguments")
|
||||||
scan_execgraph_arg(obj, arg);
|
scan_execgraph_arg(obj, arg);
|
||||||
obj->callbacks.graphval = &execi_barval;
|
obj->callbacks.graphval = &execi_barval;
|
||||||
obj->callbacks.free = &free_execi;
|
obj->callbacks.free = &free_execi;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ_ARG(execigauge, 0, "execigauge needs arguments")
|
END OBJ_ARG(execigauge, 0, "execigauge needs arguments")
|
||||||
scan_execi_gauge_arg(obj, arg);
|
scan_execi_gauge_arg(obj, arg);
|
||||||
obj->callbacks.gaugeval = &execi_barval;
|
obj->callbacks.gaugeval = &execi_barval;
|
||||||
@ -637,11 +637,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(fs_used, &update_fs_stats)
|
END OBJ(fs_used, &update_fs_stats)
|
||||||
init_fs(obj, arg);
|
init_fs(obj, arg);
|
||||||
obj->callbacks.print = &print_fs_used;
|
obj->callbacks.print = &print_fs_used;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(hr, 0)
|
END OBJ(hr, 0)
|
||||||
obj->data.l = arg ? atoi(arg) : 1;
|
obj->data.l = arg ? atoi(arg) : 1;
|
||||||
obj->callbacks.print = &new_hr;
|
obj->callbacks.print = &new_hr;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(nameserver, &update_dns_data)
|
END OBJ(nameserver, &update_dns_data)
|
||||||
parse_nameserver_arg(obj, arg);
|
parse_nameserver_arg(obj, arg);
|
||||||
obj->callbacks.print = &print_nameserver;
|
obj->callbacks.print = &print_nameserver;
|
||||||
@ -655,11 +655,11 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ_ARG(goto, 0, "goto needs arguments")
|
END OBJ_ARG(goto, 0, "goto needs arguments")
|
||||||
obj->data.l = atoi(arg);
|
obj->data.l = atoi(arg);
|
||||||
obj->callbacks.print = &new_goto;
|
obj->callbacks.print = &new_goto;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(tab, 0)
|
END OBJ(tab, 0)
|
||||||
scan_tab(obj, arg);
|
scan_tab(obj, arg);
|
||||||
obj->callbacks.print = &new_tab;
|
obj->callbacks.print = &new_tab;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
END OBJ_ARG(i2c, 0, "i2c needs arguments")
|
END OBJ_ARG(i2c, 0, "i2c needs arguments")
|
||||||
parse_i2c_sensor(obj, arg);
|
parse_i2c_sensor(obj, arg);
|
||||||
@ -819,14 +819,14 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(membar, &update_meminfo)
|
END OBJ(membar, &update_meminfo)
|
||||||
scan_bar(obj, arg, 1);
|
scan_bar(obj, arg, 1);
|
||||||
obj->callbacks.barval = &mem_barval;
|
obj->callbacks.barval = &mem_barval;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(memgraph, &update_meminfo)
|
END OBJ(memgraph, &update_meminfo)
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
buf = scan_graph(obj, arg, 1);
|
buf = scan_graph(obj, arg, 1);
|
||||||
|
|
||||||
if (buf) free(buf);
|
if (buf) free(buf);
|
||||||
obj->callbacks.graphval = &mem_barval;
|
obj->callbacks.graphval = &mem_barval;
|
||||||
#endif /* X11*/
|
#endif /* BUILD_X11*/
|
||||||
END OBJ(mixer, 0)
|
END OBJ(mixer, 0)
|
||||||
parse_mixer_arg(obj, arg);
|
parse_mixer_arg(obj, arg);
|
||||||
obj->callbacks.percentage = &mixer_percentage;
|
obj->callbacks.percentage = &mixer_percentage;
|
||||||
@ -848,7 +848,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ_IF(if_mixer_mute, 0)
|
END OBJ_IF(if_mixer_mute, 0)
|
||||||
parse_mixer_arg(obj, arg);
|
parse_mixer_arg(obj, arg);
|
||||||
obj->callbacks.iftest = &check_mixer_muted;
|
obj->callbacks.iftest = &check_mixer_muted;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(monitor, 0)
|
END OBJ(monitor, 0)
|
||||||
obj->callbacks.print = &print_monitor;
|
obj->callbacks.print = &print_monitor;
|
||||||
END OBJ(monitor_number, 0)
|
END OBJ(monitor_number, 0)
|
||||||
@ -859,7 +859,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &print_desktop_number;
|
obj->callbacks.print = &print_desktop_number;
|
||||||
END OBJ(desktop_name, 0)
|
END OBJ(desktop_name, 0)
|
||||||
obj->callbacks.print = &print_desktop_name;
|
obj->callbacks.print = &print_desktop_name;
|
||||||
#endif
|
#endif /* BUILD_X11 */
|
||||||
END OBJ_ARG(format_time, 0, "format_time needs a pid as argument")
|
END OBJ_ARG(format_time, 0, "format_time needs a pid as argument")
|
||||||
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
obj->sub = (text_object*)malloc(sizeof(struct text_object));
|
||||||
extract_variable_text_internal(obj->sub, arg);
|
extract_variable_text_internal(obj->sub, arg);
|
||||||
@ -1011,20 +1011,20 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &print_running_processes;
|
obj->callbacks.print = &print_running_processes;
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
END OBJ(shadecolor, 0)
|
END OBJ(shadecolor, 0)
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
|
obj->data.l = arg ? get_x11_color(arg) : default_bg_color;
|
||||||
obj->callbacks.print = &new_bg;
|
obj->callbacks.print = &new_bg;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(outlinecolor, 0)
|
END OBJ(outlinecolor, 0)
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
obj->data.l = arg ? get_x11_color(arg) : default_out_color;
|
obj->data.l = arg ? get_x11_color(arg) : default_out_color;
|
||||||
obj->callbacks.print = &new_outline;
|
obj->callbacks.print = &new_outline;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(stippled_hr, 0)
|
END OBJ(stippled_hr, 0)
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
scan_stippled_hr(obj, arg);
|
scan_stippled_hr(obj, arg);
|
||||||
obj->callbacks.print = &new_stippled_hr;
|
obj->callbacks.print = &new_stippled_hr;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(swap, &update_meminfo)
|
END OBJ(swap, &update_meminfo)
|
||||||
obj->callbacks.print = &print_swap;
|
obj->callbacks.print = &print_swap;
|
||||||
END OBJ(swapfree, &update_meminfo)
|
END OBJ(swapfree, &update_meminfo)
|
||||||
@ -1085,7 +1085,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(upspeedf, &update_net_stats)
|
END OBJ(upspeedf, &update_net_stats)
|
||||||
parse_net_stat_arg(obj, arg, free_at_crash);
|
parse_net_stat_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_upspeedf;
|
obj->callbacks.print = &print_upspeedf;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(upspeedgraph, &update_net_stats)
|
END OBJ(upspeedgraph, &update_net_stats)
|
||||||
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
parse_net_stat_graph_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.graphval = &upspeedgraphval;
|
obj->callbacks.graphval = &upspeedgraphval;
|
||||||
@ -1142,7 +1142,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
parse_pop3_mail_args(obj, arg);
|
parse_pop3_mail_args(obj, arg);
|
||||||
obj->callbacks.print = &print_pop3_used;
|
obj->callbacks.print = &print_pop3_used;
|
||||||
obj->callbacks.free = &free_mail_obj;
|
obj->callbacks.free = &free_mail_obj;
|
||||||
#ifdef IBM
|
#ifdef BUILD_IBM
|
||||||
END OBJ_ARG(smapi, 0, "smapi needs an argument")
|
END OBJ_ARG(smapi, 0, "smapi needs an argument")
|
||||||
obj->data.s = strndup(arg, text_buffer_size);
|
obj->data.s = strndup(arg, text_buffer_size);
|
||||||
obj->callbacks.print = &print_smapi;
|
obj->callbacks.print = &print_smapi;
|
||||||
@ -1171,8 +1171,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
} else
|
} else
|
||||||
arg = scan_bar(obj, arg + cnt, 100);
|
arg = scan_bar(obj, arg + cnt, 100);
|
||||||
obj->callbacks.barval = &smapi_bat_barval;
|
obj->callbacks.barval = &smapi_bat_barval;
|
||||||
#endif /* IBM */
|
#endif /* BUILD_IBM */
|
||||||
#ifdef MPD
|
#ifdef BUILD_MPD
|
||||||
#define mpd_set_maxlen(name) \
|
#define mpd_set_maxlen(name) \
|
||||||
if (arg) { \
|
if (arg) { \
|
||||||
int i; \
|
int i; \
|
||||||
@ -1259,8 +1259,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.iftest = &check_mpd_playing;
|
obj->callbacks.iftest = &check_mpd_playing;
|
||||||
obj->callbacks.free = &free_mpd;
|
obj->callbacks.free = &free_mpd;
|
||||||
#undef mpd_set_maxlen
|
#undef mpd_set_maxlen
|
||||||
#endif /* MPD */
|
#endif /* BUILD_MPD */
|
||||||
#ifdef MOC
|
#ifdef BUILD_MOC
|
||||||
END OBJ(moc_state, &update_moc)
|
END OBJ(moc_state, &update_moc)
|
||||||
obj->callbacks.print = &print_moc_state;
|
obj->callbacks.print = &print_moc_state;
|
||||||
obj->callbacks.free = &free_moc;
|
obj->callbacks.free = &free_moc;
|
||||||
@ -1294,8 +1294,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(moc_rate, &update_moc)
|
END OBJ(moc_rate, &update_moc)
|
||||||
obj->callbacks.print = &print_moc_rate;
|
obj->callbacks.print = &print_moc_rate;
|
||||||
obj->callbacks.free = &free_moc;
|
obj->callbacks.free = &free_moc;
|
||||||
#endif /* MOC */
|
#endif /* BUILD_MOC */
|
||||||
#ifdef XMMS2
|
#ifdef BUILD_XMMS2
|
||||||
END OBJ(xmms2_artist, &update_xmms2)
|
END OBJ(xmms2_artist, &update_xmms2)
|
||||||
obj->callbacks.print = &print_xmms2_artist;
|
obj->callbacks.print = &print_xmms2_artist;
|
||||||
obj->callbacks.free = &free_xmms2;
|
obj->callbacks.free = &free_xmms2;
|
||||||
@ -1357,8 +1357,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ_IF(if_xmms2_connected, &update_xmms2)
|
END OBJ_IF(if_xmms2_connected, &update_xmms2)
|
||||||
obj->callbacks.iftest = &if_xmms2_connected;
|
obj->callbacks.iftest = &if_xmms2_connected;
|
||||||
obj->callbacks.free = &free_xmms2;
|
obj->callbacks.free = &free_xmms2;
|
||||||
#endif
|
#endif /* BUILD_XMMS2 */
|
||||||
#ifdef AUDACIOUS
|
#ifdef BUILD_AUDACIOUS
|
||||||
END OBJ(audacious_status, &update_audacious)
|
END OBJ(audacious_status, &update_audacious)
|
||||||
obj->callbacks.print = &print_audacious_status;
|
obj->callbacks.print = &print_audacious_status;
|
||||||
END OBJ_ARG(audacious_title, &update_audacious, "audacious_title needs an argument")
|
END OBJ_ARG(audacious_title, &update_audacious, "audacious_title needs an argument")
|
||||||
@ -1394,8 +1394,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(audacious_bar, &update_audacious)
|
END OBJ(audacious_bar, &update_audacious)
|
||||||
scan_bar(obj, arg, 1);
|
scan_bar(obj, arg, 1);
|
||||||
obj->callbacks.barval = &audacious_barval;
|
obj->callbacks.barval = &audacious_barval;
|
||||||
#endif /* AUDACIOUS */
|
#endif /* BUILD_AUDACIOUS */
|
||||||
#ifdef BMPX
|
#ifdef BUIL_BMPX
|
||||||
END OBJ(bmpx_title, &update_bmpx)
|
END OBJ(bmpx_title, &update_bmpx)
|
||||||
obj->callbacks.print = &print_bmpx_title;
|
obj->callbacks.print = &print_bmpx_title;
|
||||||
END OBJ(bmpx_artist, &update_bmpx)
|
END OBJ(bmpx_artist, &update_bmpx)
|
||||||
@ -1408,38 +1408,38 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &print_bmpx_uri;
|
obj->callbacks.print = &print_bmpx_uri;
|
||||||
END OBJ(bmpx_bitrate, &update_bmpx)
|
END OBJ(bmpx_bitrate, &update_bmpx)
|
||||||
obj->callbacks.print = &print_bmpx_bitrate;
|
obj->callbacks.print = &print_bmpx_bitrate;
|
||||||
#endif
|
#endif /* BUILD_BMPX */
|
||||||
#ifdef EVE
|
#ifdef BUILD_EVE
|
||||||
END OBJ_ARG(eve, 0, "eve needs arguments: <userid> <apikey> <characterid>")
|
END OBJ_ARG(eve, 0, "eve needs arguments: <userid> <apikey> <characterid>")
|
||||||
scan_eve(obj, arg);
|
scan_eve(obj, arg);
|
||||||
obj->callbacks.print = &print_eve;
|
obj->callbacks.print = &print_eve;
|
||||||
obj->callbacks.free = &free_eve;
|
obj->callbacks.free = &free_eve;
|
||||||
#endif
|
#endif /* BUILD_EVE */
|
||||||
#ifdef HAVE_CURL
|
#ifdef BUILD_CURL
|
||||||
END OBJ_ARG(curl, 0, "curl needs arguments: <uri> <interval in minutes>")
|
END OBJ_ARG(curl, 0, "curl needs arguments: <uri> <interval in minutes>")
|
||||||
curl_parse_arg(obj, arg);
|
curl_parse_arg(obj, arg);
|
||||||
obj->callbacks.print = &curl_print;
|
obj->callbacks.print = &curl_print;
|
||||||
obj->callbacks.free = &curl_obj_free;
|
obj->callbacks.free = &curl_obj_free;
|
||||||
#endif
|
#endif /* BUILD_CURL */
|
||||||
#ifdef RSS
|
#ifdef BUILD_RSS
|
||||||
END OBJ_ARG(rss, 0, "rss needs arguments: <uri> <interval in minutes> <action> [act_par] [spaces in front]")
|
END OBJ_ARG(rss, 0, "rss needs arguments: <uri> <interval in minutes> <action> [act_par] [spaces in front]")
|
||||||
rss_scan_arg(obj, arg);
|
rss_scan_arg(obj, arg);
|
||||||
obj->callbacks.print = &rss_print_info;
|
obj->callbacks.print = &rss_print_info;
|
||||||
obj->callbacks.free = &rss_free_obj_info;
|
obj->callbacks.free = &rss_free_obj_info;
|
||||||
#endif
|
#endif /* BUILD_RSS */
|
||||||
#ifdef WEATHER
|
#ifdef BUILD_WEATHER_METAR
|
||||||
END OBJ_ARG(weather, 0, "weather needs arguments: <uri> <locID> <data_type> [interval in minutes]")
|
END OBJ_ARG(weather, 0, "weather needs arguments: <uri> <locID> <data_type> [interval in minutes]")
|
||||||
scan_weather_arg(obj, arg, free_at_crash);
|
scan_weather_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_weather;
|
obj->callbacks.print = &print_weather;
|
||||||
obj->callbacks.free = &free_weather;
|
obj->callbacks.free = &free_weather;
|
||||||
#endif
|
#endif /* BUILD_WEATHER_METAR */
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
END OBJ_ARG(weather_forecast, 0, "weather_forecast needs arguments: <uri> <locID> <day> <data_type> [interval in minutes]")
|
END OBJ_ARG(weather_forecast, 0, "weather_forecast needs arguments: <uri> <locID> <day> <data_type> [interval in minutes]")
|
||||||
scan_weather_forecast_arg(obj, arg, free_at_crash);
|
scan_weather_forecast_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_weather_forecast;
|
obj->callbacks.print = &print_weather_forecast;
|
||||||
obj->callbacks.free = &free_weather;
|
obj->callbacks.free = &free_weather;
|
||||||
#endif
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
#ifdef HAVE_LUA
|
#ifdef BUILD_LUA
|
||||||
END OBJ_ARG(lua, 0, "lua needs arguments: <function name> [function parameters]")
|
END OBJ_ARG(lua, 0, "lua needs arguments: <function name> [function parameters]")
|
||||||
obj->data.s = strndup(arg, text_buffer_size);
|
obj->data.s = strndup(arg, text_buffer_size);
|
||||||
obj->verbatim_output = 1;
|
obj->verbatim_output = 1;
|
||||||
@ -1459,7 +1459,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
}
|
}
|
||||||
obj->callbacks.barval = &lua_barval;
|
obj->callbacks.barval = &lua_barval;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#ifdef X11
|
#ifdef BUILD_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, 100);
|
buf = scan_graph(obj, arg, 100);
|
||||||
@ -1470,7 +1470,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
}
|
}
|
||||||
obj->callbacks.graphval = &lua_barval;
|
obj->callbacks.graphval = &lua_barval;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_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, 100);
|
arg = scan_gauge(obj, arg, 100);
|
||||||
if (arg) {
|
if (arg) {
|
||||||
@ -1480,20 +1480,20 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
}
|
}
|
||||||
obj->callbacks.gaugeval = &lua_barval;
|
obj->callbacks.gaugeval = &lua_barval;
|
||||||
obj->callbacks.free = &gen_free_opaque;
|
obj->callbacks.free = &gen_free_opaque;
|
||||||
#endif /* HAVE_LUA */
|
#endif /* BUILD_LUA */
|
||||||
#ifdef HDDTEMP
|
#ifdef BUILD_HDDTEMP
|
||||||
END OBJ(hddtemp, &update_hddtemp)
|
END OBJ(hddtemp, &update_hddtemp)
|
||||||
if (arg)
|
if (arg)
|
||||||
obj->data.s = strndup(arg, text_buffer_size);
|
obj->data.s = strndup(arg, text_buffer_size);
|
||||||
obj->callbacks.print = &print_hddtemp;
|
obj->callbacks.print = &print_hddtemp;
|
||||||
obj->callbacks.free = &free_hddtemp;
|
obj->callbacks.free = &free_hddtemp;
|
||||||
#endif /* HDDTEMP */
|
#endif /* BUILD_HDDTEMP */
|
||||||
#ifdef TCP_PORT_MONITOR
|
#ifdef BUILD_PORT_MONITORS
|
||||||
END OBJ_ARG(tcp_portmon, &tcp_portmon_update, "tcp_portmon: needs arguments")
|
END OBJ_ARG(tcp_portmon, &tcp_portmon_update, "tcp_portmon: needs arguments")
|
||||||
tcp_portmon_init(obj, arg);
|
tcp_portmon_init(obj, arg);
|
||||||
obj->callbacks.print = &tcp_portmon_action;
|
obj->callbacks.print = &tcp_portmon_action;
|
||||||
obj->callbacks.free = &tcp_portmon_free;
|
obj->callbacks.free = &tcp_portmon_free;
|
||||||
#endif /* TCP_PORT_MONITOR */
|
#endif /* BUILD_PORT_MONITORS */
|
||||||
END OBJ(entropy_avail, &update_entropy)
|
END OBJ(entropy_avail, &update_entropy)
|
||||||
obj->callbacks.print = &print_entropy_avail;
|
obj->callbacks.print = &print_entropy_avail;
|
||||||
END OBJ(entropy_perc, &update_entropy)
|
END OBJ(entropy_perc, &update_entropy)
|
||||||
@ -1527,10 +1527,10 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
extract_variable_text_internal(obj->sub, arg);
|
extract_variable_text_internal(obj->sub, arg);
|
||||||
obj->callbacks.print = &print_to_bytes;
|
obj->callbacks.print = &print_to_bytes;
|
||||||
END OBJ(scroll, 0)
|
END OBJ(scroll, 0)
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
/* allocate a follower to reset any color changes */
|
/* allocate a follower to reset any color changes */
|
||||||
obj->next = new_text_object_internal();
|
obj->next = new_text_object_internal();
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
parse_scroll_arg(obj, arg, free_at_crash);
|
parse_scroll_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_scroll;
|
obj->callbacks.print = &print_scroll;
|
||||||
obj->callbacks.free = &free_scroll;
|
obj->callbacks.free = &free_scroll;
|
||||||
@ -1538,7 +1538,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
parse_combine_arg(obj, arg, free_at_crash);
|
parse_combine_arg(obj, arg, free_at_crash);
|
||||||
obj->callbacks.print = &print_combine;
|
obj->callbacks.print = &print_combine;
|
||||||
obj->callbacks.free = &free_combine;
|
obj->callbacks.free = &free_combine;
|
||||||
#ifdef NVIDIA
|
#ifdef BUILD_NVIDIA
|
||||||
END OBJ_ARG(nvidia, 0, "nvidia needs an argument")
|
END OBJ_ARG(nvidia, 0, "nvidia needs an argument")
|
||||||
if (set_nvidia_type(obj, arg)) {
|
if (set_nvidia_type(obj, arg)) {
|
||||||
CRIT_ERR(obj, free_at_crash, "nvidia: invalid argument"
|
CRIT_ERR(obj, free_at_crash, "nvidia: invalid argument"
|
||||||
@ -1546,8 +1546,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
}
|
}
|
||||||
obj->callbacks.print = &print_nvidia_value;
|
obj->callbacks.print = &print_nvidia_value;
|
||||||
obj->callbacks.free = &free_nvidia;
|
obj->callbacks.free = &free_nvidia;
|
||||||
#endif /* NVIDIA */
|
#endif /* BUILD_NVIDIA */
|
||||||
#ifdef APCUPSD
|
#ifdef BUILD_APCUPSD
|
||||||
END OBJ_ARG(apcupsd, &update_apcupsd, "apcupsd needs arguments: <host> <port>")
|
END OBJ_ARG(apcupsd, &update_apcupsd, "apcupsd needs arguments: <host> <port>")
|
||||||
if (apcupsd_scan_arg(arg)) {
|
if (apcupsd_scan_arg(arg)) {
|
||||||
CRIT_ERR(obj, free_at_crash, "apcupsd needs arguments: <host> <port>");
|
CRIT_ERR(obj, free_at_crash, "apcupsd needs arguments: <host> <port>");
|
||||||
@ -1570,13 +1570,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
END OBJ(apcupsd_loadbar, &update_apcupsd)
|
END OBJ(apcupsd_loadbar, &update_apcupsd)
|
||||||
scan_bar(obj, arg, 100);
|
scan_bar(obj, arg, 100);
|
||||||
obj->callbacks.barval = &apcupsd_loadbarval;
|
obj->callbacks.barval = &apcupsd_loadbarval;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
END OBJ(apcupsd_loadgraph, &update_apcupsd)
|
END OBJ(apcupsd_loadgraph, &update_apcupsd)
|
||||||
char* buf = 0;
|
char* buf = 0;
|
||||||
buf = scan_graph(obj, arg, 100);
|
buf = scan_graph(obj, arg, 100);
|
||||||
if (buf) free(buf);
|
if (buf) free(buf);
|
||||||
obj->callbacks.graphval = &apcupsd_loadbarval;
|
obj->callbacks.graphval = &apcupsd_loadbarval;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
END OBJ(apcupsd_loadgauge, &update_apcupsd)
|
END OBJ(apcupsd_loadgauge, &update_apcupsd)
|
||||||
scan_gauge(obj, arg, 100);
|
scan_gauge(obj, arg, 100);
|
||||||
obj->callbacks.gaugeval = &apcupsd_loadbarval;
|
obj->callbacks.gaugeval = &apcupsd_loadbarval;
|
||||||
@ -1588,7 +1588,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
|||||||
obj->callbacks.print = &print_apcupsd_temp;
|
obj->callbacks.print = &print_apcupsd_temp;
|
||||||
END OBJ(apcupsd_lastxfer, &update_apcupsd)
|
END OBJ(apcupsd_lastxfer, &update_apcupsd)
|
||||||
obj->callbacks.print = &print_apcupsd_lastxfer;
|
obj->callbacks.print = &print_apcupsd_lastxfer;
|
||||||
#endif /* APCUPSD */
|
#endif /* BUILD_APCUPSD */
|
||||||
END {
|
END {
|
||||||
char *buf = (char *)malloc(text_buffer_size);
|
char *buf = (char *)malloc(text_buffer_size);
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ void print_diskio_write(struct text_object *obj, char *p, int p_max_size)
|
|||||||
print_diskio_dir(obj, 1, p, p_max_size);
|
print_diskio_dir(obj, 1, p, p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void parse_diskiograph_arg(struct text_object *obj, const char *arg)
|
void parse_diskiograph_arg(struct text_object *obj, const char *arg)
|
||||||
{
|
{
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
@ -174,7 +174,7 @@ double diskiographval_write(struct text_object *obj)
|
|||||||
|
|
||||||
return (diskio ? diskio->current_write : 0);
|
return (diskio ? diskio->current_write : 0);
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
void update_diskio_values(struct diskio_stat *ds,
|
void update_diskio_values(struct diskio_stat *ds,
|
||||||
unsigned int reads, unsigned int writes)
|
unsigned int reads, unsigned int writes)
|
||||||
|
@ -70,11 +70,11 @@ void parse_diskio_arg(struct text_object *, const char *);
|
|||||||
void print_diskio(struct text_object *, char *, int);
|
void print_diskio(struct text_object *, char *, int);
|
||||||
void print_diskio_read(struct text_object *, char *, int);
|
void print_diskio_read(struct text_object *, char *, int);
|
||||||
void print_diskio_write(struct text_object *, char *, int);
|
void print_diskio_write(struct text_object *, char *, int);
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void parse_diskiograph_arg(struct text_object *, const char *);
|
void parse_diskiograph_arg(struct text_object *, const char *);
|
||||||
double diskiographval(struct text_object *);
|
double diskiographval(struct text_object *);
|
||||||
double diskiographval_read(struct text_object *);
|
double diskiographval_read(struct text_object *);
|
||||||
double diskiographval_write(struct text_object *);
|
double diskiographval_write(struct text_object *);
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
#endif /* DISKIO_H_ */
|
#endif /* DISKIO_H_ */
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define EVEURL_TRAINING "http://api.eve-online.com/char/SkillInTraining.xml.aspx"
|
||||||
|
#define EVEURL_SKILLTREE "http://api.eve-online.com/eve/Skilltree.xml.aspx"
|
||||||
|
#define EVE_OUTPUT_FORMAT "%s %d in %s"
|
||||||
|
|
||||||
void scan_eve(struct text_object *, const char *);
|
void scan_eve(struct text_object *, const char *);
|
||||||
void print_eve(struct text_object *, char *, int);
|
void print_eve(struct text_object *, char *, int);
|
||||||
void free_eve(struct text_object *);
|
void free_eve(struct text_object *);
|
||||||
|
@ -270,7 +270,7 @@ void scan_execi_gauge_arg(struct text_object *obj, const char *arg)
|
|||||||
scan_execi_arg(obj, arg);
|
scan_execi_arg(obj, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void scan_execgraph_arg(struct text_object *obj, const char *arg)
|
void scan_execgraph_arg(struct text_object *obj, const char *arg)
|
||||||
{
|
{
|
||||||
struct execi_data *ed;
|
struct execi_data *ed;
|
||||||
@ -287,7 +287,7 @@ void scan_execgraph_arg(struct text_object *obj, const char *arg)
|
|||||||
ed->cmd = buf;
|
ed->cmd = buf;
|
||||||
obj->data.opaque = ed;
|
obj->data.opaque = ed;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
void print_exec(struct text_object *obj, char *p, int p_max_size)
|
void print_exec(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
|
22
src/fonts.c
22
src/fonts.c
@ -38,9 +38,9 @@ char fontloaded = 0;
|
|||||||
|
|
||||||
void set_font(void)
|
void set_font(void)
|
||||||
{
|
{
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
if (use_xft) return;
|
if (use_xft) return;
|
||||||
#endif /* XFT */
|
#endif /* BUILD_XFT */
|
||||||
if (font_count > -1 && fonts[selected_font].font) {
|
if (font_count > -1 && fonts[selected_font].font) {
|
||||||
XSetFont(display, window.gc, fonts[selected_font].font->fid);
|
XSetFont(display, window.gc, fonts[selected_font].font->fid);
|
||||||
}
|
}
|
||||||
@ -51,7 +51,7 @@ void setup_fonts(void)
|
|||||||
if ((output_methods & TO_X) == 0) {
|
if ((output_methods & TO_X) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
if (use_xft) {
|
if (use_xft) {
|
||||||
if (window.xftdraw) {
|
if (window.xftdraw) {
|
||||||
XftDrawDestroy(window.xftdraw);
|
XftDrawDestroy(window.xftdraw);
|
||||||
@ -60,7 +60,7 @@ void setup_fonts(void)
|
|||||||
window.xftdraw = XftDrawCreate(display, window.drawable,
|
window.xftdraw = XftDrawCreate(display, window.drawable,
|
||||||
window.visual, window.colourmap);
|
window.visual, window.colourmap);
|
||||||
}
|
}
|
||||||
#endif /* XFT */
|
#endif /* BUILD_XFT */
|
||||||
set_font();
|
set_font();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ int add_font(const char *data_in)
|
|||||||
// must account for null terminator
|
// must account for null terminator
|
||||||
if (strlen(data_in) < DEFAULT_TEXT_BUFFER_SIZE) {
|
if (strlen(data_in) < DEFAULT_TEXT_BUFFER_SIZE) {
|
||||||
strncpy(fonts[font_count].name, data_in, DEFAULT_TEXT_BUFFER_SIZE);
|
strncpy(fonts[font_count].name, data_in, DEFAULT_TEXT_BUFFER_SIZE);
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
fonts[font_count].font_alpha = 0xffff;
|
fonts[font_count].font_alpha = 0xffff;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -115,7 +115,7 @@ void set_first_font(const char *data_in)
|
|||||||
}
|
}
|
||||||
if (strlen(data_in) > 1) {
|
if (strlen(data_in) > 1) {
|
||||||
strncpy(fonts[0].name, data_in, DEFAULT_TEXT_BUFFER_SIZE);
|
strncpy(fonts[0].name, data_in, DEFAULT_TEXT_BUFFER_SIZE);
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
fonts[0].font_alpha = 0xffff;
|
fonts[0].font_alpha = 0xffff;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ void free_fonts(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (i = 0; i <= font_count; i++) {
|
for (i = 0; i <= font_count; i++) {
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
if (use_xft) {
|
if (use_xft) {
|
||||||
/*
|
/*
|
||||||
* Do we not need to close fonts with Xft? Unsure. Not freeing the
|
* Do we not need to close fonts with Xft? Unsure. Not freeing the
|
||||||
@ -140,7 +140,7 @@ void free_fonts(void)
|
|||||||
*/
|
*/
|
||||||
fonts[i].xftfont = 0;
|
fonts[i].xftfont = 0;
|
||||||
} else
|
} else
|
||||||
#endif /* XFT */
|
#endif /* BUILD_XFT */
|
||||||
{
|
{
|
||||||
XFreeFont(display, fonts[i].font);
|
XFreeFont(display, fonts[i].font);
|
||||||
fonts[i].font = 0;
|
fonts[i].font = 0;
|
||||||
@ -152,12 +152,12 @@ void free_fonts(void)
|
|||||||
}
|
}
|
||||||
font_count = -1;
|
font_count = -1;
|
||||||
selected_font = 0;
|
selected_font = 0;
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
if (window.xftdraw) {
|
if (window.xftdraw) {
|
||||||
XftDrawDestroy(window.xftdraw);
|
XftDrawDestroy(window.xftdraw);
|
||||||
window.xftdraw = 0;
|
window.xftdraw = 0;
|
||||||
}
|
}
|
||||||
#endif /* XFT */
|
#endif /* BUILD_XFT */
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_fonts(void)
|
void load_fonts(void)
|
||||||
@ -167,7 +167,7 @@ void load_fonts(void)
|
|||||||
if ((output_methods & TO_X) == 0)
|
if ((output_methods & TO_X) == 0)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i <= font_count; i++) {
|
for (i = 0; i <= font_count; i++) {
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
/* load Xft font */
|
/* load Xft font */
|
||||||
if (use_xft && fonts[i].xftfont) {
|
if (use_xft && fonts[i].xftfont) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#ifndef _FONTS_H
|
#ifndef _FONTS_H
|
||||||
#define _FONTS_H
|
#define _FONTS_H
|
||||||
|
|
||||||
@ -43,13 +43,13 @@ struct font_list {
|
|||||||
int num;
|
int num;
|
||||||
XFontStruct *font;
|
XFontStruct *font;
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
XftFont *xftfont;
|
XftFont *xftfont;
|
||||||
int font_alpha;
|
int font_alpha;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
|
|
||||||
#define font_height() (use_xft ? (fonts[selected_font].xftfont->ascent + \
|
#define font_height() (use_xft ? (fonts[selected_font].xftfont->ascent + \
|
||||||
fonts[selected_font].xftfont->descent) \
|
fonts[selected_font].xftfont->descent) \
|
||||||
@ -88,4 +88,4 @@ void load_fonts(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _FONTS_H */
|
#endif /* _FONTS_H */
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
/* connection deleted if unseen again after this # of refreshes */
|
/* connection deleted if unseen again after this # of refreshes */
|
||||||
#define TCP_CONNECTION_STARTING_AGE 1
|
#define TCP_CONNECTION_STARTING_AGE 1
|
||||||
#define TCP_PORT_MONITOR_HASH_KEY_SIZE 12
|
#define BUILD_PORT_MONITORS_HASH_KEY_SIZE 12
|
||||||
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256
|
||||||
|
|
||||||
/* -------------------------------------------------------------------
|
/* -------------------------------------------------------------------
|
||||||
|
@ -129,13 +129,13 @@ void llua_init(void)
|
|||||||
lua_pushcfunction(lua_L, &llua_conky_set_update_interval);
|
lua_pushcfunction(lua_L, &llua_conky_set_update_interval);
|
||||||
lua_setglobal(lua_L, "conky_set_update_interval");
|
lua_setglobal(lua_L, "conky_set_update_interval");
|
||||||
|
|
||||||
#if defined(X11) && defined(LUA_EXTRAS)
|
#if defined(BUILD_X11) && defined(LUA_EXTRAS)
|
||||||
/* register tolua++ user types */
|
/* register tolua++ user types */
|
||||||
tolua_open(lua_L);
|
tolua_open(lua_L);
|
||||||
tolua_usertype(lua_L, "Drawable");
|
tolua_usertype(lua_L, "Drawable");
|
||||||
tolua_usertype(lua_L, "Visual");
|
tolua_usertype(lua_L, "Visual");
|
||||||
tolua_usertype(lua_L, "Display");
|
tolua_usertype(lua_L, "Display");
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void llua_load(const char *script)
|
void llua_load(const char *script)
|
||||||
@ -432,7 +432,7 @@ void llua_shutdown_hook(void)
|
|||||||
llua_do_call(shutdown_hook, 0);
|
llua_do_call(shutdown_hook, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void llua_draw_pre_hook(void)
|
void llua_draw_pre_hook(void)
|
||||||
{
|
{
|
||||||
if (!lua_L || !draw_pre_hook) return;
|
if (!lua_L || !draw_pre_hook) return;
|
||||||
@ -512,7 +512,7 @@ void llua_update_window_table(int text_start_x, int text_start_y, int text_width
|
|||||||
|
|
||||||
lua_setglobal(lua_L, "conky_window");
|
lua_setglobal(lua_L, "conky_window");
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
void llua_setup_info(struct information *i, double u_interval)
|
void llua_setup_info(struct information *i, double u_interval)
|
||||||
{
|
{
|
||||||
|
@ -32,9 +32,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#include "x11.h"
|
#include "x11.h"
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
#define LUAPREFIX "conky_"
|
#define LUAPREFIX "conky_"
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ void llua_set_shutdown_hook(const char *args);
|
|||||||
void llua_startup_hook(void);
|
void llua_startup_hook(void);
|
||||||
void llua_shutdown_hook(void);
|
void llua_shutdown_hook(void);
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void llua_draw_pre_hook(void);
|
void llua_draw_pre_hook(void);
|
||||||
void llua_draw_post_hook(void);
|
void llua_draw_post_hook(void);
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void llua_set_draw_post_hook(const char *args);
|
|||||||
|
|
||||||
void llua_setup_window_table(int text_start_x, int text_start_y, int text_width, int text_height);
|
void llua_setup_window_table(int text_start_x, int text_start_y, int text_width, int text_height);
|
||||||
void llua_update_window_table(int text_start_x, int text_start_y, int text_width, int text_height);
|
void llua_update_window_table(int text_start_x, int text_start_y, int text_width, int text_height);
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
void llua_setup_info(struct information *i, double u_interval);
|
void llua_setup_info(struct information *i, double u_interval);
|
||||||
void llua_update_info(struct information *i, double u_interval);
|
void llua_update_info(struct information *i, double u_interval);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
|
||||||
* vim: ts=4 sw=4 noet ai cindent syntax=c
|
* vim: ts=4 sw=4 noet ai cindent syntax=cpp
|
||||||
*
|
*
|
||||||
* Conky, a system monitor, based on torsmo
|
* Conky, a system monitor, based on torsmo
|
||||||
*
|
*
|
||||||
|
@ -191,7 +191,7 @@ void print_addrs(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void parse_net_stat_graph_arg(struct text_object *obj, const char *arg, void *free_at_crash)
|
void parse_net_stat_graph_arg(struct text_object *obj, const char *arg, void *free_at_crash)
|
||||||
{
|
{
|
||||||
char *buf = 0;
|
char *buf = 0;
|
||||||
@ -219,7 +219,7 @@ double upspeedgraphval(struct text_object *obj)
|
|||||||
|
|
||||||
return (ns ? (ns->trans_speed / 1024.0) : 0);
|
return (ns ? (ns->trans_speed / 1024.0) : 0);
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#ifdef HAVE_IWLIB
|
#ifdef HAVE_IWLIB
|
||||||
|
@ -69,11 +69,11 @@ void print_addr(struct text_object *, char *, int);
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
void print_addrs(struct text_object *, char *, int);
|
void print_addrs(struct text_object *, char *, int);
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
|
void parse_net_stat_graph_arg(struct text_object *, const char *, void *);
|
||||||
double downspeedgraphval(struct text_object *);
|
double downspeedgraphval(struct text_object *);
|
||||||
double upspeedgraphval(struct text_object *);
|
double upspeedgraphval(struct text_object *);
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#ifdef HAVE_IWLIB
|
#ifdef HAVE_IWLIB
|
||||||
void print_wireless_essid(struct text_object *, char *, int);
|
void print_wireless_essid(struct text_object *, char *, int);
|
||||||
|
@ -79,11 +79,11 @@ void parse_scroll_arg(struct text_object *obj, const char *arg, void *free_at_cr
|
|||||||
|
|
||||||
obj->data.opaque = sd;
|
obj->data.opaque = sd;
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
/* add a color object right after scroll to reset any color changes */
|
/* add a color object right after scroll to reset any color changes */
|
||||||
obj->next->data.l = sd->resetcolor;
|
obj->next->data.l = sd->resetcolor;
|
||||||
obj->next->callbacks.print = &new_fg;
|
obj->next->callbacks.print = &new_fg;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_scroll(struct text_object *obj, char *p, int p_max_size)
|
void print_scroll(struct text_object *obj, char *p, int p_max_size)
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
#include "colours.h"
|
#include "colours.h"
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "specials.h"
|
#include "specials.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -49,9 +49,9 @@ struct special_t *specials = NULL;
|
|||||||
int special_count;
|
int special_count;
|
||||||
|
|
||||||
int default_bar_width = 0, default_bar_height = 6;
|
int default_bar_width = 0, default_bar_height = 6;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
int default_graph_width = 0, default_graph_height = 25;
|
int default_graph_width = 0, default_graph_height = 25;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
int default_gauge_width = 40, default_gauge_height = 25;
|
int default_gauge_width = 40, default_gauge_height = 25;
|
||||||
|
|
||||||
/* special data types flags */
|
/* special data types flags */
|
||||||
@ -156,7 +156,7 @@ const char *scan_bar(struct text_object *obj, const char *args, double scale)
|
|||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void scan_font(struct text_object *obj, const char *args)
|
void scan_font(struct text_object *obj, const char *args)
|
||||||
{
|
{
|
||||||
if (args && *args)
|
if (args && *args)
|
||||||
@ -244,7 +244,7 @@ char *scan_graph(struct text_object *obj, const char *args, double defscale)
|
|||||||
return strndup(buf, text_buffer_size);
|
return strndup(buf, text_buffer_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Printing various special text objects
|
* Printing various special text objects
|
||||||
@ -270,7 +270,7 @@ void new_gauge_in_shell(struct text_object *obj, char *p, int p_max_size, double
|
|||||||
snprintf(p, p_max_size, "%s", gaugevals[round_to_int(usage * 4 / g->scale)]);
|
snprintf(p, p_max_size, "%s", gaugevals[round_to_int(usage * 4 / g->scale)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void new_gauge_in_x11(struct text_object *obj, char *buf, double usage)
|
void new_gauge_in_x11(struct text_object *obj, char *buf, double usage)
|
||||||
{
|
{
|
||||||
struct special_t *s = 0;
|
struct special_t *s = 0;
|
||||||
@ -289,7 +289,7 @@ void new_gauge_in_x11(struct text_object *obj, char *buf, double usage)
|
|||||||
s->height = g->height;
|
s->height = g->height;
|
||||||
s->scale = g->scale;
|
s->scale = g->scale;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
void new_gauge(struct text_object *obj, char *p, int p_max_size, double usage)
|
void new_gauge(struct text_object *obj, char *p, int p_max_size, double usage)
|
||||||
{
|
{
|
||||||
@ -303,15 +303,15 @@ void new_gauge(struct text_object *obj, char *p, int p_max_size, double usage)
|
|||||||
else
|
else
|
||||||
usage = MIN(g->scale, usage);
|
usage = MIN(g->scale, usage);
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
if (output_methods & TO_X)
|
if (output_methods & TO_X)
|
||||||
new_gauge_in_x11(obj, p, usage);
|
new_gauge_in_x11(obj, p, usage);
|
||||||
else
|
else
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void new_font(struct text_object *obj, char *p, int p_max_size)
|
void new_font(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
struct special_t *s;
|
struct special_t *s;
|
||||||
@ -462,14 +462,14 @@ void new_stippled_hr(struct text_object *obj, char *p, int p_max_size)
|
|||||||
s->height = sh->height;
|
s->height = sh->height;
|
||||||
s->arg = sh->arg;
|
s->arg = sh->arg;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
void new_fg(struct text_object *obj, char *p, int p_max_size)
|
void new_fg(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
if (output_methods & TO_X)
|
if (output_methods & TO_X)
|
||||||
new_special(p, FG)->arg = obj->data.l;
|
new_special(p, FG)->arg = obj->data.l;
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
#ifdef NCURSES
|
#ifdef NCURSES
|
||||||
if (output_methods & TO_NCURSES)
|
if (output_methods & TO_NCURSES)
|
||||||
new_special(p, FG)->arg = obj->data.l;
|
new_special(p, FG)->arg = obj->data.l;
|
||||||
@ -479,7 +479,7 @@ void new_fg(struct text_object *obj, char *p, int p_max_size)
|
|||||||
UNUSED(p_max_size);
|
UNUSED(p_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void new_bg(struct text_object *obj, char *p, int p_max_size)
|
void new_bg(struct text_object *obj, char *p, int p_max_size)
|
||||||
{
|
{
|
||||||
if ((output_methods & TO_X) == 0)
|
if ((output_methods & TO_X) == 0)
|
||||||
@ -490,7 +490,7 @@ void new_bg(struct text_object *obj, char *p, int p_max_size)
|
|||||||
|
|
||||||
new_special(p, BG)->arg = obj->data.l;
|
new_special(p, BG)->arg = obj->data.l;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
static void new_bar_in_shell(struct text_object *obj, char* buffer, int buf_max_size, double usage)
|
static void new_bar_in_shell(struct text_object *obj, char* buffer, int buf_max_size, double usage)
|
||||||
{
|
{
|
||||||
@ -518,7 +518,7 @@ static void new_bar_in_shell(struct text_object *obj, char* buffer, int buf_max_
|
|||||||
buffer[i] = 0;
|
buffer[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
static void new_bar_in_x11(struct text_object *obj, char *buf, double usage)
|
static void new_bar_in_x11(struct text_object *obj, char *buf, double usage)
|
||||||
{
|
{
|
||||||
struct special_t *s = 0;
|
struct special_t *s = 0;
|
||||||
@ -537,7 +537,7 @@ static void new_bar_in_x11(struct text_object *obj, char *buf, double usage)
|
|||||||
s->height = b->height;
|
s->height = b->height;
|
||||||
s->scale = b->scale;
|
s->scale = b->scale;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
/* usage is in range [0,255] */
|
/* usage is in range [0,255] */
|
||||||
void new_bar(struct text_object *obj, char *p, int p_max_size, double usage)
|
void new_bar(struct text_object *obj, char *p, int p_max_size, double usage)
|
||||||
@ -552,11 +552,11 @@ void new_bar(struct text_object *obj, char *p, int p_max_size, double usage)
|
|||||||
else
|
else
|
||||||
usage = MIN(b->scale, usage);
|
usage = MIN(b->scale, usage);
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
if ((output_methods & TO_X))
|
if ((output_methods & TO_X))
|
||||||
new_bar_in_x11(obj, p, usage);
|
new_bar_in_x11(obj, p, usage);
|
||||||
else
|
else
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@ extern int special_count;
|
|||||||
|
|
||||||
extern int default_bar_width;
|
extern int default_bar_width;
|
||||||
extern int default_bar_height;
|
extern int default_bar_height;
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
extern int default_graph_width;
|
extern int default_graph_width;
|
||||||
extern int default_graph_height;
|
extern int default_graph_height;
|
||||||
extern int default_gauge_width;
|
extern int default_gauge_width;
|
||||||
extern int default_gauge_height;
|
extern int default_gauge_height;
|
||||||
#endif
|
#endif /* BUILD_X11 */
|
||||||
|
|
||||||
/* forward declare to avoid mutual inclusion between specials.h and text_object.h */
|
/* forward declare to avoid mutual inclusion between specials.h and text_object.h */
|
||||||
struct text_object;
|
struct text_object;
|
||||||
@ -96,7 +96,7 @@ extern int max_specials;
|
|||||||
/* scanning special arguments */
|
/* scanning special arguments */
|
||||||
const char *scan_bar(struct text_object *, const char *, double);
|
const char *scan_bar(struct text_object *, const char *, double);
|
||||||
const char *scan_gauge(struct text_object *, const char *, double);
|
const char *scan_gauge(struct text_object *, const char *, double);
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
void scan_font(struct text_object *, const char *);
|
void scan_font(struct text_object *, const char *);
|
||||||
char *scan_graph(struct text_object *, const char *, double);
|
char *scan_graph(struct text_object *, const char *, double);
|
||||||
void scan_tab(struct text_object *, const char *);
|
void scan_tab(struct text_object *, const char *);
|
||||||
@ -107,7 +107,7 @@ void new_font(struct text_object *, char *, int);
|
|||||||
void new_graph(struct text_object *, char *, int, double);
|
void new_graph(struct text_object *, char *, int, double);
|
||||||
void new_hr(struct text_object *, char *, int);
|
void new_hr(struct text_object *, char *, int);
|
||||||
void new_stippled_hr(struct text_object *, char *, int);
|
void new_stippled_hr(struct text_object *, char *, int);
|
||||||
#endif
|
#endif /* BUILD_X11 */
|
||||||
void new_gauge(struct text_object *, char *, int, double);
|
void new_gauge(struct text_object *, char *, int, double);
|
||||||
void new_bar(struct text_object *, char *, int, double);
|
void new_bar(struct text_object *, char *, int, double);
|
||||||
void new_fg(struct text_object *, char *, int);
|
void new_fg(struct text_object *, char *, int);
|
||||||
|
@ -36,18 +36,18 @@
|
|||||||
#ifdef MATH
|
#ifdef MATH
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif /* MATH */
|
#endif /* MATH */
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
#include <libxml/xpath.h>
|
#include <libxml/xpath.h>
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
/* WEATHER data */
|
/* WEATHER data */
|
||||||
typedef struct PWEATHER_ {
|
typedef struct PWEATHER_ {
|
||||||
char lastupd[32];
|
char lastupd[32];
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
char xoap_t[32];
|
char xoap_t[32];
|
||||||
char icon[3];
|
char icon[3];
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
int temp;
|
int temp;
|
||||||
int dew;
|
int dew;
|
||||||
int cc;
|
int cc;
|
||||||
@ -58,7 +58,7 @@ typedef struct PWEATHER_ {
|
|||||||
int wc;
|
int wc;
|
||||||
} PWEATHER;
|
} PWEATHER;
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
#define FORECAST_DAYS 5
|
#define FORECAST_DAYS 5
|
||||||
typedef struct PWEATHER_FORECAST_ {
|
typedef struct PWEATHER_FORECAST_ {
|
||||||
int hi[FORECAST_DAYS];
|
int hi[FORECAST_DAYS];
|
||||||
@ -73,7 +73,7 @@ typedef struct PWEATHER_FORECAST_ {
|
|||||||
int ppcp[FORECAST_DAYS];
|
int ppcp[FORECAST_DAYS];
|
||||||
} PWEATHER_FORECAST;
|
} PWEATHER_FORECAST;
|
||||||
|
|
||||||
/* Xpath expressions for XOAP xml parsing */
|
/* Xpath expressions for BUILD_WEATHER_XOAP xml parsing */
|
||||||
#define NUM_XPATH_EXPRESSIONS_CC 8
|
#define NUM_XPATH_EXPRESSIONS_CC 8
|
||||||
const char *xpath_expression_cc[NUM_XPATH_EXPRESSIONS_CC] = {
|
const char *xpath_expression_cc[NUM_XPATH_EXPRESSIONS_CC] = {
|
||||||
"/weather/cc/lsup", "/weather/cc/tmp", "/weather/cc/t",
|
"/weather/cc/lsup", "/weather/cc/tmp", "/weather/cc/t",
|
||||||
@ -89,7 +89,7 @@ const char *xpath_expression_df[NUM_XPATH_EXPRESSIONS_DF] = {
|
|||||||
"/weather/dayf/day[*]/part[1]/ppcp", "/weather/dayf/day[*]/part[1]/hmid",
|
"/weather/dayf/day[*]/part[1]/ppcp", "/weather/dayf/day[*]/part[1]/hmid",
|
||||||
"/weather/dayf/day[*]/@t", "/weather/dayf/day[*]/@dt"
|
"/weather/dayf/day[*]/@t", "/weather/dayf/day[*]/@dt"
|
||||||
};
|
};
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
/* Possible sky conditions */
|
/* Possible sky conditions */
|
||||||
#define NUM_CC_CODES 6
|
#define NUM_CC_CODES 6
|
||||||
@ -113,7 +113,7 @@ const char *WC_CODES[NUM_WC_CODES] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static ccurl_location_list locations_cc;
|
static ccurl_location_list locations_cc;
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
static ccurl_location_list locations_df;
|
static ccurl_location_list locations_df;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ struct weather_data {
|
|||||||
int interval;
|
int interval;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
struct weather_forecast_data {
|
struct weather_forecast_data {
|
||||||
char uri[128];
|
char uri[128];
|
||||||
unsigned int day;
|
unsigned int day;
|
||||||
@ -135,7 +135,7 @@ struct weather_forecast_data {
|
|||||||
void weather_free_info(void)
|
void weather_free_info(void)
|
||||||
{
|
{
|
||||||
ccurl_free_locations(locations_cc);
|
ccurl_free_locations(locations_cc);
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
ccurl_free_locations(locations_df);
|
ccurl_free_locations(locations_df);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ int rel_humidity(int dew_point, int air) {
|
|||||||
#endif /* MATH */
|
#endif /* MATH */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
static void parse_df(PWEATHER_FORECAST *res, xmlXPathContextPtr xpathCtx)
|
static void parse_df(PWEATHER_FORECAST *res, xmlXPathContextPtr xpathCtx)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
@ -321,7 +321,7 @@ static void parse_weather_xml(PWEATHER *res, const char *data)
|
|||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Horrible hack to avoid using regexes
|
* Horrible hack to avoid using regexes
|
||||||
@ -613,7 +613,7 @@ static inline void parse_token(PWEATHER *res, char *token) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
void parse_weather_forecast(void *result, const char *data)
|
void parse_weather_forecast(void *result, const char *data)
|
||||||
{
|
{
|
||||||
PWEATHER_FORECAST *res = (PWEATHER_FORECAST*)result;
|
PWEATHER_FORECAST *res = (PWEATHER_FORECAST*)result;
|
||||||
@ -625,7 +625,7 @@ void parse_weather_forecast(void *result, const char *data)
|
|||||||
parse_weather_forecast_xml(res, data);
|
parse_weather_forecast_xml(res, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
void parse_weather(void *result, const char *data)
|
void parse_weather(void *result, const char *data)
|
||||||
{
|
{
|
||||||
@ -633,12 +633,12 @@ void parse_weather(void *result, const char *data)
|
|||||||
/* Reset results */
|
/* Reset results */
|
||||||
memset(res, 0, sizeof(PWEATHER));
|
memset(res, 0, sizeof(PWEATHER));
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
//Check if it is an xml file
|
//Check if it is an xml file
|
||||||
if ( strncmp(data, "<?xml ", 6) == 0 ) {
|
if ( strncmp(data, "<?xml ", 6) == 0 ) {
|
||||||
parse_weather_xml(res, data);
|
parse_weather_xml(res, data);
|
||||||
} else
|
} else
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
{
|
{
|
||||||
//We assume its a text file
|
//We assume its a text file
|
||||||
char s_tmp[256];
|
char s_tmp[256];
|
||||||
@ -707,7 +707,7 @@ void wind_deg_to_dir(char *p, int p_max_size, int wind_deg) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
static void weather_forecast_process_info(char *p, int p_max_size, char *uri, unsigned int day, char *data_type, int interval)
|
static void weather_forecast_process_info(char *p, int p_max_size, char *uri, unsigned int day, char *data_type, int interval)
|
||||||
{
|
{
|
||||||
PWEATHER_FORECAST *data;
|
PWEATHER_FORECAST *data;
|
||||||
@ -751,7 +751,7 @@ static void weather_forecast_process_info(char *p, int p_max_size, char *uri, un
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
static void weather_process_info(char *p, int p_max_size, char *uri, char *data_type, int interval)
|
static void weather_process_info(char *p, int p_max_size, char *uri, char *data_type, int interval)
|
||||||
{
|
{
|
||||||
@ -782,7 +782,7 @@ static void weather_process_info(char *p, int p_max_size, char *uri, char *data_
|
|||||||
} else if (strcmp(data_type, "temperature") == EQUAL) {
|
} else if (strcmp(data_type, "temperature") == EQUAL) {
|
||||||
temp_print(p, p_max_size, data->temp, TEMP_CELSIUS);
|
temp_print(p, p_max_size, data->temp, TEMP_CELSIUS);
|
||||||
} else if (strcmp(data_type, "cloud_cover") == EQUAL) {
|
} else if (strcmp(data_type, "cloud_cover") == EQUAL) {
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
if (data->xoap_t[0] != '\0') {
|
if (data->xoap_t[0] != '\0') {
|
||||||
char *s = p;
|
char *s = p;
|
||||||
strncpy(p, data->xoap_t, p_max_size);
|
strncpy(p, data->xoap_t, p_max_size);
|
||||||
@ -791,7 +791,7 @@ static void weather_process_info(char *p, int p_max_size, char *uri, char *data_
|
|||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
if (data->cc == 0) {
|
if (data->cc == 0) {
|
||||||
strncpy(p, "", p_max_size);
|
strncpy(p, "", p_max_size);
|
||||||
} else if (data->cc < 3) {
|
} else if (data->cc < 3) {
|
||||||
@ -807,10 +807,10 @@ static void weather_process_info(char *p, int p_max_size, char *uri, char *data_
|
|||||||
} else {
|
} else {
|
||||||
strncpy(p, "cumulonimbus", p_max_size);
|
strncpy(p, "cumulonimbus", p_max_size);
|
||||||
}
|
}
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
} else if (strcmp(data_type, "icon") == EQUAL) {
|
} else if (strcmp(data_type, "icon") == EQUAL) {
|
||||||
strncpy(p, data->icon, p_max_size);
|
strncpy(p, data->icon, p_max_size);
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
} else if (strcmp(data_type, "pressure") == EQUAL) {
|
} else if (strcmp(data_type, "pressure") == EQUAL) {
|
||||||
snprintf(p, p_max_size, "%d", data->bar);
|
snprintf(p, p_max_size, "%d", data->bar);
|
||||||
} else if (strcmp(data_type, "wind_speed") == EQUAL) {
|
} else if (strcmp(data_type, "wind_speed") == EQUAL) {
|
||||||
@ -828,11 +828,11 @@ static void weather_process_info(char *p, int p_max_size, char *uri, char *data_
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
/* xoap suffix for weather from weather.com */
|
/* xoap suffix for weather from weather.com */
|
||||||
static char *xoap_cc = NULL;
|
static char *xoap_cc = NULL;
|
||||||
static char *xoap_df = NULL;
|
static char *xoap_df = NULL;
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR)
|
static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR)
|
||||||
{
|
{
|
||||||
@ -845,7 +845,7 @@ static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Construct complete uri */
|
/* Construct complete uri */
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
if (strstr(uri, "xoap.weather.com")) {
|
if (strstr(uri, "xoap.weather.com")) {
|
||||||
if ((dayf == 0) && (xoap_cc != NULL)) {
|
if ((dayf == 0) && (xoap_cc != NULL)) {
|
||||||
strcat(uri, locID);
|
strcat(uri, locID);
|
||||||
@ -858,7 +858,7 @@ static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR)
|
|||||||
uri = NULL;
|
uri = NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
if (strstr(uri, "weather.noaa.gov")) {
|
if (strstr(uri, "weather.noaa.gov")) {
|
||||||
strcat(uri, locID);
|
strcat(uri, locID);
|
||||||
strcat(uri, ".TXT");
|
strcat(uri, ".TXT");
|
||||||
@ -868,7 +868,7 @@ static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: make the xoap keys file readable from the config file
|
* TODO: make the xoap keys file readable from the config file
|
||||||
@ -963,7 +963,7 @@ void print_weather_forecast(struct text_object *obj, char *p, int p_max_size)
|
|||||||
}
|
}
|
||||||
weather_forecast_process_info(p, p_max_size, wfd->uri, wfd->day, wfd->data_type, wfd->interval);
|
weather_forecast_process_info(p, p_max_size, wfd->uri, wfd->day, wfd->data_type, wfd->interval);
|
||||||
}
|
}
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
void scan_weather_arg(struct text_object *obj, const char *arg, void *free_at_crash)
|
void scan_weather_arg(struct text_object *obj, const char *arg, void *free_at_crash)
|
||||||
{
|
{
|
||||||
|
@ -37,11 +37,11 @@ extern "C" {
|
|||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
void weather_free_info(void);
|
void weather_free_info(void);
|
||||||
|
|
||||||
#ifdef XOAP
|
#ifdef BUILD_WEATHER_XOAP
|
||||||
void load_xoap_keys(void);
|
void load_xoap_keys(void);
|
||||||
void scan_weather_forecast_arg(struct text_object *, const char *, void *);
|
void scan_weather_forecast_arg(struct text_object *, const char *, void *);
|
||||||
void print_weather_forecast(struct text_object *, char *, int);
|
void print_weather_forecast(struct text_object *, char *, int);
|
||||||
#endif /* XOAP */
|
#endif /* BUILD_WEATHER_XOAP */
|
||||||
|
|
||||||
void scan_weather_arg(struct text_object *, const char *, void *);
|
void scan_weather_arg(struct text_object *, const char *, void *);
|
||||||
void print_weather(struct text_object *, char *, int);
|
void print_weather(struct text_object *, char *, int);
|
||||||
|
54
src/x11.cc
54
src/x11.cc
@ -42,20 +42,20 @@
|
|||||||
#include "imlib2.h"
|
#include "imlib2.h"
|
||||||
#endif /* IMLIB2 */
|
#endif /* IMLIB2 */
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
#include <X11/Xft/Xft.h>
|
#include <X11/Xft/Xft.h>
|
||||||
int use_xft = 0;
|
int use_xft = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
int use_xdbe;
|
int use_xdbe;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
int use_argb_visual;
|
int use_argb_visual;
|
||||||
int own_window_argb_value;
|
int own_window_argb_value;
|
||||||
int have_argb_visual;
|
int have_argb_visual;
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
|
|
||||||
/* some basic X11 stuff */
|
/* some basic X11 stuff */
|
||||||
Display *display = NULL;
|
Display *display = NULL;
|
||||||
@ -184,7 +184,7 @@ void set_transparent_background(Window win, int alpha)
|
|||||||
{
|
{
|
||||||
(void)alpha; /* disable warnings when unused */
|
(void)alpha; /* disable warnings when unused */
|
||||||
|
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
if (have_argb_visual) {
|
if (have_argb_visual) {
|
||||||
// real transparency
|
// real transparency
|
||||||
if (set_transparent) {
|
if (set_transparent) {
|
||||||
@ -195,7 +195,7 @@ void set_transparent_background(Window win, int alpha)
|
|||||||
colour_set = background_colour;
|
colour_set = background_colour;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
// pseudo transparency
|
// pseudo transparency
|
||||||
|
|
||||||
if (set_transparent) {
|
if (set_transparent) {
|
||||||
@ -215,12 +215,12 @@ void set_transparent_background(Window win, int alpha)
|
|||||||
XSetWindowBackground(display, win, background_colour);
|
XSetWindowBackground(display, win, background_colour);
|
||||||
colour_set = background_colour;
|
colour_set = background_colour;
|
||||||
}
|
}
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
}
|
}
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
static int get_argb_visual(Visual** visual, int *depth) {
|
static int get_argb_visual(Visual** visual, int *depth) {
|
||||||
/* code from gtk project, gdk_screen_get_rgba_visual */
|
/* code from gtk project, gdk_screen_get_rgba_visual */
|
||||||
XVisualInfo visual_template;
|
XVisualInfo visual_template;
|
||||||
@ -247,15 +247,15 @@ static int get_argb_visual(Visual** visual, int *depth) {
|
|||||||
XFree(visual_list);
|
XFree(visual_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
|
|
||||||
void destroy_window(void)
|
void destroy_window(void)
|
||||||
{
|
{
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
if(window.xftdraw) {
|
if(window.xftdraw) {
|
||||||
XftDrawDestroy(window.xftdraw);
|
XftDrawDestroy(window.xftdraw);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* BUILD_XFT */
|
||||||
if(window.gc) {
|
if(window.gc) {
|
||||||
XFreeGC(display, window.gc);
|
XFreeGC(display, window.gc);
|
||||||
}
|
}
|
||||||
@ -282,21 +282,21 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
if (use_argb_visual && get_argb_visual(&visual, &depth)) {
|
if (use_argb_visual && get_argb_visual(&visual, &depth)) {
|
||||||
have_argb_visual = 1;
|
have_argb_visual = 1;
|
||||||
window.visual = visual;
|
window.visual = visual;
|
||||||
window.colourmap = XCreateColormap(display,
|
window.colourmap = XCreateColormap(display,
|
||||||
DefaultRootWindow(display), window.visual, AllocNone);
|
DefaultRootWindow(display), window.visual, AllocNone);
|
||||||
} else {
|
} else {
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
window.visual = DefaultVisual(display, screen);
|
window.visual = DefaultVisual(display, screen);
|
||||||
window.colourmap = DefaultColormap(display, screen);
|
window.colourmap = DefaultColormap(display, screen);
|
||||||
depth = CopyFromParent;
|
depth = CopyFromParent;
|
||||||
visual = CopyFromParent;
|
visual = CopyFromParent;
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
}
|
}
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
|
|
||||||
if (window.type == TYPE_OVERRIDE) {
|
if (window.type == TYPE_OVERRIDE) {
|
||||||
|
|
||||||
@ -305,16 +305,16 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
XSetWindowAttributes attrs = { ParentRelative, 0L, 0, 0L, 0, 0,
|
XSetWindowAttributes attrs = { ParentRelative, 0L, 0, 0L, 0, 0,
|
||||||
Always, 0L, 0L, False, StructureNotifyMask | ExposureMask, 0L,
|
Always, 0L, 0L, False, StructureNotifyMask | ExposureMask, 0L,
|
||||||
True, 0, 0 };
|
True, 0, 0 };
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
if (have_argb_visual) {
|
if (have_argb_visual) {
|
||||||
attrs.colormap = window.colourmap;
|
attrs.colormap = window.colourmap;
|
||||||
flags = CWBorderPixel | CWColormap | CWOverrideRedirect;
|
flags = CWBorderPixel | CWColormap | CWOverrideRedirect;
|
||||||
} else {
|
} else {
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
flags = CWBackPixel | CWOverrideRedirect;
|
flags = CWBackPixel | CWOverrideRedirect;
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
}
|
}
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
|
|
||||||
/* Parent is desktop window (which might be a child of root) */
|
/* Parent is desktop window (which might be a child of root) */
|
||||||
window.window = XCreateWindow(display, window.desktop, window.x,
|
window.window = XCreateWindow(display, window.desktop, window.x,
|
||||||
@ -337,16 +337,16 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
XWMHints wmHint;
|
XWMHints wmHint;
|
||||||
Atom xa;
|
Atom xa;
|
||||||
|
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
if (have_argb_visual) {
|
if (have_argb_visual) {
|
||||||
attrs.colormap = window.colourmap;
|
attrs.colormap = window.colourmap;
|
||||||
flags = CWBorderPixel | CWColormap | CWOverrideRedirect;
|
flags = CWBorderPixel | CWColormap | CWOverrideRedirect;
|
||||||
} else {
|
} else {
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
flags = CWBackPixel | CWOverrideRedirect;
|
flags = CWBackPixel | CWOverrideRedirect;
|
||||||
#ifdef USE_ARGB
|
#ifdef BUILD_ARGB
|
||||||
}
|
}
|
||||||
#endif /* USE_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
|
|
||||||
if (window.type == TYPE_DOCK) {
|
if (window.type == TYPE_DOCK) {
|
||||||
window.x = window.y = 0;
|
window.x = window.y = 0;
|
||||||
@ -543,7 +543,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour,
|
|||||||
/* Drawable is same as window. This may be changed by double buffering. */
|
/* Drawable is same as window. This may be changed by double buffering. */
|
||||||
window.drawable = window.window;
|
window.drawable = window.window;
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
if (use_xdbe) {
|
if (use_xdbe) {
|
||||||
int major, minor;
|
int major, minor;
|
||||||
|
|
||||||
@ -909,7 +909,7 @@ void set_struts(int sidenum)
|
|||||||
}
|
}
|
||||||
#endif /* OWN_WINDOW */
|
#endif /* OWN_WINDOW */
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
void xdbe_swap_buffers(void)
|
void xdbe_swap_buffers(void)
|
||||||
{
|
{
|
||||||
if (use_xdbe) {
|
if (use_xdbe) {
|
||||||
@ -920,5 +920,5 @@ void xdbe_swap_buffers(void)
|
|||||||
XdbeSwapBuffers(display, &swap, 1);
|
XdbeSwapBuffers(display, &swap, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* HAVE_XDBE */
|
#endif /* BUILD_XDBE */
|
||||||
|
|
||||||
|
22
src/x11.h
22
src/x11.h
@ -1,6 +1,6 @@
|
|||||||
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
|
/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef BUILD_X11
|
||||||
#ifndef X11_H_
|
#ifndef X11_H_
|
||||||
#define X11_H_
|
#define X11_H_
|
||||||
|
|
||||||
@ -8,11 +8,11 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
#include <X11/Xft/Xft.h>
|
#include <X11/Xft/Xft.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
#include <X11/extensions/Xdbe.h>
|
#include <X11/extensions/Xdbe.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -48,10 +48,10 @@ struct conky_window {
|
|||||||
GC gc;
|
GC gc;
|
||||||
long border_inner_margin, border_outer_margin, border_width;
|
long border_inner_margin, border_outer_margin, border_width;
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
XdbeBackBuffer back_buffer;
|
XdbeBackBuffer back_buffer;
|
||||||
#endif
|
#endif
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
XftDraw *xftdraw;
|
XftDraw *xftdraw;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -67,15 +67,15 @@ struct conky_window {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
extern int use_xdbe;
|
extern int use_xdbe;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XFT
|
#ifdef BUILD_XFT
|
||||||
extern int use_xft;
|
extern int use_xft;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_ARGB) && defined(OWN_WINDOW)
|
#if defined(BUILD_ARGB) && defined(OWN_WINDOW)
|
||||||
/* 1 if config var set to 1, otherwise 0 */
|
/* 1 if config var set to 1, otherwise 0 */
|
||||||
extern int use_argb_visual;
|
extern int use_argb_visual;
|
||||||
/* 1 if use_argb_visual=1 and argb visual was found, otherwise 0 */
|
/* 1 if use_argb_visual=1 and argb visual was found, otherwise 0 */
|
||||||
@ -110,9 +110,9 @@ void print_desktop_number(struct text_object *, char *, int);
|
|||||||
void print_desktop_name(struct text_object *, char *, int);
|
void print_desktop_name(struct text_object *, char *, int);
|
||||||
void free_desktop_info(void);
|
void free_desktop_info(void);
|
||||||
|
|
||||||
#ifdef HAVE_XDBE
|
#ifdef BUILD_XDBE
|
||||||
void xdbe_swap_buffers(void);
|
void xdbe_swap_buffers(void);
|
||||||
#endif /* HAVE_XDBE */
|
#endif /* BUILD_XDBE */
|
||||||
|
|
||||||
#endif /*X11_H_*/
|
#endif /*X11_H_*/
|
||||||
#endif /* X11 */
|
#endif /* BUILD_X11 */
|
||||||
|
Loading…
Reference in New Issue
Block a user