mirror of
https://github.com/polybar/polybar.git
synced 2026-03-01 05:19:54 +00:00
fix(cmake): Make specific c++lib linking optional
- Do not enforce linking against libc++ - Fix various linter warnings
This commit is contained in:
@ -460,4 +460,4 @@ class builder {
|
||||
int m_fontindex = 1;
|
||||
};
|
||||
|
||||
LEMONBUDDY_NS_END;
|
||||
LEMONBUDDY_NS_END
|
||||
|
||||
@ -33,11 +33,7 @@ namespace command_line {
|
||||
*/
|
||||
explicit option(
|
||||
string flag, string flag_long, string desc, string token = "", const choices c = {})
|
||||
: flag(flag)
|
||||
, flag_long(flag_long)
|
||||
, desc(desc)
|
||||
, token(token)
|
||||
, values(c) {}
|
||||
: flag(flag), flag_long(flag_long), desc(desc), token(token), values(c) {}
|
||||
};
|
||||
|
||||
// }}}
|
||||
@ -101,7 +97,7 @@ namespace command_line {
|
||||
}
|
||||
|
||||
for (auto& opt : m_opts) {
|
||||
int pad = maxlen - opt.flag_long.length() - opt.token.length();
|
||||
size_t pad = maxlen - opt.flag_long.length() - opt.token.length();
|
||||
|
||||
std::cout << " " << opt.flag << ", " << opt.flag_long;
|
||||
|
||||
|
||||
@ -563,7 +563,6 @@ namespace {
|
||||
di::injector<T> configure_controller(inotify_watch_t& confwatch) {
|
||||
// clang-format off
|
||||
return di::make_injector(
|
||||
di::bind<controller>().to<controller>(),
|
||||
di::bind<>().to(confwatch),
|
||||
configure_connection(),
|
||||
configure_logger(),
|
||||
|
||||
@ -128,14 +128,14 @@ class logger {
|
||||
template <typename T>
|
||||
decltype(auto) convert(T&& arg) const {
|
||||
return forward<T>(arg);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string to const char*
|
||||
*/
|
||||
const char* convert(string arg) const {
|
||||
return arg.c_str();
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the log message to the output channel
|
||||
@ -150,10 +150,14 @@ class logger {
|
||||
auto suffix = m_suffixes.find(level)->second;
|
||||
|
||||
// silence the compiler
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wformat-security"
|
||||
#endif
|
||||
dprintf(m_fd, (prefix + format + suffix + "\n").c_str(), convert(values)...);
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -56,7 +56,7 @@ struct bar_settings {
|
||||
};
|
||||
snprintf(buffer, sizeof(buffer), "%dx%d+%d+%d", width, height, x, y);
|
||||
return string{*buffer};
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
struct tray_settings {
|
||||
@ -105,7 +105,6 @@ struct action_block {
|
||||
#endif
|
||||
};
|
||||
|
||||
struct wmsettings_bspwm {
|
||||
};
|
||||
struct wmsettings_bspwm {};
|
||||
|
||||
LEMONBUDDY_NS_END
|
||||
|
||||
@ -7,21 +7,16 @@
|
||||
|
||||
LEMONBUDDY_NS
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
|
||||
|
||||
union rgba {
|
||||
struct {
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
} _;
|
||||
uint32_t v;
|
||||
};
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
static map<string, class color> g_colorstore;
|
||||
|
||||
class color {
|
||||
@ -29,9 +24,9 @@ class color {
|
||||
explicit color(string hex) : m_hex(string_util::upper(hex)) {
|
||||
m_rgba.v = static_cast<uint32_t>(strtoul(&hex[1], nullptr, 16));
|
||||
// premultiply alpha
|
||||
m_rgba.r = m_rgba.r * m_rgba.a / 255;
|
||||
m_rgba.g = m_rgba.g * m_rgba.a / 255;
|
||||
m_rgba.b = m_rgba.b * m_rgba.a / 255;
|
||||
m_rgba._.r = m_rgba._.r * m_rgba._.a / 255;
|
||||
m_rgba._.g = m_rgba._.g * m_rgba._.a / 255;
|
||||
m_rgba._.b = m_rgba._.b * m_rgba._.a / 255;
|
||||
}
|
||||
|
||||
explicit color(uint32_t v) {
|
||||
|
||||
@ -25,7 +25,7 @@ namespace draw_util {
|
||||
* Code: http://wmdia.sourceforge.net/
|
||||
*/
|
||||
auto xcb_poly_text_16_patched(xcb_connection_t* conn, xcb_drawable_t d, xcb_gcontext_t gc,
|
||||
int16_t x, int16_t y, uint32_t len, uint16_t* str) {
|
||||
int16_t x, int16_t y, uint8_t len, uint16_t* str) {
|
||||
static const xcb_protocol_request_t xcb_req = {
|
||||
5, // count
|
||||
0, // ext
|
||||
|
||||
@ -120,7 +120,7 @@ namespace inotify_util {
|
||||
inline auto make_watch(string path) {
|
||||
di::injector<inotify_watch_t> injector = di::make_injector(di::bind<>().to(path));
|
||||
return injector.create<inotify_watch_t>();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
LEMONBUDDY_NS_END
|
||||
|
||||
@ -35,7 +35,7 @@ namespace scope_util {
|
||||
template <typename Fn = function<void()>, typename... Args>
|
||||
decltype(auto) make_exit_handler(Fn&& fn, Args&&... args) {
|
||||
return make_unique<on_exit<Args...>>(forward<Fn>(fn), forward<Args>(args)...);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
LEMONBUDDY_NS_END
|
||||
|
||||
@ -59,7 +59,7 @@ namespace string_util {
|
||||
for (size_t i = 0; i < haystack.length(); i++) {
|
||||
if (haystack.compare(i, needle.length(), needle) == 0) {
|
||||
replaced += replacement;
|
||||
i += needle.length()-1;
|
||||
i += needle.length() - 1;
|
||||
} else {
|
||||
replaced += haystack[i];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user