From 093878ac03da771852baa0da9b298147cd251e56 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Fri, 29 Jul 2005 02:52:08 +0000 Subject: [PATCH] small fixes, mostly to graph stuff git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@26 7f574dfc-610e-0410-a909-a81674777703 --- conky.c | 21 +++++++++++++++------ metarinfo.c | 2 +- mpd.c | 8 ++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/conky.c b/conky.c index d543af1e..4130cd5e 100644 --- a/conky.c +++ b/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 font_h) { + cur_y += specials[special_index].height; + cur_y -= font_ascent(); + } } break; diff --git a/metarinfo.c b/metarinfo.c index 5d67c898..c5428680 100644 --- a/metarinfo.c +++ b/metarinfo.c @@ -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); diff --git a/mpd.c b/mpd.c index 2e75edc0..c21ec010 100644 --- a/mpd.c +++ b/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) {