mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
add build option
This commit is contained in:
parent
d25e0a72f4
commit
56920fde12
@ -260,6 +260,8 @@ option(BUILD_JOURNAL "Enable support for reading from the systemd journal"
|
||||
option(BUILD_PULSEAUDIO
|
||||
"Enable support for Pulseaudio's default sink and source" false)
|
||||
|
||||
option(BUILD_HSV_GRADIENT "Enable gradient in HSV colour space" true)
|
||||
|
||||
message(STATUS "CMAKE_C_FLAGS: " ${CMAKE_C_FLAGS})
|
||||
message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
|
||||
|
||||
|
@ -127,6 +127,8 @@
|
||||
|
||||
#cmakedefine BUILD_JOURNAL 1
|
||||
|
||||
#cmakedefine BUILD_HSV_GRADIENT 1
|
||||
|
||||
#cmakedefine HAVE_STATFS64 1
|
||||
#ifndef HAVE_STATFS64
|
||||
#define statfs64 statfs
|
||||
|
@ -248,8 +248,7 @@ void scaled_hsv_to_scaled_rgb(long *const hsv, long *rgb) {
|
||||
}
|
||||
|
||||
/* this function returns the next colour between two colours in hsv space for a gradient */
|
||||
unsigned long *do_hsv_gradient(
|
||||
int width,
|
||||
unsigned long *do_hsv_gradient(int width,
|
||||
unsigned long first_colour,
|
||||
unsigned long last_colour) {
|
||||
|
||||
@ -276,6 +275,12 @@ unsigned long *do_hsv_gradient(
|
||||
scaled_rgb_to_scaled_hsv(rgb2, hsv2);
|
||||
|
||||
hueDiff = hsv2[0] - hsv1[0];
|
||||
// use shortest hue path
|
||||
if (hueDiff > CONST_SCALE180) {
|
||||
hueDiff = hueDiff - CONST_SCALE360;
|
||||
} else if (hueDiff < -CONST_SCALE180) {
|
||||
hueDiff = hueDiff + CONST_SCALE360;
|
||||
}
|
||||
satDiff = hsv2[1] - hsv1[1];
|
||||
valDiff = hsv2[2] - hsv1[2];
|
||||
|
||||
@ -288,7 +293,12 @@ unsigned long *do_hsv_gradient(
|
||||
long divisor = width - i;
|
||||
k = (hueDiff + divisor / 2) / divisor;
|
||||
hueDiff -= k;
|
||||
hsv1[0] += k;
|
||||
long h = hsv1[0] + k;
|
||||
if (h < 0) {
|
||||
hsv1[0] = CONST_SCALE360 + h;
|
||||
} else {
|
||||
hsv1[0] = h;
|
||||
}
|
||||
|
||||
k = (satDiff + divisor / 2) / divisor;
|
||||
satDiff -= k;
|
||||
|
@ -1451,8 +1451,13 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) {
|
||||
unsigned long *tmpcolour = nullptr;
|
||||
|
||||
if (current->last_colour != 0 || current->first_colour != 0) {
|
||||
#ifdef BUILD_HSV_GRADIENT
|
||||
tmpcolour = do_hsv_gradient(w - 1, current->last_colour,
|
||||
current->first_colour);
|
||||
#else
|
||||
tmpcolour = do_gradient(w - 1, current->last_colour,
|
||||
current->first_colour);
|
||||
#endif
|
||||
}
|
||||
colour_idx = 0;
|
||||
for (i = w - 2; i > -1; i--) {
|
||||
|
@ -181,6 +181,9 @@ static void print_version() {
|
||||
<< _(" * Own window\n")
|
||||
#endif
|
||||
#endif /* BUILD_X11 */
|
||||
#ifdef BUILD_HSV_GRADIENT
|
||||
<< _(" * HSV Gradient\n")
|
||||
#endif /* BUILD_HSV_GRADIENT */
|
||||
#if defined BUILD_AUDACIOUS || defined BUILD_CMUS || defined BUILD_MPD || \
|
||||
defined BUILD_MOC || defined BUILD_XMMS2
|
||||
<< _("\n Music detection:\n")
|
||||
|
Loading…
Reference in New Issue
Block a user