From 94a854cfa2c2f5299eeda87803d64a108038d404 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sat, 22 Dec 2018 15:53:34 -0500 Subject: [PATCH] More build fixes. --- src/conky.cc | 12 ++++++++---- src/x11.cc | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/conky.cc b/src/conky.cc index 1674556b..4e058944 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -1253,13 +1253,18 @@ std::string string_replace_all(std::string original, const std::string &oldpart, } static void draw_string(const char *s) { - int i, i2, pos, width_of_s; + int i, i2, pos; +#ifdef BUILD_X11 + int width_of_s; +#endif /* BUILD_X11 */ int max = 0; int added; if (s[0] == '\0') { return; } +#ifdef BUILD_X11 width_of_s = get_string_width(s); +#endif /* BUILD_X11 */ if (out_to_stdout.get(*state) && draw_mode == FG) { printf("%s\n", s); if (extra_newline.get(*state)) { fputc('\n', stdout); } @@ -1864,13 +1869,12 @@ static void draw_text() { } static void draw_stuff() { -#ifndef BUILD_X11 - static int text_offset_x, text_offset_y; /* offset for start position */ -#endif +#ifdef BUILD_X11 text_offset_x = text_offset_y = 0; #ifdef BUILD_IMLIB2 cimlib_render(text_start_x, text_start_y, window.width, window.height); #endif /* BUILD_IMLIB2 */ +#endif /* BUILD_X11 */ if (static_cast(!overwrite_file.get(*state).empty()) != 0u) { overwrite_fpointer = fopen(overwrite_file.get(*state).c_str(), "we"); if (overwrite_fpointer == nullptr) { diff --git a/src/x11.cc b/src/x11.cc index 700c2a0a..04108f79 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -291,13 +291,15 @@ std::pair window_hints_traits::convert( } #endif +#ifdef OWN_WINDOW namespace { // used to set the default value for own_window_title -std::string gethostnamecxx() { +std::string ethostnamecxx() { update_uname(); return info.uname_s.nodename; } } // namespace +#endif /* OWN_WINDOW */ /* * The order of these settings cannot be completely arbitrary. Some of them @@ -356,8 +358,8 @@ conky::simple_config_setting use_argb_visual("own_window_argb_visual", false, false); conky::range_config_setting own_window_argb_value("own_window_argb_value", 0, 255, 255, false); -#endif -#endif /*OWN_WINDOW*/ +#endif /* BUILD_ARGB */ +#endif /* OWN_WINDOW */ priv::own_window_setting own_window; #ifdef BUILD_XDBE