2008-01-06 18:23:56 +01:00
|
|
|
/*
|
|
|
|
* graph.c - a graph widget
|
|
|
|
*
|
|
|
|
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
|
|
|
* Copyright © 2007-2008 Marco Candrian <mac@calmar.ws>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
#include "common/draw.h"
|
2008-01-06 18:23:56 +01:00
|
|
|
#include "widget.h"
|
|
|
|
#include "screen.h"
|
2008-01-21 18:14:59 +01:00
|
|
|
#include "common/util.h"
|
2008-01-06 18:23:56 +01:00
|
|
|
|
|
|
|
extern AwesomeConf globalconf;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2008-01-25 21:39:08 +01:00
|
|
|
/* general layout */
|
2008-02-05 15:33:42 +01:00
|
|
|
float *max; /** Represents a full graph */
|
|
|
|
int width; /** Width of the widget */
|
|
|
|
float height; /** Height of graph (0-1; 1 = height of statusbar) */
|
|
|
|
int box_height; /** Height of the innerbox in pixels */
|
|
|
|
int padding_left; /** Left padding */
|
|
|
|
int size; /** Size of lines-array (also innerbox-lenght) */
|
|
|
|
XColor bg; /** Background color */
|
|
|
|
XColor bordercolor; /** Border color */
|
2008-01-25 21:39:08 +01:00
|
|
|
|
|
|
|
/* markers... */
|
2008-02-05 15:33:42 +01:00
|
|
|
int index; /** Index of current (new) value */
|
|
|
|
int *max_index; /** Index of the actual maximum value */
|
|
|
|
float *current_max; /** Pointer to current maximum value itself */
|
2008-01-25 21:39:08 +01:00
|
|
|
|
|
|
|
/* all data is stored here */
|
2008-02-05 15:33:42 +01:00
|
|
|
int data_items; /** Number of data-input items */
|
|
|
|
int **lines; /** Keeps the calculated values (line-length); */
|
|
|
|
float **values; /** Actual values */
|
2008-01-25 21:39:08 +01:00
|
|
|
|
|
|
|
/* additional data + a pointer to **lines accordingly */
|
2008-02-05 15:33:42 +01:00
|
|
|
int **fillbottom; /** Datatypes holder (data equal to **lines) */
|
|
|
|
int fillbottom_total; /** Total of them */
|
|
|
|
XColor *fillbottom_color; /** Color of them */
|
2008-02-06 01:07:27 +01:00
|
|
|
XColor **fillbottom_pcolor_center; /** Color at middle of graph */
|
2008-02-05 15:33:42 +01:00
|
|
|
XColor **fillbottom_pcolor_end; /** Color at end of graph */
|
|
|
|
int **filltop; /** Datatypes holder */
|
|
|
|
int filltop_total; /** Total of them */
|
|
|
|
XColor *filltop_color; /** Color of them */
|
2008-02-06 01:07:27 +01:00
|
|
|
XColor **filltop_pcolor_center; /** Color at center of graph */
|
2008-02-05 15:33:42 +01:00
|
|
|
XColor **filltop_pcolor_end; /** Color at end of graph */
|
|
|
|
int **drawline; /** Datatypes holder */
|
|
|
|
int drawline_total; /** Total of them */
|
|
|
|
XColor *drawline_color; /** Color of them */
|
2008-02-06 01:07:27 +01:00
|
|
|
XColor **drawline_pcolor_center; /** Color at middle of graph */
|
2008-02-05 15:33:42 +01:00
|
|
|
XColor **drawline_pcolor_end; /** Color at end of graph */
|
|
|
|
|
|
|
|
int *draw_from; /** Preparation/tmp array for draw_graph(); */
|
|
|
|
int *draw_to; /** Preparation/tmp array for draw_graph(); */
|
2008-01-25 21:39:08 +01:00
|
|
|
|
2008-01-06 18:23:56 +01:00
|
|
|
} Data;
|
|
|
|
|
|
|
|
static int
|
|
|
|
graph_draw(Widget *widget, DrawCtx *ctx, int offset,
|
|
|
|
int used __attribute__ ((unused)))
|
|
|
|
{
|
|
|
|
int margin_top, left_offset;
|
2008-01-25 21:39:08 +01:00
|
|
|
int z, y, x, tmp;
|
2008-01-06 18:23:56 +01:00
|
|
|
Data *d = widget->data;
|
2008-01-12 23:38:31 +01:00
|
|
|
Area rectangle;
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
if(d->width < 1 || !d->data_items)
|
2008-01-22 14:56:03 +01:00
|
|
|
return 0;
|
|
|
|
|
2008-01-06 18:23:56 +01:00
|
|
|
if(!widget->user_supplied_x)
|
|
|
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
|
|
|
d->width,
|
|
|
|
offset,
|
|
|
|
widget->alignment);
|
|
|
|
if(!widget->user_supplied_y)
|
|
|
|
widget->area.y = 0;
|
|
|
|
|
|
|
|
margin_top = (int) (widget->statusbar->height * (1 - d->height)) / 2 + 0.5 + widget->area.y;
|
|
|
|
left_offset = widget->area.x + d->padding_left;
|
|
|
|
|
2008-01-09 09:59:42 +01:00
|
|
|
if(!(d->box_height))
|
|
|
|
d->box_height = (int) (widget->statusbar->height * d->height + 0.5) - 2;
|
|
|
|
|
2008-01-12 23:38:31 +01:00
|
|
|
rectangle.x = left_offset;
|
|
|
|
rectangle.y = margin_top;
|
2008-01-25 21:39:08 +01:00
|
|
|
rectangle.width = d->size + 2;
|
2008-01-12 23:38:31 +01:00
|
|
|
rectangle.height = d->box_height + 2;
|
|
|
|
draw_rectangle(ctx, rectangle, False, d->bordercolor);
|
2008-01-09 09:59:42 +01:00
|
|
|
|
2008-01-12 23:38:31 +01:00
|
|
|
rectangle.x++;
|
|
|
|
rectangle.y++;
|
|
|
|
rectangle.width -= 2;
|
|
|
|
rectangle.height -= 2;
|
|
|
|
draw_rectangle(ctx, rectangle, True, d->bg);
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-31 19:40:47 +01:00
|
|
|
draw_graph_setup(ctx); /* setup some drawing options */
|
2008-01-25 21:39:08 +01:00
|
|
|
|
|
|
|
/* draw style = top */
|
|
|
|
for(z = 0; z < d->filltop_total; z++)
|
|
|
|
{
|
|
|
|
for(y = 0; y < d->size; y++)
|
|
|
|
{
|
|
|
|
for(tmp = 0, x = 0; x < d->filltop_total; x++) /* find largest smaller value */
|
|
|
|
{
|
|
|
|
if (x == z)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(d->filltop[x][y] > tmp && d->filltop[x][y] < d->filltop[z][y])
|
|
|
|
tmp = d->filltop[x][y];
|
|
|
|
}
|
|
|
|
d->draw_from[y] = d->box_height - tmp;
|
|
|
|
d->draw_to[y] = d->box_height - d->filltop[z][y];
|
|
|
|
}
|
2008-01-31 19:40:47 +01:00
|
|
|
draw_graph(ctx,
|
2008-01-25 21:39:08 +01:00
|
|
|
left_offset + 2, margin_top + d->box_height + 1,
|
|
|
|
d->size, d->draw_from, d->draw_to, d->index,
|
2008-02-06 01:07:27 +01:00
|
|
|
d->filltop_color[z], d->filltop_pcolor_center[z], d->filltop_pcolor_end[z]);
|
2008-01-25 21:39:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw style = bottom */
|
|
|
|
for(z = 0; z < d->fillbottom_total; z++)
|
|
|
|
{
|
|
|
|
for(y = 0; y < d->size; y++)
|
|
|
|
{
|
|
|
|
for(tmp = 0, x = 0; x < d->fillbottom_total; x++) /* find largest smaller value */
|
|
|
|
{
|
|
|
|
if (x == z)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if(d->fillbottom[x][y] > tmp && d->fillbottom[x][y] < d->fillbottom[z][y])
|
|
|
|
tmp = d->fillbottom[x][y];
|
|
|
|
}
|
|
|
|
d->draw_from[y] = tmp;
|
|
|
|
}
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-31 19:40:47 +01:00
|
|
|
draw_graph(ctx,
|
2008-01-25 21:39:08 +01:00
|
|
|
left_offset + 2, margin_top + d->box_height + 1,
|
|
|
|
d->size, d->draw_from, d->fillbottom[z], d->index,
|
2008-02-06 01:07:27 +01:00
|
|
|
d->fillbottom_color[z], d->fillbottom_pcolor_center[z], d->fillbottom_pcolor_end[z]);
|
2008-01-25 21:39:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* draw style = line */
|
|
|
|
for(z = 0; z < d->drawline_total; z++)
|
|
|
|
{
|
2008-01-31 19:40:47 +01:00
|
|
|
draw_graph_line(ctx,
|
2008-01-25 21:39:08 +01:00
|
|
|
left_offset + 2, margin_top + d->box_height + 1,
|
|
|
|
d->size, d->drawline[z], d->index,
|
2008-02-06 01:07:27 +01:00
|
|
|
d->drawline_color[z], d->drawline_pcolor_center[z], d->drawline_pcolor_end[z]);
|
2008-01-25 21:39:08 +01:00
|
|
|
}
|
|
|
|
|
2008-01-06 18:23:56 +01:00
|
|
|
widget->area.width = d->width;
|
|
|
|
widget->area.height = widget->statusbar->height;
|
|
|
|
return widget->area.width;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
graph_tell(Widget *widget, char *command)
|
|
|
|
{
|
|
|
|
Data *d = widget->data;
|
2008-01-25 21:39:08 +01:00
|
|
|
int i, z;
|
|
|
|
float *value;
|
|
|
|
char *tok;
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
if(!command || d->width < 1 || !(d->data_items > 0))
|
2008-01-06 18:23:56 +01:00
|
|
|
return;
|
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
value = p_new(float, d->data_items);
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
for (i = 0, tok = strtok(command, ","); tok && i < d->data_items; tok = strtok(NULL, ","), i++)
|
|
|
|
value[i] = MAX(atof(tok), 0);
|
2008-01-07 09:28:07 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
if(++d->index >= d->size) /* cycle inside the arrays (all-in-one) */
|
|
|
|
d->index = 0;
|
2008-01-09 09:59:42 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
/* add according values and to-draw-line-lenghts to the according data_items */
|
|
|
|
for(z = 0; z < d->data_items; z++)
|
|
|
|
{
|
|
|
|
if(d->values[z]) /* scale option is true */
|
2008-01-09 09:59:42 +01:00
|
|
|
{
|
2008-01-25 21:39:08 +01:00
|
|
|
d->values[z][d->index] = value[z];
|
|
|
|
|
|
|
|
if(value[z] > d->current_max[z]) /* a new maximum value found */
|
|
|
|
{
|
|
|
|
d->max_index[z] = d->index;
|
|
|
|
d->current_max[z] = value[z];
|
|
|
|
|
|
|
|
/* recalculate */
|
|
|
|
for (i = 0; i < d->size; i++)
|
|
|
|
d->lines[z][i] = (int) (d->values[z][i] * (d->box_height) / d->current_max[z] + 0.5);
|
|
|
|
}
|
|
|
|
else if(d->max_index[z] == d->index) /* old max_index reached, re-check/generate */
|
|
|
|
{
|
|
|
|
/* find the new max */
|
|
|
|
for (i = 0; i < d->size; i++)
|
|
|
|
if (d->values[z][i] > d->values[z][d->max_index[z]])
|
|
|
|
d->max_index[z] = i;
|
|
|
|
|
|
|
|
d->current_max[z] = MAX(d->values[z][d->max_index[z]], d->max[z]);
|
|
|
|
|
|
|
|
/* recalculate */
|
|
|
|
for (i = 0; i < d->size; i++)
|
|
|
|
d->lines[z][i] = (int) (d->values[z][i] * d->box_height / d->current_max[z] + 0.5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
d->lines[z][d->index] = (int) (value[z] * d->box_height / d->current_max[z] + 0.5);
|
2008-01-09 09:59:42 +01:00
|
|
|
|
|
|
|
}
|
2008-01-25 21:39:08 +01:00
|
|
|
else /* scale option is false - limit to d->box_height */
|
2008-01-09 09:59:42 +01:00
|
|
|
{
|
2008-01-25 21:39:08 +01:00
|
|
|
if (value[z] < d->current_max[z])
|
|
|
|
d->lines[z][d->index] = (int) (value[z] * d->box_height / d->current_max[z] + 0.5);
|
|
|
|
else
|
|
|
|
d->lines[z][d->index] = d->box_height;
|
2008-01-07 09:28:07 +01:00
|
|
|
}
|
|
|
|
}
|
2008-01-06 18:23:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Widget *
|
|
|
|
graph_new(Statusbar *statusbar, cfg_t *config)
|
|
|
|
{
|
|
|
|
Widget *w;
|
|
|
|
Data *d;
|
2008-01-25 21:39:08 +01:00
|
|
|
cfg_t *cfg;
|
2008-01-06 18:23:56 +01:00
|
|
|
char *color;
|
|
|
|
int phys_screen = get_phys_screen(statusbar->screen);
|
2008-01-25 21:39:08 +01:00
|
|
|
int i;
|
|
|
|
char *type;
|
2008-02-05 15:40:16 +01:00
|
|
|
XColor tmp_color = { 0, 0, 0, 0, 0, 0 };
|
2008-02-06 01:07:27 +01:00
|
|
|
XColor *ptmp_color_center;
|
2008-02-05 15:33:42 +01:00
|
|
|
XColor *ptmp_color_end;
|
2008-01-06 18:23:56 +01:00
|
|
|
|
|
|
|
w = p_new(Widget, 1);
|
|
|
|
widget_common_new(w, statusbar, config);
|
|
|
|
|
|
|
|
w->draw = graph_draw;
|
|
|
|
w->tell = graph_tell;
|
2008-02-11 19:01:48 +01:00
|
|
|
w->alignment = draw_get_align(cfg_getstr(config, "align"));
|
2008-01-06 18:23:56 +01:00
|
|
|
d = w->data = p_new(Data, 1);
|
|
|
|
|
|
|
|
d->width = cfg_getint(config, "width");
|
2008-01-09 09:59:42 +01:00
|
|
|
d->height = cfg_getfloat(config, "height");
|
2008-01-06 18:23:56 +01:00
|
|
|
d->padding_left = cfg_getint(config, "padding_left");
|
2008-01-25 21:39:08 +01:00
|
|
|
d->size = d->width - d->padding_left - 2;
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
if(d->size < 1)
|
2008-01-06 18:23:56 +01:00
|
|
|
{
|
|
|
|
warn("graph widget needs: (width - padding_left) >= 3\n");
|
|
|
|
return w;
|
|
|
|
}
|
2008-01-25 21:39:08 +01:00
|
|
|
|
|
|
|
if(!(d->data_items = cfg_size(config, "data")))
|
2008-01-22 14:56:03 +01:00
|
|
|
{
|
2008-01-25 21:39:08 +01:00
|
|
|
warn("graph widget needs at least one data section\n");
|
2008-01-22 14:56:03 +01:00
|
|
|
return w;
|
|
|
|
}
|
2008-01-06 18:23:56 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
d->draw_from = p_new(int, d->size);
|
|
|
|
d->draw_to = p_new(int, d->size);
|
2008-01-09 09:59:42 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
d->fillbottom = p_new(int *, d->size);
|
|
|
|
d->filltop = p_new(int *, d->size);
|
|
|
|
d->drawline = p_new(int *, d->size);
|
2008-01-09 11:48:12 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
d->values = p_new(float *, d->data_items);
|
|
|
|
d->lines = p_new(int *, d->data_items);
|
|
|
|
|
|
|
|
d->filltop_color = p_new(XColor, d->data_items);
|
2008-02-06 01:07:27 +01:00
|
|
|
d->filltop_pcolor_center = p_new(XColor *, d->data_items);
|
2008-02-05 15:33:42 +01:00
|
|
|
d->filltop_pcolor_end = p_new(XColor *, d->data_items);
|
2008-01-25 21:39:08 +01:00
|
|
|
d->fillbottom_color = p_new(XColor, d->data_items);
|
2008-02-06 01:07:27 +01:00
|
|
|
d->fillbottom_pcolor_center = p_new(XColor *, d->data_items);
|
2008-02-05 15:33:42 +01:00
|
|
|
d->fillbottom_pcolor_end = p_new(XColor *, d->data_items);
|
2008-01-25 21:39:08 +01:00
|
|
|
d->drawline_color = p_new(XColor, d->data_items);
|
2008-02-06 01:07:27 +01:00
|
|
|
d->drawline_pcolor_center = p_new(XColor *, d->data_items);
|
2008-02-05 15:33:42 +01:00
|
|
|
d->drawline_pcolor_end = p_new(XColor *, d->data_items);
|
2008-01-25 21:39:08 +01:00
|
|
|
|
|
|
|
d->max_index = p_new(int, d->data_items);
|
|
|
|
|
|
|
|
d->current_max = p_new(float, d->data_items);
|
|
|
|
d->max = p_new(float, d->data_items);
|
|
|
|
|
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
{
|
2008-02-06 01:07:27 +01:00
|
|
|
ptmp_color_center = ptmp_color_end = NULL;
|
2008-02-05 15:33:42 +01:00
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
cfg = cfg_getnsec(config, "data", i);
|
|
|
|
|
|
|
|
if((color = cfg_getstr(cfg, "fg")))
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, &tmp_color);
|
2008-01-25 21:39:08 +01:00
|
|
|
else
|
|
|
|
tmp_color = globalconf.screens[statusbar->screen].colors_normal[ColFG];
|
|
|
|
|
2008-02-06 01:07:27 +01:00
|
|
|
if((color = cfg_getstr(cfg, "fg_center")))
|
2008-02-05 15:33:42 +01:00
|
|
|
{
|
2008-02-06 01:07:27 +01:00
|
|
|
ptmp_color_center = p_new(XColor, 1);
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, ptmp_color_center);
|
2008-02-05 15:33:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if((color = cfg_getstr(cfg, "fg_end")))
|
|
|
|
{
|
|
|
|
ptmp_color_end = p_new(XColor, 1);
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, ptmp_color_center);
|
2008-02-05 15:33:42 +01:00
|
|
|
}
|
|
|
|
|
2008-01-25 21:39:08 +01:00
|
|
|
if (cfg_getbool(cfg, "scale"))
|
|
|
|
d->values[i] = p_new(float, d->size); /* not null -> scale = true */
|
|
|
|
|
|
|
|
/* prevent: division by zero */
|
|
|
|
d->current_max[i] = d->max[i] = cfg_getfloat(cfg, "max");
|
|
|
|
if(!(d->max[i] > 0))
|
|
|
|
{
|
|
|
|
warn("all graph widget needs a 'max' value greater than zero\n");
|
|
|
|
d->data_items = 0;
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
d->lines[i] = p_new(int, d->size);
|
|
|
|
|
|
|
|
/* filter each style-typ into it's own array (for easy looping later)*/
|
|
|
|
|
|
|
|
if ((type = cfg_getstr(cfg, "style")))
|
|
|
|
{
|
2008-01-31 19:40:47 +01:00
|
|
|
if(!a_strncmp(type, "bottom", sizeof("bottom")))
|
2008-01-25 21:39:08 +01:00
|
|
|
{
|
|
|
|
d->fillbottom[d->fillbottom_total] = d->lines[i];
|
|
|
|
d->fillbottom_color[d->fillbottom_total] = tmp_color;
|
2008-02-06 01:07:27 +01:00
|
|
|
d->fillbottom_pcolor_center[d->fillbottom_total] = ptmp_color_center;
|
2008-02-05 15:33:42 +01:00
|
|
|
d->fillbottom_pcolor_end[d->fillbottom_total] = ptmp_color_end;
|
2008-01-25 21:39:08 +01:00
|
|
|
d->fillbottom_total++;
|
|
|
|
}
|
2008-01-31 19:40:47 +01:00
|
|
|
else if (!a_strncmp(type, "top", sizeof("top")))
|
2008-01-25 21:39:08 +01:00
|
|
|
{
|
|
|
|
d->filltop[d->filltop_total] = d->lines[i];
|
|
|
|
d->filltop_color[d->filltop_total] = tmp_color;
|
2008-02-06 01:07:27 +01:00
|
|
|
d->filltop_pcolor_center[d->fillbottom_total] = ptmp_color_center;
|
2008-02-05 15:33:42 +01:00
|
|
|
d->filltop_pcolor_end[d->fillbottom_total] = ptmp_color_end;
|
2008-01-25 21:39:08 +01:00
|
|
|
d->filltop_total++;
|
|
|
|
}
|
2008-01-31 19:40:47 +01:00
|
|
|
else if (!a_strncmp(type, "line", sizeof("line")))
|
2008-01-25 21:39:08 +01:00
|
|
|
{
|
|
|
|
d->drawline[d->drawline_total] = d->lines[i];
|
|
|
|
d->drawline_color[d->drawline_total] = tmp_color;
|
2008-02-06 01:07:27 +01:00
|
|
|
d->drawline_pcolor_center[d->fillbottom_total] = ptmp_color_center;
|
2008-02-05 15:33:42 +01:00
|
|
|
d->drawline_pcolor_end[d->fillbottom_total] = ptmp_color_end;
|
2008-01-25 21:39:08 +01:00
|
|
|
d->drawline_total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-01-06 18:23:56 +01:00
|
|
|
|
|
|
|
if((color = cfg_getstr(config, "bg")))
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, &d->bg);
|
2008-01-06 18:23:56 +01:00
|
|
|
else
|
|
|
|
d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG];
|
|
|
|
|
|
|
|
if((color = cfg_getstr(config, "bordercolor")))
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, &d->bordercolor);
|
2008-01-06 18:23:56 +01:00
|
|
|
else
|
2008-01-25 21:39:08 +01:00
|
|
|
d->bordercolor = tmp_color;
|
2008-01-06 18:23:56 +01:00
|
|
|
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|