1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-06-10 11:12:21 +00:00

use clang-format

This commit is contained in:
Caio Freitas de Oliveira 2022-10-04 21:14:02 -03:00 committed by Brenden Matthews
parent 02ec45dc03
commit 033508a93e
7 changed files with 14158 additions and 13384 deletions

View File

@ -99,11 +99,11 @@ void cmus_cb::work() {
} else if (strncmp(line, "position ", 9) == 0) {
cmus.curtime = line + 9;
cmus.timeleft =
strtol(cmus.totaltime.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)) /
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

View File

@ -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);
}

View File

@ -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);

View File

@ -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) {

File diff suppressed because it is too large Load Diff