mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-26 04:17:33 +00:00
Workaround for bug SF id 2819128 ($color inside $scroll disabled)
This commit is contained in:
parent
1f1b846a2d
commit
d0edfa7004
@ -6,8 +6,6 @@
|
|||||||
* Added support for X alignment across multi-lined objects (i.e., using
|
* Added support for X alignment across multi-lined objects (i.e., using
|
||||||
$alignr with $exec)
|
$alignr with $exec)
|
||||||
* Disabled OpenMP code until GCC's implementation stabilizes
|
* Disabled OpenMP code until GCC's implementation stabilizes
|
||||||
|
|
||||||
2009-07-18
|
|
||||||
* www.weather.com can now be used as well as a source of weather data
|
* www.weather.com can now be used as well as a source of weather data
|
||||||
|
|
||||||
2009-07-11
|
2009-07-11
|
||||||
|
@ -2583,12 +2583,11 @@
|
|||||||
may also contain variables. 'step' is optional and defaults
|
may also contain variables. 'step' is optional and defaults
|
||||||
to 1 if not set. If a var creates output on multiple lines
|
to 1 if not set. If a var creates output on multiple lines
|
||||||
then the lines are placed behind each other separated with
|
then the lines are placed behind each other separated with
|
||||||
a '|'-sign. Do NOT use vars that change colors or otherwise
|
a '|'-sign. The effect of $color is disabled inside scroll.
|
||||||
affect the design inside a scrolling text. If you want
|
If you want spaces between the start and the end of 'text',
|
||||||
spaces between the start and the end of 'text', place them
|
place them at the end of 'text' not at the front ("4 foobar"
|
||||||
at the end of 'text' not at the front ("foobar" and "
|
can generate "arfo" but "4 foobar " will keep the space like
|
||||||
foobar" can both generate "barfoo" but "foobar " will keep
|
this "ar f").
|
||||||
the spaces like this "bar foo").
|
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
34
src/conky.c
34
src/conky.c
@ -1238,6 +1238,8 @@ static int parse_top_args(const char *s, const char *arg, struct text_object *ob
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long current_text_color;
|
||||||
|
|
||||||
/* construct_text_object() creates a new text_object */
|
/* construct_text_object() creates a new text_object */
|
||||||
static struct text_object *construct_text_object(const char *s,
|
static struct text_object *construct_text_object(const char *s,
|
||||||
const char *arg, long line, char allow_threaded, void **ifblock_opaque, void *free_at_crash)
|
const char *arg, long line, char allow_threaded, void **ifblock_opaque, void *free_at_crash)
|
||||||
@ -1650,28 +1652,39 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
#ifdef X11
|
#ifdef X11
|
||||||
if (output_methods & TO_X) {
|
if (output_methods & TO_X) {
|
||||||
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
|
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
END OBJ(color0, 0)
|
END OBJ(color0, 0)
|
||||||
obj->data.l = color0;
|
obj->data.l = color0;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color1, 0)
|
END OBJ(color1, 0)
|
||||||
obj->data.l = color1;
|
obj->data.l = color1;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color2, 0)
|
END OBJ(color2, 0)
|
||||||
obj->data.l = color2;
|
obj->data.l = color2;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color3, 0)
|
END OBJ(color3, 0)
|
||||||
obj->data.l = color3;
|
obj->data.l = color3;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color4, 0)
|
END OBJ(color4, 0)
|
||||||
obj->data.l = color4;
|
obj->data.l = color4;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color5, 0)
|
END OBJ(color5, 0)
|
||||||
obj->data.l = color5;
|
obj->data.l = color5;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color6, 0)
|
END OBJ(color6, 0)
|
||||||
obj->data.l = color6;
|
obj->data.l = color6;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color7, 0)
|
END OBJ(color7, 0)
|
||||||
obj->data.l = color7;
|
obj->data.l = color7;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color8, 0)
|
END OBJ(color8, 0)
|
||||||
obj->data.l = color8;
|
obj->data.l = color8;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
END OBJ(color9, 0)
|
END OBJ(color9, 0)
|
||||||
obj->data.l = color9;
|
obj->data.l = color9;
|
||||||
|
current_text_color = obj->data.l;
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
END OBJ(font, 0)
|
END OBJ(font, 0)
|
||||||
obj->data.s = scan_font(arg);
|
obj->data.s = scan_font(arg);
|
||||||
@ -2967,6 +2980,7 @@ static struct text_object *construct_text_object(const char *s,
|
|||||||
END OBJ(scroll, 0)
|
END OBJ(scroll, 0)
|
||||||
int n1 = 0, n2 = 0;
|
int n1 = 0, n2 = 0;
|
||||||
|
|
||||||
|
obj->data.scroll.resetcolor = current_text_color;
|
||||||
obj->data.scroll.step = 1;
|
obj->data.scroll.step = 1;
|
||||||
if (arg && sscanf(arg, "%u %n", &obj->data.scroll.show, &n1) > 0) {
|
if (arg && sscanf(arg, "%u %n", &obj->data.scroll.show, &n1) > 0) {
|
||||||
sscanf(arg + n1, "%u %n", &obj->data.scroll.step, &n2);
|
sscanf(arg + n1, "%u %n", &obj->data.scroll.step, &n2);
|
||||||
@ -5775,7 +5789,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
snprintf(p, p_max_size, "%s", buf);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
}
|
}
|
||||||
OBJ(scroll) {
|
OBJ(scroll) {
|
||||||
unsigned int j;
|
unsigned int j, k, colorchanges = 0;
|
||||||
char *tmp, buf[max_user_text];
|
char *tmp, buf[max_user_text];
|
||||||
generate_text_internal(buf, max_user_text,
|
generate_text_internal(buf, max_user_text,
|
||||||
*obj->sub, cur);
|
*obj->sub, cur);
|
||||||
@ -5784,11 +5798,16 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
snprintf(p, p_max_size, "%s", buf);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#define LINESEPARATOR '|'
|
|
||||||
//place all the lines behind each other with LINESEPARATOR between them
|
|
||||||
for(j = 0; buf[j] != 0; j++) {
|
for(j = 0; buf[j] != 0; j++) {
|
||||||
if(buf[j]=='\n') {
|
switch(buf[j]) {
|
||||||
|
case '\n': //place all the lines behind each other with LINESEPARATOR between them
|
||||||
|
#define LINESEPARATOR '|'
|
||||||
buf[j]=LINESEPARATOR;
|
buf[j]=LINESEPARATOR;
|
||||||
|
break;
|
||||||
|
case 1: //make sure $color isn't treated like a char
|
||||||
|
strfold(buf+j, 1);
|
||||||
|
colorchanges++;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//scroll the output obj->data.scroll.start places by copying that many chars from
|
//scroll the output obj->data.scroll.start places by copying that many chars from
|
||||||
@ -5803,7 +5822,10 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
//only show the requested number of chars
|
//only show the requested number of chars
|
||||||
if(obj->data.scroll.show < j) {
|
if(obj->data.scroll.show < j) {
|
||||||
buf[obj->data.scroll.show] = 0;
|
for(k = 0; k < colorchanges; k++) {
|
||||||
|
buf[obj->data.scroll.show + k] = 1;
|
||||||
|
}
|
||||||
|
buf[obj->data.scroll.show + colorchanges] = 0;
|
||||||
}
|
}
|
||||||
//next time, scroll a place more or reset scrolling if we are at the end
|
//next time, scroll a place more or reset scrolling if we are at the end
|
||||||
obj->data.scroll.start += obj->data.scroll.step;
|
obj->data.scroll.start += obj->data.scroll.step;
|
||||||
@ -5811,6 +5833,7 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
obj->data.scroll.start = 0;
|
obj->data.scroll.start = 0;
|
||||||
}
|
}
|
||||||
snprintf(p, p_max_size, "%s", buf);
|
snprintf(p, p_max_size, "%s", buf);
|
||||||
|
new_fg(p + strlen(p), obj->data.scroll.resetcolor);
|
||||||
}
|
}
|
||||||
OBJ(combine) {
|
OBJ(combine) {
|
||||||
char buf[2][max_user_text];
|
char buf[2][max_user_text];
|
||||||
@ -7688,6 +7711,7 @@ static void set_default_configurations_for_x(void)
|
|||||||
color7 = default_fg_color;
|
color7 = default_fg_color;
|
||||||
color8 = default_fg_color;
|
color8 = default_fg_color;
|
||||||
color9 = default_fg_color;
|
color9 = default_fg_color;
|
||||||
|
current_text_color = default_fg_color;
|
||||||
}
|
}
|
||||||
#endif /* X11 */
|
#endif /* X11 */
|
||||||
|
|
||||||
|
@ -561,6 +561,7 @@ struct text_object {
|
|||||||
unsigned int show;
|
unsigned int show;
|
||||||
unsigned int step;
|
unsigned int step;
|
||||||
unsigned int start;
|
unsigned int start;
|
||||||
|
long resetcolor;
|
||||||
} scroll;
|
} scroll;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user