diff --git a/cmake/ConkyBuildOptions.cmake b/cmake/ConkyBuildOptions.cmake index 3911ef43..592712df 100644 --- a/cmake/ConkyBuildOptions.cmake +++ b/cmake/ConkyBuildOptions.cmake @@ -130,5 +130,8 @@ option(BUILD_WEATHER_XOAP "Enable XOAP weather support" false) if(BUILD_WEATHER_METAR OR BUILD_WEATHER_XOAP) set(BUILD_CURL true) 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) diff --git a/cmake/config.h.in b/cmake/config.h.in index d03cdede..61a736ab 100644 --- a/cmake/config.h.in +++ b/cmake/config.h.in @@ -31,134 +31,57 @@ #cmakedefine HAVE_FUNOPEN 1 #cmakedefine BUILD_X11 1 -#ifdef BUILD_X11 -#define X11 -#endif /* BUILD_X11 */ #cmakedefine OWN_WINDOW 1 #cmakedefine BUILD_XDAMAGE 1 -#ifdef BUILD_XDAMAGE -#define HAVE_XDAMAGE -#endif /* BUILD_XDAMAGE */ #cmakedefine BUILD_XFT 1 -#ifdef BUILD_XFT -#define XFT -#endif /* BUILD_XFT */ #cmakedefine BUILD_ARGB 1 -#ifdef BUILD_ARGB -#define USE_ARGB -#endif /* BUILD_ARGB */ #cmakedefine BUILD_XDBE 1 -#ifdef BUILD_XDBE -#define HAVE_XDBE -#endif /* BUILD_XDBE */ #cmakedefine BUILD_LUA 1 -#ifdef BUILD_LUA -#define HAVE_LUA -#endif /* BUILD_LUA */ #cmakedefine BUILD_PORT_MONITORS 1 -#ifdef BUILD_PORT_MONITORS -#define TCP_PORT_MONITOR -#endif /* BUILD_PORT_MONITORS */ #cmakedefine BUILD_AUDACIOUS 1 -#ifdef BUILD_AUDACIOUS -#define AUDACIOUS -#endif /* BUILD_AUDACIOUS */ #cmakedefine BUILD_AUDACIOUS_LEGACY 1 -#ifdef BUILD_AUDACIOUS_LEGACY -#define AUDACIOUS_LEGACY -#endif /* BUILD_AUDACIOUS_LEGACY */ #cmakedefine BUILD_MPD 1 -#ifdef BUILD_MPD -#define MPD -#endif /* BUILD_MPD */ #cmakedefine BUILD_MOC 1 -#ifdef BUILD_MOC -#define MOC -#endif /* BUILD_MOC */ #cmakedefine BUILD_NVIDIA 0 -#ifdef BUILD_NVIDIA -#define NVIDIA -#endif /* BUILD_NVIDIA */ #cmakedefine BUILD_XMMS2 1 -#ifdef BUILD_XMMS2 -#define XMMS2 -#endif /* BUILD_XMMS2 */ #cmakedefine BUILD_HDDTEMP 1 -#ifdef BUILD_HDDTEMP -#define HDDTEMP -#endif /* BUILD_HDDTEMP */ #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_CURL 1 -#ifdef BUILD_CURL -#define HAVE_CURL -#endif /* BUILD_CURL */ #cmakedefine BUILD_WEATHER_XOAP 1 #cmakedefine BUILD_WEATHER_METAR 1 -#ifdef BUILD_WEATHER_XOAP -#define XOAP -#define WEATHER -#define XOAP_FILE "$HOME/.xoaprc" -#endif /* BUILD_WEATHER_XOAP */ - -#ifdef BUILD_WEATHER_METAR -#define WEATHER -#endif /* BUILD_WEATHER_METAR */ +#define XOAP_FILE "@XOAP_FILE@" #cmakedefine BUILD_IMLIB2 1 -#ifdef BUILD_IMLIB2 -#define IMLIB2 -#endif /* BUILD_IMLIB2 */ #cmakedefine BUILD_MATH 1 -#ifdef BUILD_MATH -#define MATH -#endif /* BUILD_MATH */ #cmakedefine BUILD_CONFIG_OUTPUT 1 -#ifdef BUILD_CONFIG_OUTPUT -#define CONFIG_OUTPUT -#endif /* BUILD_CONFIG_OUTPUT */ #cmakedefine BUILD_NCURSES 1 -#ifdef BUILD_NCURSES -#define NCURSES -#endif /* BUILD_NCURSES */ #cmakedefine BUILD_APCUPSD 1 -#ifdef BUILD_APCUPSD -#define APCUPSD -#endif /* BUILD_APCUPSD */ #cmakedefine BUILD_IOSTATS 1 -#ifdef BUILD_IOSTATS -#define IOSTATS -#endif /* BUILD_IOSTATS */ #cmakedefine HAVE_ICONV 1 diff --git a/src/audacious.cc b/src/audacious.cc index bce404cf..5876c426 100644 --- a/src/audacious.cc +++ b/src/audacious.cc @@ -29,11 +29,11 @@ #include #include -#ifndef AUDACIOUS_LEGACY +#ifndef BUILD_AUDACIOUS_LEGACY #include #include #include -#else +#else /* BUILD_AUDACIOUS_LEGACY */ #include #define audacious_remote_is_running(x) \ xmms_remote_is_running(x) @@ -55,7 +55,7 @@ xmms_remote_get_playlist_file(x, y) #define audacious_remote_get_playlist_length(x) \ xmms_remote_get_playlist_length(x) -#endif +#endif /* BUILD_AUDACIOUS_LEGACY */ /* access to this item array is synchronized */ static audacious_t audacious_items; @@ -125,7 +125,7 @@ void audacious_thread_func(thread_handle &handle) gint rate, freq, chans, vol; gchar *psong, *pfilename; -#ifndef AUDACIOUS_LEGACY +#ifndef BUILD_AUDACIOUS_LEGACY DBusGProxy *session = NULL; DBusGConnection *connection = NULL; #else @@ -136,7 +136,7 @@ void audacious_thread_func(thread_handle &handle) psong = NULL; pfilename = NULL; -#ifndef AUDACIOUS_LEGACY +#ifndef BUILD_AUDACIOUS_LEGACY g_type_init(); connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); if (!connection) { @@ -147,7 +147,7 @@ void audacious_thread_func(thread_handle &handle) if (!session) { 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. */ while (1) { @@ -242,7 +242,7 @@ void audacious_thread_func(thread_handle &handle) } if (handle.test(0)) { -#ifndef AUDACIOUS_LEGACY +#ifndef BUILD_AUDACIOUS_LEGACY /* release reference to dbus proxy */ g_object_unref(session); #endif diff --git a/src/audacious.h b/src/audacious.h index 65493c19..11d45054 100644 --- a/src/audacious.h +++ b/src/audacious.h @@ -48,10 +48,10 @@ typedef char audacious_t[13][128]; /* type for data exchange with main thread */ 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} */ timed_thread_ptr p_timed_thread; -} AUDACIOUS_S; +} audacious_s; /* create a worker thread for audacious media player status */ 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); double audacious_barval(struct text_object *); -#endif +#endif /* AUDACIOUS_H */ diff --git a/src/colours.cc b/src/colours.cc index e6307307..b9089987 100644 --- a/src/colours.cc +++ b/src/colours.cc @@ -29,7 +29,7 @@ */ #include "conky.h" #include "logging.h" -#ifdef X11 +#ifdef BUILD_X11 #include "x11.h" #endif @@ -43,11 +43,11 @@ static long redmask, greenmask, bluemask; static void set_up_gradient(void) { int i; -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { colour_depth = DisplayPlanes(display, screen); } else -#endif /* X11 */ +#endif /* BUILD_X11 */ { colour_depth = 16; } @@ -173,7 +173,7 @@ unsigned long *do_gradient(int width, unsigned long first_colour, unsigned long return colours; } -#ifdef X11 +#ifdef BUILD_X11 long get_x11_color(const char *name) { XColor color; diff --git a/src/common.cc b/src/common.cc index 64b98e2e..84c256af 100644 --- a/src/common.cc +++ b/src/common.cc @@ -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) { char *buf = 0; @@ -484,7 +484,7 @@ double loadgraphval(struct text_object *obj) return info.loadavg[0]; } -#endif /* X11 */ +#endif /* BUILD_X11 */ uint8_t cpu_percentage(struct text_object *obj) { diff --git a/src/common.h b/src/common.h index d6dd24d4..2f270334 100644 --- a/src/common.h +++ b/src/common.h @@ -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 print_loadavg(struct text_object *, char *, int); -#ifdef X11 +#ifdef BUILD_X11 void scan_loadgraph_arg(struct text_object *, const char *); double loadgraphval(struct text_object *); -#endif /* X11 */ +#endif /* BUILD_X11 */ uint8_t cpu_percentage(struct text_object *); double cpu_barval(struct text_object *); diff --git a/src/conky.cc b/src/conky.cc index feb685da..84f8b92d 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -48,16 +48,16 @@ #ifdef HAVE_SYS_INOTIFY_H #include #endif /* HAVE_SYS_INOTIFY_H */ -#ifdef X11 +#ifdef BUILD_X11 #include "x11.h" #include -#ifdef HAVE_XDAMAGE +#ifdef BUILD_XDAMAGE #include #endif #ifdef IMLIB2 #include "imlib2.h" #endif /* IMLIB2 */ -#endif /* X11 */ +#endif /* BUILD_X11 */ #include #include #include @@ -77,15 +77,15 @@ #include "colours.h" #include "diskio.h" #include "exec.h" -#ifdef X11 +#ifdef BUILD_X11 #include "fonts.h" #endif #ifdef HAVE_ICONV #include "iconv_tools.h" #endif -#ifdef HAVE_LUA +#ifdef BUILD_LUA #include "llua.h" -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ #include "logging.h" #include "mail.h" #include "net_stat.h" @@ -172,102 +172,102 @@ static void print_version(void) printf("\nCompiled in features:\n\n" "System config file: "SYSTEM_CONFIG_FILE"\n" "Package library path: "PACKAGE_LIBDIR"\n\n" -#ifdef X11 +#ifdef BUILD_X11 " X11:\n" -# ifdef HAVE_XDAMAGE +# ifdef BUILD_XDAMAGE " * Xdamage extension\n" -# endif /* HAVE_XDAMAGE */ -# ifdef HAVE_XDBE +# endif /* BUILD_XDAMAGE */ +# ifdef BUILD_XDBE " * XDBE (double buffer extension)\n" -# endif /* HAVE_XDBE */ -# ifdef XFT +# endif /* BUILD_XDBE */ +# ifdef BUILD_XFT " * Xft\n" -# endif /* XFT */ -# ifdef USE_ARGB +# endif /* BUILD_XFT */ +# ifdef BUILD_ARGB " * ARGB visual\n" -# endif /* USE_ARGB */ -#endif /* X11 */ +# endif /* BUILD_ARGB */ +#endif /* BUILD_X11 */ "\n Music detection:\n" -#ifdef AUDACIOUS +#ifdef BUILD_AUDACIOUS " * Audacious\n" -#endif /* AUDACIOUS */ -#ifdef BMPX +#endif /* BUILD_AUDACIOUS */ +#ifdef BUILD_BMPX " * BMPx\n" -#endif /* BMPX */ -#ifdef MPD +#endif /* BUILD_BMPX */ +#ifdef BUILD_MPD " * MPD\n" -#endif /* MPD */ -#ifdef MOC +#endif /* BUILD_MPD */ +#ifdef BUILD_MOC " * MOC\n" -#endif /* MOC */ -#ifdef XMMS2 +#endif /* BUILD_MOC */ +#ifdef BUILD_XMMS2 " * XMMS2\n" -#endif /* XMMS2 */ +#endif /* BUILD_XMMS2 */ "\n General:\n" #ifdef HAVE_OPENMP " * OpenMP\n" #endif /* HAVE_OPENMP */ -#ifdef MATH +#ifdef BUILD_MATH " * math\n" -#endif /* Math */ -#ifdef HDDTEMP +#endif /* BUILD_MATH */ +#ifdef BUILD_HDDTEMP " * hddtemp\n" -#endif /* HDDTEMP */ -#ifdef TCP_PORT_MONITOR +#endif /* BUILD_HDDTEMP */ +#ifdef BUILD_PORT_MONITORS " * portmon\n" -#endif /* TCP_PORT_MONITOR */ -#ifdef HAVE_CURL +#endif /* BUILD_PORT_MONITORS */ +#ifdef BUILD_CURL " * Curl\n" -#endif /* HAVE_CURL */ -#ifdef RSS +#endif /* BUILD_CURL */ +#ifdef BUILD_RSS " * RSS\n" -#endif /* RSS */ -#ifdef WEATHER +#endif /* BUILD_RSS */ +#ifdef BUILD_WEATHER_METAR " * Weather (METAR)\n" -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP " * Weather (XOAP)\n" -#endif /* XOAP */ -#endif /* WEATHER */ +#endif /* BUILD_WEATHER_XOAP */ +#endif /* BUILD_WEATHER_METAR */ #ifdef HAVE_IWLIB " * wireless\n" #endif /* HAVE_IWLIB */ -#ifdef IBM +#ifdef BUILD_IBM " * support for IBM/Lenovo notebooks\n" -#endif /* IBM */ -#ifdef NVIDIA +#endif /* BUILD_IBM */ +#ifdef BUILD_NVIDIA " * nvidia\n" -#endif /* NVIDIA */ -#ifdef EVE +#endif /* BUILD_NVIDIA */ +#ifdef BUILD_EVE " * eve-online\n" -#endif /* EVE */ -#ifdef CONFIG_OUTPUT +#endif /* BUILD_EVE */ +#ifdef BUILD_CONFIG_OUTPUT " * config-output\n" #endif /* CONFIG_OUTPUT */ -#ifdef IMLIB2 +#ifdef BUILD_IMLIB2 " * Imlib2\n" -#endif /* IMLIB2 */ -#ifdef MIXER_IS_ALSA +#endif /* BUILD_IMLIB2 */ +#ifdef BUILD_MIXER_ALSA " * ALSA mixer support\n" -#endif /* MIXER_IS_ALSA */ -#ifdef APCUPSD +#endif /* BUILD_MIXER_ALSA */ +#ifdef BUILD_APCUPSD " * apcupsd\n" -#endif /* APCUPSD */ -#ifdef IOSTATS +#endif /* BUILD_APCUPSD */ +#ifdef BUILD_IOSTATS " * iostats\n" -#endif /* IOSTATS */ -#ifdef NCURSES +#endif /* BUILD_IOSTATS */ +#ifdef BUILD_NCURSES " * ncurses\n" -#endif /* NCURSES */ -#ifdef HAVE_LUA +#endif /* BUILD_NCURSES */ +#ifdef BUILD_LUA " * Lua\n" "\n Lua bindings:\n" -#ifdef HAVE_LUA_CAIRO +#ifdef BUILD_LUA_CAIRO " * Cairo\n" -#endif /* HAVE_LUA_CAIRO */ -#ifdef HAVE_LUA_IMLIB2 +#endif /* BUILD_LUA_CAIRO */ +#ifdef BUILD_LUA_IMLIB2 " * Imlib2\n" -#endif /* IMLIB2 */ -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA_IMLIB2 */ +#endif /* BUILD_LUA */ ); exit(EXIT_SUCCESS); @@ -276,14 +276,14 @@ static void print_version(void) static const char *suffixes[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "" }; -#ifdef X11 +#ifdef BUILD_X11 static void X11_create_window(void); static void X11_initialisation(void); struct _x11_stuff_s { Region region; -#ifdef HAVE_XDAMAGE +#ifdef BUILD_XDAMAGE Damage damage; XserverRegion region2, part; int event_base, error_base; @@ -312,7 +312,7 @@ enum alignment { /* display to connect to */ static char *disp = NULL; -#endif /* X11 */ +#endif /* BUILD_X11 */ /* struct that has all info to be shared between * instances of the same text object */ @@ -336,7 +336,7 @@ static int cpu_avg_samples, net_avg_samples, diskio_avg_samples; char *overwrite_file = NULL; FILE *overwrite_fpointer = NULL; char *append_file = NULL; FILE *append_fpointer = NULL; -#ifdef X11 +#ifdef BUILD_X11 static int show_graph_scale; static int show_graph_range; @@ -373,7 +373,7 @@ static int fixed_size = 0, fixed_pos = 0; static int minimum_width, minimum_height; static int maximum_width; -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef __OpenBSD__ static int sensor_device; @@ -430,13 +430,13 @@ int calc_text_width(const char *s) { size_t slen = strlen(s); -#ifdef X11 +#ifdef BUILD_X11 if ((output_methods & TO_X) == 0) { -#endif /* X11 */ +#endif /* BUILD_X11 */ return slen; -#ifdef X11 +#ifdef BUILD_X11 } -#ifdef XFT +#ifdef BUILD_XFT if (use_xft) { XGlyphInfo gi; @@ -449,11 +449,11 @@ int calc_text_width(const char *s) } return gi.xOff; } else -#endif +#endif /* BUILD_XFT */ { return XTextWidth(fonts[selected_font].font, s, slen); } -#endif /* X11 */ +#endif /* BUILD_X11 */ } /* formatted text to render on screen, generated in generate_text(), @@ -752,10 +752,10 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root) new_bar(obj, p, p_max_size, (*obj->callbacks.barval)(obj)); } else if (obj->callbacks.gaugeval) { new_gauge(obj, p, p_max_size, (*obj->callbacks.gaugeval)(obj)); -#ifdef X11 +#ifdef BUILD_X11 } else if (obj->callbacks.graphval) { new_graph(obj, p, p_max_size, (*obj->callbacks.graphval)(obj)); -#endif /* X11 */ +#endif /* BUILD_X11 */ } else if (obj->callbacks.percentage) { percent_print(p, p_max_size, (*obj->callbacks.percentage)(obj)); } @@ -772,10 +772,10 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root) obj = obj->next; } -#ifdef X11 +#ifdef BUILD_X11 /* load any new fonts we may have had */ load_fonts(); -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef HAVE_ICONV free(buff_in); #endif /* HAVE_ICONV */ @@ -861,7 +861,7 @@ int get_string_width(const char *s) return *s ? calc_text_width(s) : 0; } -#ifdef X11 +#ifdef BUILD_X11 static int get_string_width_special(char *s, int special_index) { char *p, *final; @@ -991,19 +991,19 @@ static void update_text_area(void) text_start_x = x; text_start_y = y; } -#ifdef HAVE_LUA +#ifdef BUILD_LUA /* update lua window globals */ llua_update_window_table(text_start_x, text_start_y, text_width, text_height); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ } /* drawing stuff */ static int cur_x, cur_y; /* current x and y for drawing */ #endif -//draw_mode also without X11 because we only need to print to stdout with FG +//draw_mode also without BUILD_X11 because we only need to print to stdout with FG static int draw_mode; /* FG, BG or OUTLINE */ -#ifdef X11 +#ifdef BUILD_X11 static long current_color; static int text_size_updater(char *s, int special_index) @@ -1087,24 +1087,24 @@ static int text_size_updater(char *s, int special_index) last_font_height = font_height(); return special_index; } -#endif /* X11 */ +#endif /* BUILD_X11 */ static inline void set_foreground_color(long c) { -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { -#ifdef USE_ARGB +#ifdef BUILD_ARGB if (have_argb_visual) { current_color = c | (own_window_argb_value << 24); } else { -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ current_color = c; -#ifdef USE_ARGB +#ifdef BUILD_ARGB } -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ XSetForeground(display, window.gc, current_color); } -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef NCURSES if (output_methods & TO_NCURSES) { attron(COLOR_PAIR(c)); @@ -1159,11 +1159,11 @@ static void draw_string(const char *s) pos = 0; added = 0; -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { max = ((text_width - width_of_s) / get_string_width(" ")); } -#endif /* X11 */ +#endif /* BUILD_X11 */ /* This code looks for tabs in the text and coverts them to spaces. * The trick is getting the correct number of spaces, and not going * over the window's size without forcing the window larger. */ @@ -1182,7 +1182,7 @@ static void draw_string(const char *s) pos++; } } -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { if (text_width == maximum_width) { /* this means the text is probably pushing the limit, @@ -1193,11 +1193,11 @@ static void draw_string(const char *s) } } } -#endif /* X11 */ +#endif /* BUILD_X11 */ s = tmpstring2; -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { -#ifdef XFT +#ifdef BUILD_XFT if (use_xft) { XColor c; XftColor c2; @@ -1226,28 +1226,28 @@ static void draw_string(const char *s) } cur_x += width_of_s; } -#endif /* X11 */ +#endif /* BUILD_X11 */ memcpy(tmpstring1, s, text_buffer_size); } int draw_each_line_inner(char *s, int special_index, int last_special_applied) { -#ifdef X11 +#ifdef BUILD_X11 int font_h = 0; int cur_y_add = 0; -#endif /* X11 */ +#endif /* BUILD_X11 */ char *recurse = 0; char *p = s; int last_special_needed = -1; int orig_special_index = special_index; -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { font_h = font_height(); cur_y += font_ascent(); } cur_x = text_start_x; -#endif /* X11 */ +#endif /* BUILD_X11 */ while (*p) { if (*p == SECRIT_MULTILINE_CHAR) { @@ -1257,9 +1257,9 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) break; } if (*p == SPECIAL_CHAR || last_special_applied > -1) { -#ifdef X11 +#ifdef BUILD_X11 int w = 0; -#endif /* X11 */ +#endif /* BUILD_X11 */ /* draw string before special, unless we're dealing multiline * specials */ @@ -1273,7 +1273,7 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) } /* draw special */ switch (specials[special_index].type) { -#ifdef X11 +#ifdef BUILD_X11 case HORIZONTAL_LINE: { int h = specials[special_index].height; @@ -1568,14 +1568,14 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) font_h = font_height(); break; } -#endif /* X11 */ +#endif /* BUILD_X11 */ case FG: if (draw_mode == FG) { set_foreground_color(specials[special_index].arg); } break; -#ifdef X11 +#ifdef BUILD_X11 case BG: if (draw_mode == BG) { set_foreground_color(specials[special_index].arg); @@ -1657,12 +1657,12 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) last_special_needed = special_index; break; } -#endif /* X11 */ +#endif /* BUILD_X11 */ } -#ifdef X11 +#ifdef BUILD_X11 cur_x += w; -#endif /* X11 */ +#endif /* BUILD_X11 */ if (special_index != last_special_applied) { special_index++; @@ -1674,19 +1674,19 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) p++; } -#ifdef X11 +#ifdef BUILD_X11 cur_y += cur_y_add; -#endif /* X11 */ +#endif /* BUILD_X11 */ draw_string(s); #ifdef NCURSES if (output_methods & TO_NCURSES) { printw("\n"); } #endif /* NCURSES */ -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) cur_y += font_descent(); -#endif /* X11 */ +#endif /* BUILD_X11 */ if (recurse && *recurse) { special_index = draw_each_line_inner(recurse, special_index, last_special_needed); *(recurse - 1) = SECRIT_MULTILINE_CHAR; @@ -1696,11 +1696,11 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) static int draw_line(char *s, int special_index) { -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { return draw_each_line_inner(s, special_index, -1); } -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef NCURSES if (output_methods & TO_NCURSES) { return draw_each_line_inner(s, special_index, -1); @@ -1713,10 +1713,10 @@ static int draw_line(char *s, int special_index) static void draw_text(void) { -#ifdef X11 -#ifdef HAVE_LUA +#ifdef BUILD_X11 +#ifdef BUILD_LUA llua_draw_pre_hook(); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ if (output_methods & TO_X) { cur_y = text_start_y; @@ -1742,15 +1742,15 @@ static void draw_text(void) /* draw text */ } setup_fonts(); -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef NCURSES init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK); attron(COLOR_PAIR(COLOR_WHITE)); #endif /* NCURSES */ for_each_line(text_buffer, draw_line); -#if defined(HAVE_LUA) && defined(X11) +#if defined(BUILD_LUA) && defined(BUILD_X11) llua_draw_post_hook(); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ } static void draw_stuff(void) @@ -1768,7 +1768,7 @@ static void draw_stuff(void) if(!append_fpointer) NORM_ERR("Can't append '%s' anymore", append_file); } -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { selected_font = 0; if (draw_shades && !draw_outline) { @@ -1803,14 +1803,14 @@ static void draw_stuff(void) set_foreground_color(default_fg_color); } -#endif /* X11 */ +#endif /* BUILD_X11 */ draw_mode = FG; draw_text(); -#if defined(X11) && defined(HAVE_XDBE) +#if defined(BUILD_X11) && defined(BUILD_XDBE) if (output_methods & TO_X) { xdbe_swap_buffers(); } -#endif /* X11 && HAVE_XDBE */ +#endif /* BUILD_X11 && BUILD_XDBE */ if(overwrite_fpointer) { fclose(overwrite_fpointer); overwrite_fpointer = 0; @@ -1821,10 +1821,10 @@ static void draw_stuff(void) } } -#ifdef X11 +#ifdef BUILD_X11 static void clear_text(int exposures) { -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE if (use_xdbe) { /* The swap action is XdbeBackground, which clears */ return; @@ -1838,7 +1838,7 @@ static void clear_text(int exposures) text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, exposures ? True : 0); } } -#endif /* X11 */ +#endif /* BUILD_X11 */ static int need_to_update; @@ -1849,14 +1849,14 @@ static void update_text(void) cimlib_cleanup(); #endif /* IMLIB2 */ generate_text(); -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) clear_text(1); -#endif /* X11 */ +#endif /* BUILD_X11 */ need_to_update = 1; -#ifdef HAVE_LUA +#ifdef BUILD_LUA llua_update_info(&info, update_interval); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ } #ifdef HAVE_SYS_INOTIFY_H @@ -1908,7 +1908,7 @@ static void main_loop(void) } #endif -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { XFlush(display); @@ -1966,16 +1966,16 @@ static void main_loop(void) XResizeWindow(display, window.window, window.width, window.height); /* resize window */ set_transparent_background(window.window, own_window_argb_value); -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE /* swap buffers */ xdbe_swap_buffers(); #endif changed++; -#ifdef HAVE_LUA +#ifdef BUILD_LUA /* update lua window globals */ llua_update_window_table(text_start_x, text_start_y, text_width, text_height); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ } /* move window if it isn't in right position */ @@ -2025,7 +2025,7 @@ static void main_loop(void) clear_text(1); -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE if (use_xdbe) { XRectangle r; @@ -2160,22 +2160,22 @@ static void main_loop(void) #endif default: -#ifdef HAVE_XDAMAGE +#ifdef BUILD_XDAMAGE if (ev.type == x11_stuff.event_base + XDamageNotify) { XDamageNotifyEvent *dev = (XDamageNotifyEvent *) &ev; XFixesSetRegion(display, x11_stuff.part, &dev->area, 1); XFixesUnionRegion(display, x11_stuff.region2, x11_stuff.region2, x11_stuff.part); } -#endif /* HAVE_XDAMAGE */ +#endif /* BUILD_XDAMAGE */ break; } } -#ifdef HAVE_XDAMAGE +#ifdef BUILD_XDAMAGE XDamageSubtract(display, x11_stuff.damage, x11_stuff.region2, None); XFixesSetRegion(display, x11_stuff.region2, 0, 0); -#endif /* HAVE_XDAMAGE */ +#endif /* BUILD_XDAMAGE */ /* XDBE doesn't seem to provide a way to clear the back buffer * without interfering with the front buffer, other than passing @@ -2185,7 +2185,7 @@ static void main_loop(void) * all, then no swap happens and we can safely do nothing. */ if (!XEmptyRegion(x11_stuff.region)) { -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE if (use_xdbe) { XRectangle r; @@ -2197,7 +2197,7 @@ static void main_loop(void) } #endif XSetRegion(display, window.gc, x11_stuff.region); -#ifdef XFT +#ifdef BUILD_XFT if (use_xft) { XftDrawSetClip(window.xftdraw, x11_stuff.region); } @@ -2207,7 +2207,7 @@ static void main_loop(void) x11_stuff.region = XCreateRegion(); } } else { -#endif /* X11 */ +#endif /* BUILD_X11 */ t = (next_update_time - get_time()) * 1000000; if(t > 0) usleep((useconds_t)t); update_text(); @@ -2218,9 +2218,9 @@ static void main_loop(void) clear(); } #endif -#ifdef X11 +#ifdef BUILD_X11 } -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef SIGNAL_BLOCKING /* unblock signals of interest and let handler fly */ @@ -2239,20 +2239,20 @@ static void main_loop(void) case SIGTERM: NORM_ERR("received SIGINT or SIGTERM to terminate. bye!"); terminate = 1; -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { XDestroyRegion(x11_stuff.region); x11_stuff.region = NULL; -#ifdef HAVE_XDAMAGE +#ifdef BUILD_XDAMAGE XDamageDestroy(display, x11_stuff.damage); XFixesDestroyRegion(display, x11_stuff.region2); XFixesDestroyRegion(display, x11_stuff.part); -#endif /* HAVE_XDAMAGE */ +#endif /* BUILD_XDAMAGE */ if (disp) { free(disp); } } -#endif /* X11 */ +#endif /* BUILD_X11 */ if(overwrite_file) { free(overwrite_file); overwrite_file = 0; @@ -2308,11 +2308,11 @@ static void main_loop(void) } break; } -#ifdef HAVE_LUA +#ifdef BUILD_LUA else { llua_inotify_query(ev->wd, ev->mask); } -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ idx += INOTIFY_EVENT_SIZE + ev->len; } } @@ -2323,9 +2323,9 @@ static void main_loop(void) } #endif /* HAVE_SYS_INOTIFY_H */ -#ifdef HAVE_LUA +#ifdef BUILD_LUA llua_update_info(&info, update_interval); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ g_signal_pending = 0; } clean_up(NULL, NULL); @@ -2339,9 +2339,9 @@ static void main_loop(void) #endif /* HAVE_SYS_INOTIFY_H */ } -#ifdef X11 +#ifdef BUILD_X11 static void load_config_file_x11(const char *); -#endif /* X11 */ +#endif /* BUILD_X11 */ void initialisation(int argc, char** argv); /* reload the config file */ @@ -2379,7 +2379,7 @@ void clean_up(void *memtofree1, void* memtofree2) free(info.cpu_usage); info.cpu_usage = NULL; } -#ifdef X11 +#ifdef BUILD_X11 if (x_initialised == YES) { if(window_created == 1) { XClearArea(display, window.window, text_start_x - window.border_inner_margin - window.border_outer_margin - window.border_width, @@ -2409,7 +2409,7 @@ void clean_up(void *memtofree1, void* memtofree2) font_count = -1; } -#endif /* X11 */ +#endif /* BUILD_X11 */ free_templates(); @@ -2418,9 +2418,9 @@ void clean_up(void *memtofree1, void* memtofree2) info.first_process = NULL; } -#ifdef X11 +#ifdef BUILD_X11 free_desktop_info(); -#endif /* X11 */ +#endif /* BUILD_X11 */ free_text_objects(&global_root_object); if (tmpstring1) { @@ -2444,22 +2444,22 @@ void clean_up(void *memtofree1, void* memtofree2) free(current_config); current_config = 0; -#ifdef TCP_PORT_MONITOR +#ifdef BUILD_PORT_MONITORS tcp_portmon_clear(); #endif -#ifdef HAVE_CURL +#ifdef BUILD_CURL ccurl_free_info(); #endif #ifdef RSS rss_free_info(); #endif -#ifdef WEATHER +#ifdef BUILD_WEATHER weather_free_info(); #endif -#ifdef HAVE_LUA +#ifdef BUILD_LUA llua_shutdown_hook(); llua_close(); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ #ifdef IMLIB2 if (output_methods & TO_X) cimlib_deinit(); @@ -2501,7 +2501,7 @@ static int string_to_bool(const char *s) return 0; } -#ifdef X11 +#ifdef BUILD_X11 static enum alignment string_to_alignment(const char *s) { if (strcasecmp(s, "top_left") == EQUAL) { @@ -2545,9 +2545,9 @@ static enum alignment string_to_alignment(const char *s) } return TOP_LEFT; } -#endif /* X11 */ +#endif /* BUILD_X11 */ -#ifdef X11 +#ifdef BUILD_X11 static void set_default_configurations_for_x(void) { default_fg_color = WhitePixel(display, screen); @@ -2565,14 +2565,14 @@ static void set_default_configurations_for_x(void) color9 = default_fg_color; current_text_color = default_fg_color; } -#endif /* X11 */ +#endif /* BUILD_X11 */ static void set_default_configurations(void) { -#ifdef MPD +#ifdef BUILD_MPD char *mpd_env_host; char *mpd_env_port; -#endif +#endif /* BUILD_MPD */ update_uname(); fork_to_background = 0; total_run_times = 0; @@ -2590,7 +2590,7 @@ static void set_default_configurations(void) top_io = 0; #endif top_running = 0; -#ifdef MPD +#ifdef BUILD_MPD mpd_env_host = getenv("MPD_HOST"); mpd_env_port = getenv("MPD_PORT"); @@ -2622,8 +2622,8 @@ static void set_default_configurations(void) /* failed to set port from environment variable */ mpd_set_port("6600"); } -#endif -#ifdef XMMS2 +#endif /* BUILD_MPD */ +#ifdef BUILD_XMMS2 info.xmms2.artist = NULL; info.xmms2.album = NULL; info.xmms2.title = NULL; @@ -2632,14 +2632,14 @@ static void set_default_configurations(void) info.xmms2.url = NULL; info.xmms2.status = NULL; info.xmms2.playlist = NULL; -#endif +#endif /* BUILD_XMMS2 */ use_spacer = NO_SPACER; -#ifdef X11 +#ifdef BUILD_X11 output_methods = TO_X; #else output_methods = TO_STDOUT; #endif -#ifdef X11 +#ifdef BUILD_X11 show_graph_scale = 0; show_graph_range = 0; draw_shades = 1; @@ -2658,7 +2658,7 @@ static void set_default_configurations(void) window.hints = 0; strcpy(window.class_name, PACKAGE_NAME); sprintf(window.title, PACKAGE_NAME" (%s)", info.uname_s.nodename); -#ifdef USE_ARGB +#ifdef BUILD_ARGB use_argb_visual = 0; own_window_argb_value = 255; #endif @@ -2675,7 +2675,7 @@ static void set_default_configurations(void) info.x11.desktop.nitems = 0; info.x11.desktop.all_names = NULL; info.x11.desktop.name = NULL; -#endif /* X11 */ +#endif /* BUILD_X11 */ free_templates(); @@ -2698,7 +2698,7 @@ static void set_default_configurations(void) set_times_in_seconds(0); -#ifdef TCP_PORT_MONITOR +#ifdef BUILD_PORT_MONITORS /* set default connection limit */ tcp_portmon_set_max_connections(0); #endif @@ -2726,7 +2726,7 @@ static bool append_works(const char *path) return true; } -#ifdef X11 +#ifdef BUILD_X11 #ifdef DEBUG /* WARNING, this type not in Xlib spec */ int x11_error_handler(Display *d, XErrorEvent *err) @@ -2806,24 +2806,24 @@ static void X11_create_window(void) draw_stuff(); x11_stuff.region = XCreateRegion(); -#ifdef HAVE_XDAMAGE +#ifdef BUILD_XDAMAGE if (!XDamageQueryExtension(display, &x11_stuff.event_base, &x11_stuff.error_base)) { NORM_ERR("Xdamage extension unavailable"); } x11_stuff.damage = XDamageCreate(display, window.window, XDamageReportNonEmpty); x11_stuff.region2 = XFixesCreateRegionFromWindow(display, window.window, 0); x11_stuff.part = XFixesCreateRegionFromWindow(display, window.window, 0); -#endif /* HAVE_XDAMAGE */ +#endif /* BUILD_XDAMAGE */ selected_font = 0; update_text_area(); /* to get initial size of the window */ } -#ifdef HAVE_LUA +#ifdef BUILD_LUA /* setup lua window globals */ llua_setup_window_table(text_start_x, text_start_y, text_width, text_height); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ } -#endif /* X11 */ +#endif /* BUILD_X11 */ #define CONF_ERR NORM_ERR("%s: %d: config file error", f, line) #define CONF_ERR2(a) NORM_ERR("%s: %d: config file error: %s", f, line, a) @@ -2915,7 +2915,7 @@ char load_config_file(const char *f) continue; } -#ifdef X11 +#ifdef BUILD_X11 CONF2("out_to_x") { /* don't listen if X is already initialised or * if we already know we don't want it */ @@ -2962,8 +2962,8 @@ char load_config_file(const char *f) CONF2("background") { fork_to_background = string_to_bool(value); } -#endif /* X11 */ -#ifdef X11 +#endif /* BUILD_X11 */ +#ifdef BUILD_X11 CONF("show_graph_scale") { show_graph_scale = string_to_bool(value); } @@ -2994,7 +2994,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#endif /* X11 */ +#endif /* BUILD_X11 */ #define TEMPLATE_CONF(n) \ CONF("template"#n) { \ if (set_template(n, value)) \ @@ -3037,7 +3037,7 @@ char load_config_file(const char *f) CONF_ERR2("default_bar_size takes 2 integer arguments (ie. 'default_bar_size 0 6')") } } -#ifdef X11 +#ifdef BUILD_X11 CONF("default_graph_size") { char err = 0; if (value) { @@ -3065,7 +3065,7 @@ char load_config_file(const char *f) } } #endif -#ifdef MPD +#ifdef BUILD_MPD CONF("mpd_host") { if (value) { mpd_set_host(value); @@ -3085,7 +3085,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#endif +#endif /* BUILD_MPD */ CONF("music_player_interval") { if (value) { info.music_player_interval = strtod(value, 0); @@ -3139,12 +3139,12 @@ char load_config_file(const char *f) } } -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE CONF("double_buffer") { use_xdbe = string_to_bool(value); } #endif -#ifdef X11 +#ifdef BUILD_X11 CONF("override_utf8_locale") { utf8_mode = string_to_bool(value); } @@ -3160,7 +3160,7 @@ char load_config_file(const char *f) CONF("draw_outline") { draw_outline = string_to_bool(value); } -#endif /* X11 */ +#endif /* BUILD_X11 */ CONF("times_in_seconds") { set_times_in_seconds(string_to_bool(value)); } @@ -3241,8 +3241,8 @@ char load_config_file(const char *f) use_spacer = RIGHT_SPACER; } } -#ifdef X11 -#ifdef XFT +#ifdef BUILD_X11 +#ifdef BUILD_XFT CONF("use_xft") { use_xft = string_to_bool(value); } @@ -3275,7 +3275,7 @@ char load_config_file(const char *f) if (value) { set_first_font(value); } -#ifdef XFT +#ifdef BUILD_XFT } #endif } @@ -3293,7 +3293,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#endif /* X11 */ +#endif /* BUILD_X11 */ CONF("mail_spool") { if (value) { char buffer[256]; @@ -3310,7 +3310,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#ifdef X11 +#ifdef BUILD_X11 CONF("minimum_size") { if (value) { if (sscanf(value, "%d %d", &minimum_width, &minimum_height) @@ -3332,7 +3332,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#endif /* X11 */ +#endif /* BUILD_X11 */ CONF("no_buffers") { no_buffers = string_to_bool(value); } @@ -3362,7 +3362,7 @@ char load_config_file(const char *f) CONF("pad_percents") { pad_percents = atoi(value); } -#ifdef X11 +#ifdef BUILD_X11 #ifdef OWN_WINDOW CONF("own_window") { if (value) { @@ -3439,7 +3439,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#ifdef USE_ARGB +#ifdef BUILD_ARGB CONF("own_window_argb_visual") { use_argb_visual = string_to_bool(value); } @@ -3449,7 +3449,7 @@ char load_config_file(const char *f) CONF_ERR2("own_window_argb_value must be <= 255 and >= 0"); } } -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ #endif CONF("stippled_borders") { if (value) { @@ -3470,7 +3470,7 @@ char load_config_file(const char *f) } } #endif /* IMLIB2 */ -#endif /* X11 */ +#endif /* BUILD_X11 */ CONF("update_interval_on_battery") { if (value) { update_interval_bat = strtod(value, 0); @@ -3525,7 +3525,7 @@ char load_config_file(const char *f) } } CONF("text") { -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { X11_initialisation(); } @@ -3574,7 +3574,7 @@ char load_config_file(const char *f) global_text_lines = line + 1; break; } -#ifdef TCP_PORT_MONITOR +#ifdef BUILD_PORT_MONITORS CONF("max_port_monitor_connections") { int max; if (!value || (sscanf(value, "%d", &max) != 1)) { @@ -3611,7 +3611,7 @@ char load_config_file(const char *f) } } -#ifdef HAVE_LUA +#ifdef BUILD_LUA CONF("lua_load") { if (value) { char *ptr = strtok(value, " "); @@ -3623,7 +3623,7 @@ char load_config_file(const char *f) CONF_ERR; } } -#ifdef X11 +#ifdef BUILD_X11 CONF("lua_draw_hook_pre") { if (value) { llua_set_draw_pre_hook(value); @@ -3652,8 +3652,8 @@ char load_config_file(const char *f) CONF_ERR; } } -#endif /* X11 */ -#endif /* HAVE_LUA */ +#endif /* BUILD_X11 */ +#endif /* BUILD_LUA */ CONF("color0"){} CONF("color1"){} @@ -3688,13 +3688,13 @@ char load_config_file(const char *f) CRIT_ERR(0, 0, "no output_methods have been selected; exiting"); } #if defined(NCURSES) -#if defined(X11) +#if defined(BUILD_X11) if ((output_methods & TO_X) && (output_methods & TO_NCURSES)) { NORM_ERR("out_to_x and out_to_ncurses are incompatible, turning out_to_ncurses off"); output_methods &= ~TO_NCURSES; endwin(); } -#endif /* X11 */ +#endif /* BUILD_X11 */ if ((output_methods & (TO_STDOUT | TO_STDERR)) && (output_methods & TO_NCURSES)) { NORM_ERR("out_to_ncurses conflicts with out_to_console and out_to_stderr, disabling the later ones"); output_methods &= ~(TO_STDOUT | TO_STDERR); @@ -3703,7 +3703,7 @@ char load_config_file(const char *f) return TRUE; } -#ifdef X11 +#ifdef BUILD_X11 static void load_config_file_x11(const char *f) { int line = 0; @@ -3868,7 +3868,7 @@ static void load_config_file_x11(const char *f) } #endif CONF("text") { - /* initialize X11 if nothing X11-related is mentioned before TEXT (and if X11 is the default outputmethod) */ + /* initialize BUILD_X11 if nothing BUILD_X11-related is mentioned before TEXT (and if BUILD_X11 is the default outputmethod) */ if(output_methods & TO_X) { X11_initialisation(); } @@ -3886,7 +3886,7 @@ static void load_config_file_x11(const char *f) fclose(fp); } -#endif /* X11 */ +#endif /* BUILD_X11 */ static void print_help(const char *prog_name) { printf("Usage: %s [OPTION]...\n" @@ -3903,20 +3903,20 @@ static void print_help(const char *prog_name) { #endif " -d, --daemonize daemonize, fork to background\n" " -h, --help help\n" -#ifdef X11 +#ifdef BUILD_X11 " -a, --alignment=ALIGNMENT text alignment on screen, {top,bottom,middle}_{left,right,middle}\n" " -f, --font=FONT font to use\n" - " -X, --display=DISPLAY X11 display to use\n" + " -X, --display=DISPLAY BUILD_X11 display to use\n" #ifdef OWN_WINDOW " -o, --own-window create own window to draw\n" #endif -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE " -b, --double-buffer double buffer (prevents flickering)\n" #endif " -w, --window-id=WIN_ID window id to draw\n" " -x X x position\n" " -y Y y position\n" -#endif /* X11 */ +#endif /* BUILD_X11 */ " -t, --text=TEXT text to render, remember single quotes, like -t '$uptime'\n" " -u, --interval=SECS update interval\n" " -i COUNT number of times to update "PACKAGE_NAME" (and quit)\n" @@ -3927,15 +3927,15 @@ static void print_help(const char *prog_name) { /* : means that character before that takes an argument */ static const char *getopt_string = "vVqdDt:u:i:hc:p:" -#ifdef X11 +#ifdef BUILD_X11 "x:y:w:a:f:X:" #ifdef OWN_WINDOW "o" #endif -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE "b" #endif -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef CONFIG_OUTPUT "C" #endif @@ -3950,18 +3950,18 @@ static const struct option longopts[] = { { "print-config", 0, NULL, 'C' }, #endif { "daemonize", 0, NULL, 'd' }, -#ifdef X11 +#ifdef BUILD_X11 { "alignment", 1, NULL, 'a' }, { "font", 1, NULL, 'f' }, { "display", 1, NULL, 'X' }, #ifdef OWN_WINDOW { "own-window", 0, NULL, 'o' }, #endif -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE { "double-buffer", 0, NULL, 'b' }, #endif { "window-id", 1, NULL, 'w' }, -#endif /* X11 */ +#endif /* BUILD_X11 */ { "text", 1, NULL, 't' }, { "interval", 0, NULL, 'u' }, { "pause", 0, NULL, 'p' }, @@ -4020,7 +4020,7 @@ void initialisation(int argc, char **argv) { case 'd': fork_to_background = 1; break; -#ifdef X11 +#ifdef BUILD_X11 case 'f': set_first_font(optarg); break; @@ -4033,12 +4033,12 @@ void initialisation(int argc, char **argv) { own_window = 1; break; #endif -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE case 'b': use_xdbe = 1; break; #endif -#endif /* X11 */ +#endif /* BUILD_X11 */ case 't': if (global_text) { free(global_text); @@ -4060,7 +4060,7 @@ void initialisation(int argc, char **argv) { case 'i': total_run_times = strtod(optarg, 0); break; -#ifdef X11 +#ifdef BUILD_X11 case 'x': gap_x = atoi(optarg); break; @@ -4068,7 +4068,7 @@ void initialisation(int argc, char **argv) { case 'y': gap_y = atoi(optarg); break; -#endif /* X11 */ +#endif /* BUILD_X11 */ case 'p': startup_pause = atoi(optarg); sleep(startup_pause); @@ -4079,12 +4079,12 @@ void initialisation(int argc, char **argv) { } } -#ifdef X11 +#ifdef BUILD_X11 /* load font */ if (output_methods & TO_X) { load_config_file_x11(current_config); } -#endif /* X11 */ +#endif /* BUILD_X11 */ /* generate text and get initial size */ extract_variable_text(global_text); @@ -4128,14 +4128,14 @@ void initialisation(int argc, char **argv) { tmpstring2 = (char*)malloc(text_buffer_size); memset(tmpstring2, 0, text_buffer_size); -#ifdef X11 +#ifdef BUILD_X11 xargc = argc; xargv = argv; X11_create_window(); -#endif /* X11 */ -#ifdef HAVE_LUA +#endif /* BUILD_X11 */ +#ifdef BUILD_LUA llua_setup_info(&info, update_interval); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ #ifdef XOAP xmlInitParser(); #endif /* XOAP */ @@ -4156,14 +4156,14 @@ void initialisation(int argc, char **argv) { NORM_ERR("error setting signal handler: %s", strerror(errno)); } -#ifdef HAVE_LUA +#ifdef BUILD_LUA llua_startup_hook(); -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ } int main(int argc, char **argv) { -#ifdef X11 +#ifdef BUILD_X11 char *s, *temp; unsigned int x; #endif @@ -4177,13 +4177,13 @@ int main(int argc, char **argv) free_templates(); clear_net_stats(); -#ifdef TCP_PORT_MONITOR +#ifdef BUILD_PORT_MONITORS /* set default connection limit */ tcp_portmon_set_max_connections(0); #endif /* handle command line parameters that don't change configs */ -#ifdef X11 +#ifdef BUILD_X11 if (((s = getenv("LC_ALL")) && *s) || ((s = getenv("LC_CTYPE")) && *s) || ((s = getenv("LANG")) && *s)) { temp = (char *) malloc((strlen(s) + 1) * sizeof(char)); @@ -4203,7 +4203,7 @@ int main(int argc, char **argv) if (!setlocale(LC_CTYPE, "")) { NORM_ERR("Can't set the specified locale!\nCheck LANG, LC_CTYPE, LC_ALL."); } -#endif /* X11 */ +#endif /* BUILD_X11 */ while (1) { int c = getopt_long(argc, argv, getopt_string, longopts, NULL); @@ -4236,7 +4236,7 @@ int main(int argc, char **argv) print_defconfig(); return 0; #endif -#ifdef X11 +#ifdef BUILD_X11 case 'w': window.window = strtol(optarg, 0, 0); break; @@ -4245,7 +4245,7 @@ int main(int argc, char **argv) free(disp); disp = strdup(optarg); break; -#endif /* X11 */ +#endif /* BUILD_X11 */ case '?': exit(EXIT_FAILURE); diff --git a/src/conky.h b/src/conky.h index fe59fbbd..81eb7e2c 100644 --- a/src/conky.h +++ b/src/conky.h @@ -66,66 +66,66 @@ char *strndup(const char *s, size_t n); /* forward define to make gcc happy */ struct text_object; -#ifdef BMPX +#ifdef BUILD_BMPX #include "bmpx.h" -#endif +#endif /* BUILD_BMPX */ -#ifdef EVE +#ifdef BUILD_EVE #include "eve.h" -#endif +#endif /* BUILD_EVE */ -#ifdef HDDTEMP +#ifdef BUILD_HDDTEMP #include "hddtemp.h" -#endif /* HDDTEMP */ +#endif /* BUILD_HDDTEMP */ -#ifdef MOC +#ifdef BUILD_MOC #include "moc.h" -#endif +#endif /* BUILD_MOC */ -#ifdef MPD +#ifdef BUILD_MPD #include "mpd.h" -#endif +#endif /* BUILD_MPD */ #ifdef __cplusplus /* this hack exists only to get around a compilation issue with some files * being converted to C++, will need a better solution */ /* C++ headers */ -#ifdef HAVE_CURL +#ifdef BUILD_CURL #include "ccurl_thread.h" -#endif /* HAVE_CURL */ +#endif /* BUILD_CURL */ -#ifdef AUDACIOUS +#ifdef BUILD_AUDACIOUS #include "audacious.h" -#endif +#endif /* BUILD_AUDACIOUS */ #endif /* __cplusplus */ -#ifdef RSS +#ifdef BUILD_RSS #include "rss.h" -#endif /* RSS */ +#endif /* BUILD_RSS */ -#ifdef XOAP -#ifndef WEATHER -#error "WEATHER needs to be defined if XOAP is defined" -#endif /* WEATHER */ -#endif /* XOAP */ +#ifdef BUILD_WEATHER_XOAP +#ifndef BUILD_WEATHER_METAR +#error "BUILD_WEATHER_METAR needs to be defined if XOAP is defined" +#endif /* BUILD_WEATHER_METAR */ +#endif /* BUILD_WEATHER_XOAP */ -#ifdef WEATHER +#ifdef BUILD_WEATHER_METAR #include "weather.h" -#endif /* WEATHER */ +#endif /* BUILD_WEATHER_METAR */ -#ifdef TCP_PORT_MONITOR +#ifdef BUILD_PORT_MONITORS #include "tcp-portmon.h" #endif -#ifdef XMMS2 +#ifdef BUILD_XMMS2 #include "xmms2.h" -#endif +#endif /* BUILD_XMMS2 */ -#ifdef APCUPSD +#ifdef BUILD_APCUPSD #include "apcupsd.h" -#endif +#endif /* BUILD_APCUPSD */ /* sony support */ #include "sony.h" @@ -142,7 +142,7 @@ struct usr_info { int number; }; -#ifdef X11 +#ifdef BUILD_X11 struct monitor_info { int number; int current; @@ -161,7 +161,7 @@ struct x11_info { struct desktop_info desktop; }; -#endif /* X11 */ +#endif /* BUILD_X11 */ /* defined in conky.c */ extern long default_fg_color, default_bg_color, default_out_color; @@ -228,29 +228,29 @@ struct information { float loadavg[3]; -#ifdef XMMS2 +#ifdef BUILD_XMMS2 struct xmms2_s xmms2; +#endif /* BUILD_XMMS2 */ +#ifdef BUILD_AUDACIOUS + audacious_s audacious; #endif -#ifdef AUDACIOUS - AUDACIOUS_S audacious; -#endif -#ifdef BMPX +#ifdef BUILD_BMPX struct bmpx_s bmpx; -#endif +#endif /* BUILD_BMPX */ struct usr_info users; struct process *cpu[10]; struct process *memu[10]; struct process *time[10]; -#ifdef IOSTATS +#ifdef BUILD_IOSTATS struct process *io[10]; -#endif +#endif /* BUILD_IOSTATS */ struct process *first_process; unsigned long looped; double music_player_interval; -#ifdef X11 +#ifdef BUILD_X11 struct x11_info x11; -#endif +#endif /* BUILD_X11 */ short kflags; /* kernel settings, see enum KFLAG */ }; @@ -273,9 +273,9 @@ enum { /* defined in conky.c, needed by top.c */ extern int top_cpu, top_mem, top_time; -#ifdef IOSTATS +#ifdef BUILD_IOSTATS extern int top_io; -#endif +#endif /* BUILD_IOSTATS */ extern int top_running; /* defined in conky.c, needed by top.c */ @@ -341,16 +341,16 @@ extern unsigned int max_user_text; /* path to config file */ extern char *current_config; -#ifdef X11 +#ifdef BUILD_X11 #define TO_X 1 -#endif /* X11 */ +#endif /* BUILD_X11 */ #define TO_STDOUT 2 #define TO_STDERR 4 #define OVERWRITE_FILE 8 #define APPEND_FILE 16 -#ifdef NCURSES +#ifdef BUILD_NCURSES #define TO_NCURSES 32 -#endif /* NCURSES */ +#endif /* BUILD_NCURSES */ enum x_initialiser_state { NO = 0, YES = 1, diff --git a/src/core.cc b/src/core.cc index 9dc17945..bcb7f492 100644 --- a/src/core.cc +++ b/src/core.cc @@ -42,26 +42,26 @@ #include "i8k.h" #include "imlib2.h" #include "proc.h" -#ifdef X11 +#ifdef BUILD_X11 #include "fonts.h" #endif #include "fs.h" -#ifdef IBM +#ifdef BUILD_IBM #include "ibm.h" #include "smapi.h" #endif #ifdef HAVE_ICONV #include "iconv_tools.h" #endif -#ifdef HAVE_LUA +#ifdef BUILD_LUA #include "llua.h" -#endif /* HAVE_LUA */ +#endif /* BUILD_LUA */ #include "logging.h" #include "mixer.h" #include "mail.h" #include "mboxscan.h" #include "net_stat.h" -#ifdef NVIDIA +#ifdef BUILD_NVIDIA #include "nvidia.h" #endif #include "read_tcp.h" @@ -75,7 +75,7 @@ #include "user.h" #include "users.h" -#ifdef NCURSES +#ifdef BUILD_NCURSES #include #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 END } } else -#ifdef X11 +#ifdef BUILD_X11 if (s[0] == '#') { obj->data.l = get_x11_color(s); obj->callbacks.print = &new_fg; } else -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifndef __OpenBSD__ OBJ(acpitemp, 0) 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; END OBJ(i8k_buttons_status, &update_i8k) obj->callbacks.print = &print_i8k_buttons_status; -#if defined(IBM) +#if defined(BUILD_IBM) END OBJ(ibm_fan, 0) obj->callbacks.print = &get_ibm_acpi_fan; 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); obj->callbacks.barval = &cpu_barval; DBGP2("Adding $cpubar for CPU %d", obj->data.i); -#ifdef X11 +#ifdef BUILD_X11 END OBJ(cpugraph, &update_cpu_usage) char *buf = 0; 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) scan_loadgraph_arg(obj, arg); obj->callbacks.graphval = &loadgraphval; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(diskio, &update_diskio) parse_diskio_arg(obj, arg); 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) parse_diskio_arg(obj, arg); obj->callbacks.print = &print_diskio_write; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(diskiograph, &update_diskio) parse_diskiograph_arg(obj, arg); 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) parse_diskiograph_arg(obj, arg); obj->callbacks.graphval = &diskiographval_write; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(color, 0) -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) { obj->data.l = arg ? get_x11_color(arg) : default_fg_color; set_current_text_color(obj->data.l); } -#endif /* X11 */ -#ifdef NCURSES +#endif /* BUILD_X11 */ +#ifdef BUILD_NCURSES if (output_methods & TO_NCURSES) { obj->data.l = COLOR_WHITE; 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); init_pair(obj->data.l, obj->data.l, COLOR_BLACK); } -#endif /* NCURSES */ +#endif /* BUILD_NCURSES */ obj->callbacks.print = &new_fg; END OBJ(color0, 0) 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; set_current_text_color(obj->data.l); obj->callbacks.print = &new_fg; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(font, 0) scan_font(obj, arg); obj->callbacks.print = &new_font; obj->callbacks.free = &gen_free_opaque; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(conky_version, 0) obj_be_plain_text(obj, VERSION); 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) parse_net_stat_arg(obj, arg, free_at_crash); obj->callbacks.print = &print_downspeedf; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(downspeedgraph, &update_net_stats) parse_net_stat_graph_arg(obj, arg, free_at_crash); obj->callbacks.graphval = &downspeedgraphval; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(else, 0) obj_be_ifblock_else(ifblock_opaque, obj); 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->callbacks.print = &print_evaluate; obj->callbacks.free = &gen_free_opaque; -#if defined(IMLIB2) && defined(X11) +#if defined(BUILD_IMLIB2) && defined(BUILD_X11) END OBJ(image, 0) obj->data.s = strndup(arg ? arg : "", text_buffer_size); obj->callbacks.print = &print_image_callback; obj->callbacks.free = &gen_free_opaque; -#endif /* IMLIB2 */ +#endif /* BUILD_IMLIB2 */ END OBJ(exec, 0) scan_exec_arg(obj, arg); 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); obj->callbacks.gaugeval = &execbarval; obj->callbacks.free = &free_exec; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(execgraph, 0) scan_execgraph_arg(obj, arg); obj->callbacks.graphval = &execbarval; obj->callbacks.free = &free_exec; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ_ARG(execibar, 0, "execibar needs arguments") scan_execi_bar_arg(obj, arg); obj->callbacks.barval = &execi_barval; obj->callbacks.free = &free_execi; -#ifdef X11 +#ifdef BUILD_X11 END OBJ_ARG(execigraph, 0, "execigraph needs arguments") scan_execgraph_arg(obj, arg); obj->callbacks.graphval = &execi_barval; obj->callbacks.free = &free_execi; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ_ARG(execigauge, 0, "execigauge needs arguments") scan_execi_gauge_arg(obj, arg); 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) init_fs(obj, arg); obj->callbacks.print = &print_fs_used; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(hr, 0) obj->data.l = arg ? atoi(arg) : 1; obj->callbacks.print = &new_hr; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(nameserver, &update_dns_data) parse_nameserver_arg(obj, arg); 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") obj->data.l = atoi(arg); obj->callbacks.print = &new_goto; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(tab, 0) scan_tab(obj, arg); obj->callbacks.print = &new_tab; -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef __linux__ END OBJ_ARG(i2c, 0, "i2c needs arguments") 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) scan_bar(obj, arg, 1); obj->callbacks.barval = &mem_barval; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(memgraph, &update_meminfo) char *buf = 0; buf = scan_graph(obj, arg, 1); if (buf) free(buf); obj->callbacks.graphval = &mem_barval; -#endif /* X11*/ +#endif /* BUILD_X11*/ END OBJ(mixer, 0) parse_mixer_arg(obj, arg); 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) parse_mixer_arg(obj, arg); obj->callbacks.iftest = &check_mixer_muted; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(monitor, 0) obj->callbacks.print = &print_monitor; 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; END OBJ(desktop_name, 0) obj->callbacks.print = &print_desktop_name; -#endif +#endif /* BUILD_X11 */ END OBJ_ARG(format_time, 0, "format_time needs a pid as argument") obj->sub = (text_object*)malloc(sizeof(struct text_object)); 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; #endif /* __linux__ */ END OBJ(shadecolor, 0) -#ifdef X11 +#ifdef BUILD_X11 obj->data.l = arg ? get_x11_color(arg) : default_bg_color; obj->callbacks.print = &new_bg; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(outlinecolor, 0) -#ifdef X11 +#ifdef BUILD_X11 obj->data.l = arg ? get_x11_color(arg) : default_out_color; obj->callbacks.print = &new_outline; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(stippled_hr, 0) -#ifdef X11 +#ifdef BUILD_X11 scan_stippled_hr(obj, arg); obj->callbacks.print = &new_stippled_hr; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(swap, &update_meminfo) obj->callbacks.print = &print_swap; 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) parse_net_stat_arg(obj, arg, free_at_crash); obj->callbacks.print = &print_upspeedf; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(upspeedgraph, &update_net_stats) parse_net_stat_graph_arg(obj, arg, free_at_crash); 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); obj->callbacks.print = &print_pop3_used; obj->callbacks.free = &free_mail_obj; -#ifdef IBM +#ifdef BUILD_IBM END OBJ_ARG(smapi, 0, "smapi needs an argument") obj->data.s = strndup(arg, text_buffer_size); obj->callbacks.print = &print_smapi; @@ -1171,8 +1171,8 @@ struct text_object *construct_text_object(const char *s, const char *arg, long } else arg = scan_bar(obj, arg + cnt, 100); obj->callbacks.barval = &smapi_bat_barval; -#endif /* IBM */ -#ifdef MPD +#endif /* BUILD_IBM */ +#ifdef BUILD_MPD #define mpd_set_maxlen(name) \ if (arg) { \ 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.free = &free_mpd; #undef mpd_set_maxlen -#endif /* MPD */ -#ifdef MOC +#endif /* BUILD_MPD */ +#ifdef BUILD_MOC END OBJ(moc_state, &update_moc) obj->callbacks.print = &print_moc_state; 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) obj->callbacks.print = &print_moc_rate; obj->callbacks.free = &free_moc; -#endif /* MOC */ -#ifdef XMMS2 +#endif /* BUILD_MOC */ +#ifdef BUILD_XMMS2 END OBJ(xmms2_artist, &update_xmms2) obj->callbacks.print = &print_xmms2_artist; 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) obj->callbacks.iftest = &if_xmms2_connected; obj->callbacks.free = &free_xmms2; -#endif -#ifdef AUDACIOUS +#endif /* BUILD_XMMS2 */ +#ifdef BUILD_AUDACIOUS END OBJ(audacious_status, &update_audacious) obj->callbacks.print = &print_audacious_status; 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) scan_bar(obj, arg, 1); obj->callbacks.barval = &audacious_barval; -#endif /* AUDACIOUS */ -#ifdef BMPX +#endif /* BUILD_AUDACIOUS */ +#ifdef BUIL_BMPX END OBJ(bmpx_title, &update_bmpx) obj->callbacks.print = &print_bmpx_title; 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; END OBJ(bmpx_bitrate, &update_bmpx) obj->callbacks.print = &print_bmpx_bitrate; -#endif -#ifdef EVE +#endif /* BUILD_BMPX */ +#ifdef BUILD_EVE END OBJ_ARG(eve, 0, "eve needs arguments: ") scan_eve(obj, arg); obj->callbacks.print = &print_eve; obj->callbacks.free = &free_eve; -#endif -#ifdef HAVE_CURL +#endif /* BUILD_EVE */ +#ifdef BUILD_CURL END OBJ_ARG(curl, 0, "curl needs arguments: ") curl_parse_arg(obj, arg); obj->callbacks.print = &curl_print; obj->callbacks.free = &curl_obj_free; -#endif -#ifdef RSS +#endif /* BUILD_CURL */ +#ifdef BUILD_RSS END OBJ_ARG(rss, 0, "rss needs arguments: [act_par] [spaces in front]") rss_scan_arg(obj, arg); obj->callbacks.print = &rss_print_info; obj->callbacks.free = &rss_free_obj_info; -#endif -#ifdef WEATHER +#endif /* BUILD_RSS */ +#ifdef BUILD_WEATHER_METAR END OBJ_ARG(weather, 0, "weather needs arguments: [interval in minutes]") scan_weather_arg(obj, arg, free_at_crash); obj->callbacks.print = &print_weather; obj->callbacks.free = &free_weather; -#endif -#ifdef XOAP +#endif /* BUILD_WEATHER_METAR */ +#ifdef BUILD_WEATHER_XOAP END OBJ_ARG(weather_forecast, 0, "weather_forecast needs arguments: [interval in minutes]") scan_weather_forecast_arg(obj, arg, free_at_crash); obj->callbacks.print = &print_weather_forecast; obj->callbacks.free = &free_weather; -#endif -#ifdef HAVE_LUA +#endif /* BUILD_WEATHER_XOAP */ +#ifdef BUILD_LUA END OBJ_ARG(lua, 0, "lua needs arguments: [function parameters]") obj->data.s = strndup(arg, text_buffer_size); 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.free = &gen_free_opaque; -#ifdef X11 +#ifdef BUILD_X11 END OBJ_ARG(lua_graph, 0, "lua_graph needs arguments: [height],[width] [gradient colour 1] [gradient colour 2] [scale] [-t] [-l]") char *buf = 0; 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.free = &gen_free_opaque; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ_ARG(lua_gauge, 0, "lua_gauge needs arguments: , [function parameters]") arg = scan_gauge(obj, arg, 100); 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.free = &gen_free_opaque; -#endif /* HAVE_LUA */ -#ifdef HDDTEMP +#endif /* BUILD_LUA */ +#ifdef BUILD_HDDTEMP END OBJ(hddtemp, &update_hddtemp) if (arg) obj->data.s = strndup(arg, text_buffer_size); obj->callbacks.print = &print_hddtemp; obj->callbacks.free = &free_hddtemp; -#endif /* HDDTEMP */ -#ifdef TCP_PORT_MONITOR +#endif /* BUILD_HDDTEMP */ +#ifdef BUILD_PORT_MONITORS END OBJ_ARG(tcp_portmon, &tcp_portmon_update, "tcp_portmon: needs arguments") tcp_portmon_init(obj, arg); obj->callbacks.print = &tcp_portmon_action; obj->callbacks.free = &tcp_portmon_free; -#endif /* TCP_PORT_MONITOR */ +#endif /* BUILD_PORT_MONITORS */ END OBJ(entropy_avail, &update_entropy) obj->callbacks.print = &print_entropy_avail; 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); obj->callbacks.print = &print_to_bytes; END OBJ(scroll, 0) -#ifdef X11 +#ifdef BUILD_X11 /* allocate a follower to reset any color changes */ obj->next = new_text_object_internal(); -#endif /* X11 */ +#endif /* BUILD_X11 */ parse_scroll_arg(obj, arg, free_at_crash); obj->callbacks.print = &print_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); obj->callbacks.print = &print_combine; obj->callbacks.free = &free_combine; -#ifdef NVIDIA +#ifdef BUILD_NVIDIA END OBJ_ARG(nvidia, 0, "nvidia needs an argument") if (set_nvidia_type(obj, arg)) { 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.free = &free_nvidia; -#endif /* NVIDIA */ -#ifdef APCUPSD +#endif /* BUILD_NVIDIA */ +#ifdef BUILD_APCUPSD END OBJ_ARG(apcupsd, &update_apcupsd, "apcupsd needs arguments: ") if (apcupsd_scan_arg(arg)) { CRIT_ERR(obj, free_at_crash, "apcupsd needs arguments: "); @@ -1570,13 +1570,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long END OBJ(apcupsd_loadbar, &update_apcupsd) scan_bar(obj, arg, 100); obj->callbacks.barval = &apcupsd_loadbarval; -#ifdef X11 +#ifdef BUILD_X11 END OBJ(apcupsd_loadgraph, &update_apcupsd) char* buf = 0; buf = scan_graph(obj, arg, 100); if (buf) free(buf); obj->callbacks.graphval = &apcupsd_loadbarval; -#endif /* X11 */ +#endif /* BUILD_X11 */ END OBJ(apcupsd_loadgauge, &update_apcupsd) scan_gauge(obj, arg, 100); 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; END OBJ(apcupsd_lastxfer, &update_apcupsd) obj->callbacks.print = &print_apcupsd_lastxfer; -#endif /* APCUPSD */ +#endif /* BUILD_APCUPSD */ END { char *buf = (char *)malloc(text_buffer_size); diff --git a/src/diskio.cc b/src/diskio.cc index fba71380..c973ac91 100644 --- a/src/diskio.cc +++ b/src/diskio.cc @@ -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); } -#ifdef X11 +#ifdef BUILD_X11 void parse_diskiograph_arg(struct text_object *obj, const char *arg) { char *buf = 0; @@ -174,7 +174,7 @@ double diskiographval_write(struct text_object *obj) return (diskio ? diskio->current_write : 0); } -#endif /* X11 */ +#endif /* BUILD_X11 */ void update_diskio_values(struct diskio_stat *ds, unsigned int reads, unsigned int writes) diff --git a/src/diskio.h b/src/diskio.h index 21d20bab..fda5a2c5 100644 --- a/src/diskio.h +++ b/src/diskio.h @@ -70,11 +70,11 @@ void parse_diskio_arg(struct text_object *, const char *); void print_diskio(struct text_object *, char *, int); void print_diskio_read(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 *); double diskiographval(struct text_object *); double diskiographval_read(struct text_object *); double diskiographval_write(struct text_object *); -#endif /* X11 */ +#endif /* BUILD_X11 */ #endif /* DISKIO_H_ */ diff --git a/src/eve.h b/src/eve.h index 3250e4ff..890a3447 100644 --- a/src/eve.h +++ b/src/eve.h @@ -28,6 +28,10 @@ extern "C" { #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 print_eve(struct text_object *, char *, int); void free_eve(struct text_object *); diff --git a/src/exec.cc b/src/exec.cc index ad7f79de..8ae7e1e5 100644 --- a/src/exec.cc +++ b/src/exec.cc @@ -270,7 +270,7 @@ void scan_execi_gauge_arg(struct text_object *obj, const char *arg) scan_execi_arg(obj, arg); } -#ifdef X11 +#ifdef BUILD_X11 void scan_execgraph_arg(struct text_object *obj, const char *arg) { struct execi_data *ed; @@ -287,7 +287,7 @@ void scan_execgraph_arg(struct text_object *obj, const char *arg) ed->cmd = buf; obj->data.opaque = ed; } -#endif /* X11 */ +#endif /* BUILD_X11 */ void print_exec(struct text_object *obj, char *p, int p_max_size) { diff --git a/src/fonts.c b/src/fonts.c index c2b3dd02..e2d1ff4d 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -38,9 +38,9 @@ char fontloaded = 0; void set_font(void) { -#ifdef XFT +#ifdef BUILD_XFT if (use_xft) return; -#endif /* XFT */ +#endif /* BUILD_XFT */ if (font_count > -1 && fonts[selected_font].font) { XSetFont(display, window.gc, fonts[selected_font].font->fid); } @@ -51,7 +51,7 @@ void setup_fonts(void) if ((output_methods & TO_X) == 0) { return; } -#ifdef XFT +#ifdef BUILD_XFT if (use_xft) { if (window.xftdraw) { XftDrawDestroy(window.xftdraw); @@ -60,7 +60,7 @@ void setup_fonts(void) window.xftdraw = XftDrawCreate(display, window.drawable, window.visual, window.colourmap); } -#endif /* XFT */ +#endif /* BUILD_XFT */ set_font(); } @@ -91,7 +91,7 @@ int add_font(const char *data_in) // must account for null terminator if (strlen(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; #endif } else { @@ -115,7 +115,7 @@ void set_first_font(const char *data_in) } if (strlen(data_in) > 1) { strncpy(fonts[0].name, data_in, DEFAULT_TEXT_BUFFER_SIZE); -#ifdef XFT +#ifdef BUILD_XFT fonts[0].font_alpha = 0xffff; #endif } @@ -129,7 +129,7 @@ void free_fonts(void) return; } for (i = 0; i <= font_count; i++) { -#ifdef XFT +#ifdef BUILD_XFT if (use_xft) { /* * 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; } else -#endif /* XFT */ +#endif /* BUILD_XFT */ { XFreeFont(display, fonts[i].font); fonts[i].font = 0; @@ -152,12 +152,12 @@ void free_fonts(void) } font_count = -1; selected_font = 0; -#ifdef XFT +#ifdef BUILD_XFT if (window.xftdraw) { XftDrawDestroy(window.xftdraw); window.xftdraw = 0; } -#endif /* XFT */ +#endif /* BUILD_XFT */ } void load_fonts(void) @@ -167,7 +167,7 @@ void load_fonts(void) if ((output_methods & TO_X) == 0) return; for (i = 0; i <= font_count; i++) { -#ifdef XFT +#ifdef BUILD_XFT /* load Xft font */ if (use_xft && fonts[i].xftfont) { continue; diff --git a/src/fonts.h b/src/fonts.h index fda053af..116664c4 100644 --- a/src/fonts.h +++ b/src/fonts.h @@ -26,7 +26,7 @@ * along with this program. If not, see . * */ -#ifdef X11 +#ifdef BUILD_X11 #ifndef _FONTS_H #define _FONTS_H @@ -43,13 +43,13 @@ struct font_list { int num; XFontStruct *font; -#ifdef XFT +#ifdef BUILD_XFT XftFont *xftfont; int font_alpha; #endif }; -#ifdef XFT +#ifdef BUILD_XFT #define font_height() (use_xft ? (fonts[selected_font].xftfont->ascent + \ fonts[selected_font].xftfont->descent) \ @@ -88,4 +88,4 @@ void load_fonts(void); #endif #endif /* _FONTS_H */ -#endif /* X11 */ +#endif /* BUILD_X11 */ diff --git a/src/libtcp-portmon.h b/src/libtcp-portmon.h index 3f66b618..f9f2611b 100644 --- a/src/libtcp-portmon.h +++ b/src/libtcp-portmon.h @@ -34,7 +34,7 @@ /* connection deleted if unseen again after this # of refreshes */ #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 /* ------------------------------------------------------------------- diff --git a/src/llua.cc b/src/llua.cc index d11caee5..db8c1bfe 100644 --- a/src/llua.cc +++ b/src/llua.cc @@ -129,13 +129,13 @@ void llua_init(void) lua_pushcfunction(lua_L, &llua_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 */ tolua_open(lua_L); tolua_usertype(lua_L, "Drawable"); tolua_usertype(lua_L, "Visual"); tolua_usertype(lua_L, "Display"); -#endif /* X11 */ +#endif /* BUILD_X11 */ } void llua_load(const char *script) @@ -432,7 +432,7 @@ void llua_shutdown_hook(void) llua_do_call(shutdown_hook, 0); } -#ifdef X11 +#ifdef BUILD_X11 void llua_draw_pre_hook(void) { 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"); } -#endif /* X11 */ +#endif /* BUILD_X11 */ void llua_setup_info(struct information *i, double u_interval) { diff --git a/src/llua.h b/src/llua.h index a829ce79..c1537244 100644 --- a/src/llua.h +++ b/src/llua.h @@ -32,9 +32,9 @@ extern "C" { #include -#ifdef X11 +#ifdef BUILD_X11 #include "x11.h" -#endif /* X11 */ +#endif /* BUILD_X11 */ #define LUAPREFIX "conky_" @@ -53,7 +53,7 @@ void llua_set_shutdown_hook(const char *args); void llua_startup_hook(void); void llua_shutdown_hook(void); -#ifdef X11 +#ifdef BUILD_X11 void llua_draw_pre_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_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_update_info(struct information *i, double u_interval); diff --git a/src/mpd.cc b/src/mpd.cc index 6de0c4d8..dc405fae 100644 --- a/src/mpd.cc +++ b/src/mpd.cc @@ -1,5 +1,5 @@ -/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- - * vim: ts=4 sw=4 noet ai cindent syntax=c +/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- + * vim: ts=4 sw=4 noet ai cindent syntax=cpp * * Conky, a system monitor, based on torsmo * diff --git a/src/net_stat.cc b/src/net_stat.cc index 61959d2b..e9b75194 100644 --- a/src/net_stat.cc +++ b/src/net_stat.cc @@ -191,7 +191,7 @@ void print_addrs(struct text_object *obj, char *p, int p_max_size) } #endif /* __linux__ */ -#ifdef X11 +#ifdef BUILD_X11 void parse_net_stat_graph_arg(struct text_object *obj, const char *arg, void *free_at_crash) { char *buf = 0; @@ -219,7 +219,7 @@ double upspeedgraphval(struct text_object *obj) return (ns ? (ns->trans_speed / 1024.0) : 0); } -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef __linux__ #ifdef HAVE_IWLIB diff --git a/src/net_stat.h b/src/net_stat.h index b5502bb1..925ebb7a 100644 --- a/src/net_stat.h +++ b/src/net_stat.h @@ -69,11 +69,11 @@ void print_addr(struct text_object *, char *, int); #ifdef __linux__ void print_addrs(struct text_object *, char *, int); #endif /* __linux__ */ -#ifdef X11 +#ifdef BUILD_X11 void parse_net_stat_graph_arg(struct text_object *, const char *, void *); double downspeedgraphval(struct text_object *); double upspeedgraphval(struct text_object *); -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef __linux__ #ifdef HAVE_IWLIB void print_wireless_essid(struct text_object *, char *, int); diff --git a/src/scroll.cc b/src/scroll.cc index 34eb95c3..43a0203e 100644 --- a/src/scroll.cc +++ b/src/scroll.cc @@ -79,11 +79,11 @@ void parse_scroll_arg(struct text_object *obj, const char *arg, void *free_at_cr obj->data.opaque = sd; -#ifdef X11 +#ifdef BUILD_X11 /* add a color object right after scroll to reset any color changes */ obj->next->data.l = sd->resetcolor; obj->next->callbacks.print = &new_fg; -#endif /* X11 */ +#endif /* BUILD_X11 */ } void print_scroll(struct text_object *obj, char *p, int p_max_size) diff --git a/src/specials.cc b/src/specials.cc index 850304fb..d2cb5e61 100644 --- a/src/specials.cc +++ b/src/specials.cc @@ -29,9 +29,9 @@ */ #include "conky.h" #include "colours.h" -#ifdef X11 +#ifdef BUILD_X11 #include "fonts.h" -#endif /* X11 */ +#endif /* BUILD_X11 */ #include "logging.h" #include "specials.h" #include @@ -49,9 +49,9 @@ struct special_t *specials = NULL; int special_count; int default_bar_width = 0, default_bar_height = 6; -#ifdef X11 +#ifdef BUILD_X11 int default_graph_width = 0, default_graph_height = 25; -#endif /* X11 */ +#endif /* BUILD_X11 */ int default_gauge_width = 40, default_gauge_height = 25; /* special data types flags */ @@ -156,7 +156,7 @@ const char *scan_bar(struct text_object *obj, const char *args, double scale) return args; } -#ifdef X11 +#ifdef BUILD_X11 void scan_font(struct text_object *obj, const char *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); } } -#endif /* X11 */ +#endif /* BUILD_X11 */ /* * 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)]); } -#ifdef X11 +#ifdef BUILD_X11 void new_gauge_in_x11(struct text_object *obj, char *buf, double usage) { 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->scale = g->scale; } -#endif /* X11 */ +#endif /* BUILD_X11 */ 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 usage = MIN(g->scale, usage); -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) new_gauge_in_x11(obj, p, usage); else -#endif /* X11 */ +#endif /* BUILD_X11 */ 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) { 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->arg = sh->arg; } -#endif /* X11 */ +#endif /* BUILD_X11 */ void new_fg(struct text_object *obj, char *p, int p_max_size) { -#ifdef X11 +#ifdef BUILD_X11 if (output_methods & TO_X) new_special(p, FG)->arg = obj->data.l; -#endif /* X11 */ +#endif /* BUILD_X11 */ #ifdef NCURSES if (output_methods & TO_NCURSES) 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); } -#ifdef X11 +#ifdef BUILD_X11 void new_bg(struct text_object *obj, char *p, int p_max_size) { 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; } -#endif /* X11 */ +#endif /* BUILD_X11 */ 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; } -#ifdef X11 +#ifdef BUILD_X11 static void new_bar_in_x11(struct text_object *obj, char *buf, double usage) { 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->scale = b->scale; } -#endif /* X11 */ +#endif /* BUILD_X11 */ /* usage is in range [0,255] */ 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 usage = MIN(b->scale, usage); -#ifdef X11 +#ifdef BUILD_X11 if ((output_methods & TO_X)) new_bar_in_x11(obj, p, usage); else -#endif /* X11 */ +#endif /* BUILD_X11 */ new_bar_in_shell(obj, p, p_max_size, usage); } diff --git a/src/specials.h b/src/specials.h index b5f384f1..8da85447 100644 --- a/src/specials.h +++ b/src/specials.h @@ -80,12 +80,12 @@ extern int special_count; extern int default_bar_width; extern int default_bar_height; -#ifdef X11 +#ifdef BUILD_X11 extern int default_graph_width; extern int default_graph_height; extern int default_gauge_width; extern int default_gauge_height; -#endif +#endif /* BUILD_X11 */ /* forward declare to avoid mutual inclusion between specials.h and text_object.h */ struct text_object; @@ -96,7 +96,7 @@ extern int max_specials; /* scanning special arguments */ const char *scan_bar(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 *); char *scan_graph(struct text_object *, const char *, double); 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_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_bar(struct text_object *, char *, int, double); void new_fg(struct text_object *, char *, int); diff --git a/src/weather.cc b/src/weather.cc index 5802011d..cc6c2303 100644 --- a/src/weather.cc +++ b/src/weather.cc @@ -36,18 +36,18 @@ #ifdef MATH #include #endif /* MATH */ -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP #include #include -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ /* WEATHER data */ typedef struct PWEATHER_ { char lastupd[32]; -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP char xoap_t[32]; char icon[3]; -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ int temp; int dew; int cc; @@ -58,7 +58,7 @@ typedef struct PWEATHER_ { int wc; } PWEATHER; -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP #define FORECAST_DAYS 5 typedef struct PWEATHER_FORECAST_ { int hi[FORECAST_DAYS]; @@ -73,7 +73,7 @@ typedef struct PWEATHER_FORECAST_ { int ppcp[FORECAST_DAYS]; } PWEATHER_FORECAST; -/* Xpath expressions for XOAP xml parsing */ +/* Xpath expressions for BUILD_WEATHER_XOAP xml parsing */ #define NUM_XPATH_EXPRESSIONS_CC 8 const char *xpath_expression_cc[NUM_XPATH_EXPRESSIONS_CC] = { "/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[*]/@t", "/weather/dayf/day[*]/@dt" }; -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ /* Possible sky conditions */ #define NUM_CC_CODES 6 @@ -113,7 +113,7 @@ const char *WC_CODES[NUM_WC_CODES] = { }; static ccurl_location_list locations_cc; -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP static ccurl_location_list locations_df; #endif @@ -123,7 +123,7 @@ struct weather_data { int interval; }; -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP struct weather_forecast_data { char uri[128]; unsigned int day; @@ -135,7 +135,7 @@ struct weather_forecast_data { void weather_free_info(void) { ccurl_free_locations(locations_cc); -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP ccurl_free_locations(locations_df); #endif } @@ -152,7 +152,7 @@ int rel_humidity(int dew_point, int air) { #endif /* MATH */ } -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP static void parse_df(PWEATHER_FORECAST *res, xmlXPathContextPtr xpathCtx) { int i, j, k; @@ -321,7 +321,7 @@ static void parse_weather_xml(PWEATHER *res, const char *data) xmlFreeDoc(doc); return; } -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ /* * 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) { 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); } } -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ void parse_weather(void *result, const char *data) { @@ -633,12 +633,12 @@ void parse_weather(void *result, const char *data) /* Reset results */ memset(res, 0, sizeof(PWEATHER)); -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP //Check if it is an xml file if ( strncmp(data, "temp, TEMP_CELSIUS); } else if (strcmp(data_type, "cloud_cover") == EQUAL) { -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP if (data->xoap_t[0] != '\0') { char *s = p; 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++; } } else -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ if (data->cc == 0) { strncpy(p, "", p_max_size); } 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 { strncpy(p, "cumulonimbus", p_max_size); } -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP } else if (strcmp(data_type, "icon") == EQUAL) { strncpy(p, data->icon, p_max_size); -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ } else if (strcmp(data_type, "pressure") == EQUAL) { snprintf(p, p_max_size, "%d", data->bar); } 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 */ static char *xoap_cc = 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) { @@ -845,7 +845,7 @@ static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR) } /* Construct complete uri */ -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP if (strstr(uri, "xoap.weather.com")) { if ((dayf == 0) && (xoap_cc != NULL)) { strcat(uri, locID); @@ -858,7 +858,7 @@ static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR) uri = NULL; } } else -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ if (strstr(uri, "weather.noaa.gov")) { strcat(uri, locID); strcat(uri, ".TXT"); @@ -868,7 +868,7 @@ static int process_weather_uri(char *uri, char *locID, int dayf UNUSED_ATTR) return 0; } -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP /* * 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); } -#endif /* XOAP */ +#endif /* BUILD_WEATHER_XOAP */ void scan_weather_arg(struct text_object *obj, const char *arg, void *free_at_crash) { diff --git a/src/weather.h b/src/weather.h index 094b173a..5fddda7b 100644 --- a/src/weather.h +++ b/src/weather.h @@ -37,11 +37,11 @@ extern "C" { /* Prototypes */ void weather_free_info(void); -#ifdef XOAP +#ifdef BUILD_WEATHER_XOAP void load_xoap_keys(void); void scan_weather_forecast_arg(struct text_object *, const char *, void *); 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 print_weather(struct text_object *, char *, int); diff --git a/src/x11.cc b/src/x11.cc index 2b781b08..4e0ddb15 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -42,20 +42,20 @@ #include "imlib2.h" #endif /* IMLIB2 */ -#ifdef XFT +#ifdef BUILD_XFT #include int use_xft = 0; #endif -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE int use_xdbe; #endif -#ifdef USE_ARGB +#ifdef BUILD_ARGB int use_argb_visual; int own_window_argb_value; int have_argb_visual; -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ /* some basic X11 stuff */ Display *display = NULL; @@ -184,7 +184,7 @@ void set_transparent_background(Window win, int alpha) { (void)alpha; /* disable warnings when unused */ -#ifdef USE_ARGB +#ifdef BUILD_ARGB if (have_argb_visual) { // real transparency if (set_transparent) { @@ -195,7 +195,7 @@ void set_transparent_background(Window win, int alpha) colour_set = background_colour; } } else { -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ // pseudo transparency if (set_transparent) { @@ -215,12 +215,12 @@ void set_transparent_background(Window win, int alpha) XSetWindowBackground(display, win, 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) { /* code from gtk project, gdk_screen_get_rgba_visual */ XVisualInfo visual_template; @@ -247,15 +247,15 @@ static int get_argb_visual(Visual** visual, int *depth) { XFree(visual_list); return 0; } -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ void destroy_window(void) { -#ifdef XFT +#ifdef BUILD_XFT if(window.xftdraw) { XftDrawDestroy(window.xftdraw); } -#endif +#endif /* BUILD_XFT */ if(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; } -#ifdef USE_ARGB +#ifdef BUILD_ARGB if (use_argb_visual && get_argb_visual(&visual, &depth)) { have_argb_visual = 1; window.visual = visual; window.colourmap = XCreateColormap(display, DefaultRootWindow(display), window.visual, AllocNone); } else { -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ window.visual = DefaultVisual(display, screen); window.colourmap = DefaultColormap(display, screen); depth = CopyFromParent; visual = CopyFromParent; -#ifdef USE_ARGB +#ifdef BUILD_ARGB } -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ 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, Always, 0L, 0L, False, StructureNotifyMask | ExposureMask, 0L, True, 0, 0 }; -#ifdef USE_ARGB +#ifdef BUILD_ARGB if (have_argb_visual) { attrs.colormap = window.colourmap; flags = CWBorderPixel | CWColormap | CWOverrideRedirect; } else { -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ 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) */ 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; Atom xa; -#ifdef USE_ARGB +#ifdef BUILD_ARGB if (have_argb_visual) { attrs.colormap = window.colourmap; flags = CWBorderPixel | CWColormap | CWOverrideRedirect; } else { -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ flags = CWBackPixel | CWOverrideRedirect; -#ifdef USE_ARGB +#ifdef BUILD_ARGB } -#endif /* USE_ARGB */ +#endif /* BUILD_ARGB */ if (window.type == TYPE_DOCK) { 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. */ window.drawable = window.window; -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE if (use_xdbe) { int major, minor; @@ -909,7 +909,7 @@ void set_struts(int sidenum) } #endif /* OWN_WINDOW */ -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE void xdbe_swap_buffers(void) { if (use_xdbe) { @@ -920,5 +920,5 @@ void xdbe_swap_buffers(void) XdbeSwapBuffers(display, &swap, 1); } } -#endif /* HAVE_XDBE */ +#endif /* BUILD_XDBE */ diff --git a/src/x11.h b/src/x11.h index 78630081..e92fecc6 100644 --- a/src/x11.h +++ b/src/x11.h @@ -1,6 +1,6 @@ /* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- */ -#ifdef X11 +#ifdef BUILD_X11 #ifndef X11_H_ #define X11_H_ @@ -8,11 +8,11 @@ #include #include -#ifdef XFT +#ifdef BUILD_XFT #include #endif -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE #include #endif @@ -48,10 +48,10 @@ struct conky_window { GC gc; long border_inner_margin, border_outer_margin, border_width; -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE XdbeBackBuffer back_buffer; #endif -#ifdef XFT +#ifdef BUILD_XFT XftDraw *xftdraw; #endif @@ -67,15 +67,15 @@ struct conky_window { #endif }; -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE extern int use_xdbe; #endif -#ifdef XFT +#ifdef BUILD_XFT extern int use_xft; #endif -#if defined(USE_ARGB) && defined(OWN_WINDOW) +#if defined(BUILD_ARGB) && defined(OWN_WINDOW) /* 1 if config var set to 1, otherwise 0 */ extern int use_argb_visual; /* 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 free_desktop_info(void); -#ifdef HAVE_XDBE +#ifdef BUILD_XDBE void xdbe_swap_buffers(void); -#endif /* HAVE_XDBE */ +#endif /* BUILD_XDBE */ #endif /*X11_H_*/ -#endif /* X11 */ +#endif /* BUILD_X11 */