mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-01-12 19:06:36 +00:00
use clang-format
This commit is contained in:
parent
02ec45dc03
commit
033508a93e
16
src/cmus.cc
16
src/cmus.cc
@ -99,12 +99,12 @@ void cmus_cb::work() {
|
||||
|
||||
} else if (strncmp(line, "position ", 9) == 0) {
|
||||
cmus.curtime = line + 9;
|
||||
cmus.timeleft =
|
||||
strtol(cmus.totaltime.c_str(), nullptr, 10) -
|
||||
strtol(cmus.curtime.c_str(), nullptr, 10);
|
||||
cmus.timeleft = strtol(cmus.totaltime.c_str(), nullptr, 10) -
|
||||
strtol(cmus.curtime.c_str(), nullptr, 10);
|
||||
if (cmus.curtime.size() > 0) {
|
||||
cmus.progress = static_cast<float>(strtol(cmus.curtime.c_str(), nullptr, 10)) /
|
||||
strtol(cmus.totaltime.c_str(), nullptr, 10);
|
||||
cmus.progress =
|
||||
static_cast<float>(strtol(cmus.curtime.c_str(), nullptr, 10)) /
|
||||
strtol(cmus.totaltime.c_str(), nullptr, 10);
|
||||
} else {
|
||||
cmus.progress = 0;
|
||||
}
|
||||
@ -189,7 +189,8 @@ void print_cmus_totaltime(struct text_object *obj, char *p,
|
||||
lround(music_player_interval.get(*state) / active_update_interval()), 1l);
|
||||
const cmus_result &cmus =
|
||||
conky::register_cb<cmus_cb>(period)->get_result_copy();
|
||||
format_seconds_short(p, p_max_size, strtol(cmus.totaltime.c_str(), nullptr, 10));
|
||||
format_seconds_short(p, p_max_size,
|
||||
strtol(cmus.totaltime.c_str(), nullptr, 10));
|
||||
}
|
||||
|
||||
void print_cmus_timeleft(struct text_object *obj, char *p,
|
||||
@ -209,7 +210,8 @@ void print_cmus_curtime(struct text_object *obj, char *p,
|
||||
lround(music_player_interval.get(*state) / active_update_interval()), 1l);
|
||||
const cmus_result &cmus =
|
||||
conky::register_cb<cmus_cb>(period)->get_result_copy();
|
||||
format_seconds_short(p, p_max_size, strtol(cmus.curtime.c_str(), nullptr, 10));
|
||||
format_seconds_short(p, p_max_size,
|
||||
strtol(cmus.curtime.c_str(), nullptr, 10));
|
||||
}
|
||||
|
||||
#undef CMUS_PRINT_GENERATOR
|
||||
|
@ -525,7 +525,8 @@ void print_cached(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
p_max_size);
|
||||
}
|
||||
|
||||
void print_free_bufcache(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
void print_free_bufcache(struct text_object *obj, char *p,
|
||||
unsigned int p_max_size) {
|
||||
human_readable(apply_base_multiplier(obj->data.s, info.free_bufcache), p,
|
||||
p_max_size);
|
||||
}
|
||||
|
@ -75,10 +75,13 @@ long cap_scaled_color(long colour) {
|
||||
}
|
||||
|
||||
void scaled_rgb_to_scaled_hcl(long *const rgb, long *hcl) {
|
||||
long value = rgb[0] > rgb[1] ? std::max(rgb[0], rgb[2]) : std::max(rgb[1], rgb[2]);
|
||||
long minimum = rgb[0] < rgb[1] ? std::min(rgb[0], rgb[2]) : std::min(rgb[1], rgb[2]);
|
||||
long value =
|
||||
rgb[0] > rgb[1] ? std::max(rgb[0], rgb[2]) : std::max(rgb[1], rgb[2]);
|
||||
long minimum =
|
||||
rgb[0] < rgb[1] ? std::min(rgb[0], rgb[2]) : std::min(rgb[1], rgb[2]);
|
||||
long chroma = value - minimum;
|
||||
long luma = (2627L * rgb[0] + 6780L * rgb[1] + 593L * rgb[2]) / 10000L; //Use Rec.2020 color space
|
||||
long luma = (2627L * rgb[0] + 6780L * rgb[1] + 593L * rgb[2]) /
|
||||
10000L; // Use Rec.2020 color space
|
||||
long hue;
|
||||
|
||||
if (chroma == 0) {
|
||||
@ -112,7 +115,8 @@ void scaled_hcl_to_scaled_rgb(long *const hcl, long *rgb) {
|
||||
long luma = hcl[2] / 360L;
|
||||
|
||||
long h = hue / 60L;
|
||||
long x = (chroma * (CONST_SCALE - std::abs(h % CONST_SCALE2 - CONST_SCALE))) / CONST_SCALE;
|
||||
long x = (chroma * (CONST_SCALE - std::abs(h % CONST_SCALE2 - CONST_SCALE))) /
|
||||
CONST_SCALE;
|
||||
long m;
|
||||
|
||||
// use Rec.2020 color space
|
||||
@ -153,7 +157,8 @@ void scaled_hcl_to_scaled_rgb(long *const hcl, long *rgb) {
|
||||
rgb[2] = cap_scaled_color(rgb[2]);
|
||||
}
|
||||
|
||||
void rgb_to_scaled_rgb(unsigned long colour, long *scaled, int redshift, int greenshift) {
|
||||
void rgb_to_scaled_rgb(unsigned long colour, long *scaled, int redshift,
|
||||
int greenshift) {
|
||||
long red = (colour & redmask) >> redshift;
|
||||
long green = (colour & greenmask) >> greenshift;
|
||||
long blue = colour & bluemask;
|
||||
@ -167,7 +172,8 @@ void rgb_to_scaled_rgb(unsigned long colour, long *scaled, int redshift, int gre
|
||||
scaled[2] = to_decimal_scale(blue, blue_max);
|
||||
}
|
||||
|
||||
unsigned long scaled_rgb_to_rgb(long *const scaled, int redshift, int greenshift) {
|
||||
unsigned long scaled_rgb_to_rgb(long *const scaled, int redshift,
|
||||
int greenshift) {
|
||||
long red_max = redmask >> redshift;
|
||||
long green_max = greenmask >> greenshift;
|
||||
|
||||
@ -200,9 +206,7 @@ std::unique_ptr<unsigned long[]> do_hcl_gradient(int width,
|
||||
|
||||
std::unique_ptr<unsigned long[]> colours(new unsigned long[width]);
|
||||
|
||||
if (colour_depth == 0) {
|
||||
set_up_gradient();
|
||||
}
|
||||
if (colour_depth == 0) { set_up_gradient(); }
|
||||
|
||||
rgb_to_scaled_rgb(first_colour, first_colour_rgb, redshift, greenshift);
|
||||
rgb_to_scaled_rgb(last_colour, last_colour_rgb, redshift, greenshift);
|
||||
@ -217,9 +221,9 @@ std::unique_ptr<unsigned long[]> do_hcl_gradient(int width,
|
||||
colours[width - 1] = last_colour;
|
||||
|
||||
long divisor = width - 1;
|
||||
long hueDelta = hueDiff/divisor;
|
||||
long chromaDelta = chromaDiff/divisor;
|
||||
long lumaDelta = lumaDiff/divisor;
|
||||
long hueDelta = hueDiff / divisor;
|
||||
long chromaDelta = chromaDiff / divisor;
|
||||
long lumaDelta = lumaDiff / divisor;
|
||||
|
||||
for (int i = 1; i < (width - 1); i++) {
|
||||
long h = first_colour_hcl[0] + hueDelta;
|
||||
|
@ -192,7 +192,7 @@ int update_meminfo(void) {
|
||||
info.memmax = info.memdirty = info.swap = info.swapfree = info.swapmax =
|
||||
info.memwithbuffers = info.buffers = info.cached = info.memfree =
|
||||
info.memeasyfree = info.legacymem = info.shmem = info.memavail =
|
||||
info.free_bufcache = 0;
|
||||
info.free_bufcache = 0;
|
||||
|
||||
if (!(meminfo_fp = open_file("/proc/meminfo", &reported))) { return 0; }
|
||||
|
||||
@ -1583,9 +1583,9 @@ char get_freq(char *p_client_buffer, size_t client_buffer_size,
|
||||
|
||||
#define CPUFREQ_GOVERNOR "cpufreq/scaling_governor"
|
||||
|
||||
/* print the CPU scaling governor */
|
||||
/* print the CPU scaling governor */
|
||||
void print_cpugovernor(struct text_object *obj, char *p,
|
||||
unsigned int p_max_size) {
|
||||
unsigned int p_max_size) {
|
||||
FILE *fp;
|
||||
char buf[64];
|
||||
unsigned int cpu = obj->data.i;
|
||||
|
@ -1032,8 +1032,7 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
||||
if (value != -1) {
|
||||
if (nvs->is_percentage) {
|
||||
percent_print(p, p_max_size, value);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
snprintf(p, p_max_size, "%d", value);
|
||||
}
|
||||
} else if (str != nullptr) {
|
||||
|
@ -419,7 +419,7 @@ void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||
if (out_to_stdout.get(*state)) {
|
||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||
}
|
||||
#else /* BUILD_GUI */
|
||||
#else /* BUILD_GUI */
|
||||
new_gauge_in_shell(obj, p, p_max_size, usage);
|
||||
#endif /* BUILD_GUI */
|
||||
}
|
||||
@ -728,7 +728,7 @@ void new_bar(struct text_object *obj, char *p, unsigned int p_max_size,
|
||||
if (out_to_stdout.get(*state)) {
|
||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||
}
|
||||
#else /* BUILD_GUI */
|
||||
#else /* BUILD_GUI */
|
||||
new_bar_in_shell(obj, p, p_max_size, usage);
|
||||
#endif /* BUILD_GUI */
|
||||
}
|
||||
|
27482
tests/catch2/catch.hpp
27482
tests/catch2/catch.hpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user