diff --git a/src/conky.c b/src/conky.c index 1379f574..52a64112 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3023,6 +3023,9 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) specials[special_index].first_colour); } colour_idx = 0; + + int og, g = -1; // dmr's here.. + for (i = w - 2; i > -1; i--) { if (specials[special_index].last_colour != 0 || specials[special_index].first_colour != 0) { @@ -3056,11 +3059,21 @@ int draw_each_line_inner(char *s, int special_index, int last_special_applied) set_foreground_color(tmpcolour[colour_idx++]); } } + + og = g; + g = round_to_int((double)by + h - specials[special_index].graph[j] * + (h - 1) / specials[special_index].graph_scale); + + if (!~og) { + og = g; + } + /* this is mugfugly, but it works */ XDrawLine(display, window.drawable, window.gc, - cur_x + i + 1, by + h, cur_x + i + 1, - round_to_int((double)by + h - specials[special_index].graph[j] * - (h - 1) / specials[special_index].graph_scale)); + cur_x + i + 1, + specials[special_index].dotgraph ? og : by + h, + cur_x + i + 1, + g); ++j; } if (tmpcolour) free(tmpcolour); @@ -5974,7 +5987,7 @@ static void signal_handler(int sig) { /* signal handler is light as a feather, as it should be. * we will poll g_signal_pending with each loop of conky - * and do any signal processing there, NOT here (except + * and do any signal processing there, NOT here (except * SIGALRM because this is caused when conky is hanging) */ if(sig == SIGALRM) { alarm_handler(); diff --git a/src/specials.c b/src/specials.c index dc0dfa32..a9f69654 100644 --- a/src/specials.c +++ b/src/specials.c @@ -68,7 +68,7 @@ struct graph { int width, height; unsigned int first_colour, last_colour; unsigned int scale, showaslog; - char tempgrad; + char tempgrad, dotgraph; }; struct stippled_hr { @@ -161,11 +161,15 @@ char *scan_graph(struct text_object *obj, const char *args, int defscale) g->last_colour = 0; g->scale = defscale; g->tempgrad = FALSE; + g->dotgraph = FALSE; g->showaslog = FALSE; if (args) { if (strstr(args, " "TEMPGRAD) || strncmp(args, TEMPGRAD, strlen(TEMPGRAD)) == 0) { g->tempgrad = TRUE; } + if (strstr(args, " "DOTGRAPH) || strncmp(args, DOTGRAPH, strlen(DOTGRAPH)) == 0) { + g->dotgraph = TRUE; + } if (strstr(args, " "LOGGRAPH) || strncmp(args, LOGGRAPH, strlen(LOGGRAPH)) == 0) { g->showaslog = TRUE; } @@ -428,6 +432,7 @@ void new_graph(struct text_object *obj, char *buf, int buf_max_size, double val) s->show_scale = 1; } s->tempgrad = g->tempgrad; + s->dotgraph = g->dotgraph; #ifdef MATH if (g->showaslog) { s->graph_scale = log10(s->graph_scale + 1); diff --git a/src/specials.h b/src/specials.h index dfa20fdd..fe8f5a04 100644 --- a/src/specials.h +++ b/src/specials.h @@ -36,6 +36,7 @@ // don't use spaces in LOGGRAPH or NORMGRAPH if you change them #define LOGGRAPH "-l" #define TEMPGRAD "-t" +#define DOTGRAPH "-d" enum special_types { NONSPECIAL = 0, @@ -70,7 +71,7 @@ struct special_t { unsigned long first_colour; // for graph gradient unsigned long last_colour; short font_added; - char tempgrad; + char tempgrad, dotgraph; }; /* direct access to the registered specials (FIXME: bad encapsulation) */