mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-05 21:07:52 +00:00
small fixes, mostly to graph stuff
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@26 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
c090f68393
commit
093878ac03
21
conky.c
21
conky.c
@ -240,7 +240,7 @@ static struct special_t *new_special(char *buf, int t)
|
||||
buf[0] = SPECIAL_CHAR;
|
||||
buf[1] = '\0';
|
||||
if (t == GRAPH && specials[special_count].graph == NULL) {
|
||||
if (specials[special_count].height > 0)
|
||||
if (specials[special_count].height > 0 && specials[special_count].height < MAX_GRAPH_DEPTH)
|
||||
specials[special_count].graph_width = specials[special_count].height;
|
||||
else
|
||||
specials[special_count].graph_width = MAX_GRAPH_DEPTH;
|
||||
@ -2374,6 +2374,7 @@ static void text_size_updater(char *s)
|
||||
{
|
||||
int w = 0;
|
||||
char *p;
|
||||
int h = font_height();
|
||||
|
||||
/* get string widths and skip specials */
|
||||
p = s;
|
||||
@ -2385,6 +2386,9 @@ static void text_size_updater(char *s)
|
||||
|
||||
if (specials[special_index].type == BAR || specials[special_index].type == GRAPH) {
|
||||
w += specials[special_index].width;
|
||||
if ( specials[special_index].height > h ) {
|
||||
h = specials[special_index].height;
|
||||
}
|
||||
}
|
||||
|
||||
special_index++;
|
||||
@ -2394,11 +2398,10 @@ static void text_size_updater(char *s)
|
||||
}
|
||||
|
||||
w += get_string_width(s);
|
||||
|
||||
if (w > text_width)
|
||||
text_width = w;
|
||||
|
||||
text_height += font_height();
|
||||
text_height += h;
|
||||
}
|
||||
|
||||
static void update_text_area()
|
||||
@ -2559,6 +2562,7 @@ static void draw_string(const char *s)
|
||||
static void draw_line(char *s)
|
||||
{
|
||||
char *p;
|
||||
short font_h = font_height();
|
||||
|
||||
cur_x = text_start_x;
|
||||
cur_y += font_ascent();
|
||||
@ -2656,8 +2660,10 @@ static void draw_line(char *s)
|
||||
by,
|
||||
w * bar_usage / 255,
|
||||
h);
|
||||
cur_y += h;
|
||||
|
||||
if (specials[special_index].height > font_h) {
|
||||
cur_y += specials[special_index].height;
|
||||
cur_y -= font_descent();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2697,7 +2703,10 @@ static void draw_line(char *s)
|
||||
for (i=0;i<specials[special_index].graph_width;i++) {
|
||||
XDrawLine(display, window.drawable, window.gc, cur_x+(i*w*1.0/specials[special_index].graph_width)+2, by+h, cur_x+(i*w*1.0/specials[special_index].graph_width)+2, by+h-specials[special_index].graph[i]*h/100.0); /* this is mugfugly, but it works */
|
||||
}
|
||||
cur_y += h;
|
||||
if (specials[special_index].height > font_h) {
|
||||
cur_y += specials[special_index].height;
|
||||
cur_y -= font_ascent();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -163,7 +163,7 @@ void update_metar()
|
||||
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);
|
||||
} else if (status == 2) { /* thread is still running. what else can we do? */
|
||||
return;
|
||||
} else {
|
||||
} else { /* status must be 1 */
|
||||
pthread_join(thread1, NULL);
|
||||
status = 2;
|
||||
iret1 = pthread_create(&thread1, NULL, fetch_ftp, NULL);
|
||||
|
8
mpd.c
8
mpd.c
@ -67,12 +67,20 @@ void update_mpd()
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_STOP) {
|
||||
current_info->mpd.status = "Stopped";
|
||||
current_info->mpd.bitrate = 0;
|
||||
current_info->mpd.progress = 0;
|
||||
current_info->mpd.elapsed = 0;
|
||||
current_info->mpd.length = 0;
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_PAUSE) {
|
||||
current_info->mpd.status = "Paused";
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_UNKNOWN) {
|
||||
current_info->mpd.status = "Unknown";
|
||||
current_info->mpd.bitrate = 0;
|
||||
current_info->mpd.progress = 0;
|
||||
current_info->mpd.elapsed = 0;
|
||||
current_info->mpd.length = 0;
|
||||
}
|
||||
if (status->state == MPD_STATUS_STATE_PLAY ||
|
||||
status->state == MPD_STATUS_STATE_PAUSE) {
|
||||
|
Loading…
Reference in New Issue
Block a user