2007-12-23 14:27:56 +01:00
|
|
|
/*
|
|
|
|
* progressbar.c - progress bar widget
|
|
|
|
*
|
2008-01-02 16:59:43 +01:00
|
|
|
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
2007-12-23 14:27:56 +01:00
|
|
|
*
|
|
|
|
* 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-01 15:33:30 +01:00
|
|
|
#include <string.h>
|
2007-12-23 14:27:56 +01:00
|
|
|
#include "widget.h"
|
2008-01-02 17:41:03 +01:00
|
|
|
#include "screen.h"
|
2008-01-21 18:14:59 +01:00
|
|
|
#include "common/util.h"
|
2007-12-23 14:27:56 +01:00
|
|
|
|
|
|
|
extern AwesomeConf globalconf;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2008-01-01 16:23:28 +01:00
|
|
|
/** Percent 0 to 100 */
|
|
|
|
int *percent;
|
2008-02-17 08:42:11 +01:00
|
|
|
/** data_title of the data */
|
|
|
|
char **data_title;
|
|
|
|
/** Width of the data_items */
|
2008-01-01 16:23:28 +01:00
|
|
|
int width;
|
2008-01-29 08:44:16 +01:00
|
|
|
/** Padding */
|
|
|
|
int padding;
|
2008-02-17 08:42:11 +01:00
|
|
|
/** Pixel between data_items (bars) */
|
2008-01-01 16:23:28 +01:00
|
|
|
int gap;
|
2008-03-02 13:13:12 +01:00
|
|
|
/** reverse drawing */
|
|
|
|
Bool *reverse;
|
2008-02-17 08:42:11 +01:00
|
|
|
/** Number of data_items (bars) */
|
|
|
|
int data_items;
|
2008-01-01 16:23:28 +01:00
|
|
|
/** Height 0-1, where 1 is height of statusbar */
|
|
|
|
float height;
|
|
|
|
/** Foreground color */
|
2008-01-01 15:33:30 +01:00
|
|
|
XColor *fg;
|
2008-02-05 01:27:39 +01:00
|
|
|
/** Foreground color when bar is half-full */
|
2008-02-06 01:07:27 +01:00
|
|
|
XColor **pfg_center;
|
2008-02-04 11:16:30 +01:00
|
|
|
/** Foreground color when bar is full */
|
2008-02-06 01:07:27 +01:00
|
|
|
XColor **pfg_end;
|
2008-01-01 16:23:28 +01:00
|
|
|
/** Background color */
|
2008-01-01 15:33:30 +01:00
|
|
|
XColor *bg;
|
2008-01-01 16:23:28 +01:00
|
|
|
/** Border color */
|
2008-01-06 18:23:56 +01:00
|
|
|
XColor *bordercolor;
|
2007-12-23 14:27:56 +01:00
|
|
|
} Data;
|
|
|
|
|
|
|
|
static int
|
|
|
|
progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
2007-12-23 14:51:55 +01:00
|
|
|
int used __attribute__ ((unused)))
|
2007-12-23 14:27:56 +01:00
|
|
|
{
|
2008-01-01 15:33:30 +01:00
|
|
|
int i, width, pwidth, margin_top, pb_height, left_offset;
|
2008-01-12 23:38:31 +01:00
|
|
|
Area rectangle;
|
2008-01-01 15:33:30 +01:00
|
|
|
|
2007-12-23 14:27:56 +01:00
|
|
|
Data *d = widget->data;
|
|
|
|
|
2008-03-06 14:30:18 +01:00
|
|
|
if (!d->data_items)
|
2008-01-01 15:33:30 +01:00
|
|
|
return 0;
|
|
|
|
|
2008-01-29 08:44:16 +01:00
|
|
|
width = d->width - 2 * d->padding;
|
2007-12-23 14:27:56 +01:00
|
|
|
|
2008-01-05 12:35:12 +01:00
|
|
|
if(!widget->user_supplied_x)
|
|
|
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
2008-01-04 22:05:52 +01:00
|
|
|
d->width,
|
|
|
|
offset,
|
|
|
|
widget->alignment);
|
2007-12-23 14:27:56 +01:00
|
|
|
|
2008-01-05 12:35:12 +01:00
|
|
|
if(!widget->user_supplied_y)
|
|
|
|
widget->area.y = 0;
|
2008-01-04 22:05:52 +01:00
|
|
|
|
2008-01-05 12:35:12 +01:00
|
|
|
margin_top = (int) (widget->statusbar->height * (1 - d->height)) / 2 + 0.5 + widget->area.y;
|
2008-02-17 08:42:11 +01:00
|
|
|
pb_height = (int) ((widget->statusbar->height * d->height - (d->gap * (d->data_items - 1))) / d->data_items + 0.5);
|
2008-01-29 08:44:16 +01:00
|
|
|
left_offset = widget->area.x + d->padding;
|
2007-12-23 14:27:56 +01:00
|
|
|
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
2008-01-01 15:33:30 +01:00
|
|
|
{
|
2008-03-02 13:13:12 +01:00
|
|
|
if(d->reverse[i])
|
|
|
|
pwidth = (int)(((width - 2) * (100 - d->percent[i])) / 100);
|
|
|
|
else
|
|
|
|
pwidth = (int)(((width - 2) * d->percent[i]) / 100);
|
2007-12-23 14:51:55 +01:00
|
|
|
|
2008-01-12 23:38:31 +01:00
|
|
|
rectangle.x = left_offset;
|
|
|
|
rectangle.y = margin_top;
|
|
|
|
rectangle.width = width;
|
|
|
|
rectangle.height = pb_height;
|
|
|
|
|
|
|
|
draw_rectangle(ctx, rectangle, False, d->bordercolor[i]);
|
2007-12-23 14:27:56 +01:00
|
|
|
|
2008-03-02 13:13:12 +01:00
|
|
|
if(pwidth > 0) /* filled area */
|
2008-01-12 23:38:31 +01:00
|
|
|
{
|
|
|
|
rectangle.x = left_offset + 1;
|
|
|
|
rectangle.y = margin_top + 1;
|
|
|
|
rectangle.width = pwidth;
|
|
|
|
rectangle.height = pb_height - 2;
|
2008-03-02 13:13:12 +01:00
|
|
|
if(d->reverse[i])
|
|
|
|
draw_rectangle(ctx, rectangle, True, d->bg[i]);
|
|
|
|
else
|
|
|
|
draw_rectangle_gradient(ctx, rectangle, True, left_offset + 1, width - 2,
|
|
|
|
&(d->fg[i]), d->pfg_center[i], d->pfg_end[i]);
|
2008-01-12 23:38:31 +01:00
|
|
|
}
|
2008-01-01 15:33:30 +01:00
|
|
|
|
|
|
|
if(width - 2 - pwidth > 0) /* not filled area */
|
2008-01-12 23:38:31 +01:00
|
|
|
{
|
|
|
|
rectangle.x = left_offset + 1 + pwidth;
|
|
|
|
rectangle.y = margin_top + 1;
|
|
|
|
rectangle.width = width - 2 - pwidth;
|
|
|
|
rectangle.height = pb_height - 2;
|
2008-03-02 13:13:12 +01:00
|
|
|
if(d->reverse[i])
|
|
|
|
draw_rectangle_gradient(ctx, rectangle, True, left_offset + 1, width - 2,
|
|
|
|
d->pfg_end[i], d->pfg_center[i], &(d->fg[i]));
|
|
|
|
else
|
|
|
|
draw_rectangle(ctx, rectangle, True, d->bg[i]);
|
2008-01-12 23:38:31 +01:00
|
|
|
}
|
2008-01-01 15:33:30 +01:00
|
|
|
|
|
|
|
margin_top += (pb_height + d->gap);
|
|
|
|
}
|
2007-12-23 14:27:56 +01:00
|
|
|
|
2008-01-04 21:46:25 +01:00
|
|
|
widget->area.width = d->width;
|
2008-01-05 12:44:14 +01:00
|
|
|
widget->area.height = widget->statusbar->height;
|
2008-01-04 21:46:25 +01:00
|
|
|
return widget->area.width;
|
2007-12-23 14:27:56 +01:00
|
|
|
}
|
|
|
|
|
2008-03-04 19:06:04 +01:00
|
|
|
static widget_tell_status_t
|
2008-02-17 08:16:40 +01:00
|
|
|
progressbar_tell(Widget *widget, char *property, char *command)
|
2007-12-23 14:27:56 +01:00
|
|
|
{
|
|
|
|
Data *d = widget->data;
|
2008-03-06 14:30:18 +01:00
|
|
|
int i = 0, percent, tmp;
|
2008-02-17 08:42:11 +01:00
|
|
|
Bool flag;
|
|
|
|
char *title, *setting;
|
2008-01-01 15:33:30 +01:00
|
|
|
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!d->data_items)
|
|
|
|
return WIDGET_ERROR_CUSTOM; /* error already printed on _new */
|
|
|
|
|
|
|
|
if(!command)
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2007-12-23 14:27:56 +01:00
|
|
|
|
2008-02-17 08:42:11 +01:00
|
|
|
if(!a_strcmp(property, "data"))
|
2008-01-01 15:33:30 +01:00
|
|
|
{
|
2008-02-17 08:42:11 +01:00
|
|
|
title = strtok(command, " ");
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!(setting = strtok(NULL, " ")))
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
if(!a_strcmp(title, d->data_title[i]))
|
|
|
|
{
|
|
|
|
percent = atoi(setting);
|
|
|
|
d->percent[i] = (percent < 0 ? 0 : (percent > 100 ? 100 : percent));
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_NOERROR;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_SECTION;
|
2008-01-01 15:33:30 +01:00
|
|
|
}
|
2008-02-17 08:42:11 +01:00
|
|
|
else if(!a_strcmp(property, "fg"))
|
|
|
|
{
|
|
|
|
title = strtok(command, " ");
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!(setting = strtok(NULL, " ")))
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
if(!a_strcmp(title, d->data_title[i]))
|
|
|
|
{
|
2008-03-06 14:30:18 +01:00
|
|
|
if(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
|
|
|
setting, &d->fg[i]))
|
|
|
|
return WIDGET_NOERROR;
|
|
|
|
else
|
|
|
|
return WIDGET_ERROR_FORMAT_COLOR;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_SECTION;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
|
|
|
else if(!a_strcmp(property, "bg"))
|
|
|
|
{
|
|
|
|
title = strtok(command, " ");
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!(setting = strtok(NULL, " ")))
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
if(!a_strcmp(title, d->data_title[i]))
|
|
|
|
{
|
2008-03-06 14:30:18 +01:00
|
|
|
if(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
|
|
|
setting, &d->bg[i]))
|
|
|
|
return WIDGET_NOERROR;
|
|
|
|
else
|
|
|
|
return WIDGET_ERROR_FORMAT_COLOR;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_SECTION;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
|
|
|
else if(!a_strcmp(property, "fg_center"))
|
|
|
|
{
|
|
|
|
title = strtok(command, " ");
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!(setting = strtok(NULL, " ")))
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
if(!a_strcmp(title, d->data_title[i]))
|
|
|
|
{
|
|
|
|
flag = False;
|
|
|
|
if(!d->pfg_center[i])
|
|
|
|
{
|
2008-03-06 14:30:18 +01:00
|
|
|
flag = True; /* p_delete && restore to NULL, if draw_color_new unsuccessful */
|
2008-02-17 08:42:11 +01:00
|
|
|
d->pfg_center[i] = p_new(XColor, 1);
|
|
|
|
}
|
|
|
|
if(!(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
2008-03-06 14:30:18 +01:00
|
|
|
setting, d->pfg_center[i])))
|
|
|
|
{
|
2008-02-17 08:42:11 +01:00
|
|
|
if(flag) /* restore */
|
|
|
|
{
|
|
|
|
p_delete(&d->pfg_center[i]);
|
|
|
|
d->pfg_center[i] = NULL;
|
|
|
|
}
|
2008-03-06 14:30:18 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_COLOR;
|
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_NOERROR;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_SECTION;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
|
|
|
else if(!a_strcmp(property, "fg_end"))
|
|
|
|
{
|
|
|
|
title = strtok(command, " ");
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!(setting = strtok(NULL, " ")))
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
if(!a_strcmp(title, d->data_title[i]))
|
|
|
|
{
|
|
|
|
flag = False;
|
|
|
|
if(!d->pfg_end[i])
|
|
|
|
{
|
2008-03-06 14:30:18 +01:00
|
|
|
flag = True;
|
2008-02-17 08:42:11 +01:00
|
|
|
d->pfg_end[i] = p_new(XColor, 1);
|
|
|
|
}
|
|
|
|
if(!(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
2008-03-06 14:30:18 +01:00
|
|
|
setting, d->pfg_end[i])))
|
|
|
|
{
|
2008-02-17 08:42:11 +01:00
|
|
|
if(flag) /* restore */
|
|
|
|
{
|
|
|
|
p_delete(&d->pfg_end[i]);
|
|
|
|
d->pfg_end[i] = NULL;
|
|
|
|
}
|
2008-03-06 14:30:18 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_COLOR;
|
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_NOERROR;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(!a_strcmp(property, "bordercolor"))
|
|
|
|
{
|
|
|
|
title = strtok(command, " ");
|
2008-03-06 14:30:18 +01:00
|
|
|
if(!(setting = strtok(NULL, " ")))
|
|
|
|
return WIDGET_ERROR_NOVALUE;
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
|
|
|
if(!a_strcmp(title, d->data_title[i]))
|
|
|
|
{
|
2008-03-06 14:30:18 +01:00
|
|
|
if(draw_color_new(globalconf.display, get_phys_screen(widget->statusbar->screen),
|
|
|
|
setting, &d->bordercolor[i]))
|
|
|
|
return WIDGET_NOERROR;
|
|
|
|
else
|
|
|
|
return WIDGET_ERROR_FORMAT_COLOR;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_ERROR_FORMAT_SECTION;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
|
|
|
else if(!a_strcmp(property, "gap"))
|
|
|
|
d->gap = atoi(command);
|
|
|
|
else if(!a_strcmp(property, "width"))
|
|
|
|
{
|
2008-03-06 14:30:18 +01:00
|
|
|
tmp = atoi(command);
|
|
|
|
if(tmp - d->padding < 3)
|
|
|
|
{
|
|
|
|
warn("progressbar widget needs: (width - padding) >= 3. Ignoring command.\n");
|
|
|
|
return WIDGET_ERROR_CUSTOM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
d->width = tmp;
|
2008-02-17 08:42:11 +01:00
|
|
|
}
|
|
|
|
else if(!a_strcmp(property, "height"))
|
|
|
|
d->height = atof(command);
|
|
|
|
else if(!a_strcmp(property, "padding"))
|
2008-03-06 14:30:18 +01:00
|
|
|
{
|
|
|
|
tmp = atoi(command);
|
|
|
|
if(d->width - tmp < 3)
|
|
|
|
{
|
|
|
|
warn("progressbar widget needs: (width - padding) >= 3. Ignoring command.\n");
|
|
|
|
return WIDGET_ERROR_CUSTOM;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
d->padding = tmp;
|
|
|
|
}
|
2008-02-17 08:42:11 +01:00
|
|
|
else
|
2008-03-04 19:06:04 +01:00
|
|
|
return WIDGET_ERROR;
|
|
|
|
|
|
|
|
return WIDGET_NOERROR;
|
2007-12-23 14:27:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Widget *
|
|
|
|
progressbar_new(Statusbar *statusbar, cfg_t *config)
|
|
|
|
{
|
|
|
|
Widget *w;
|
|
|
|
Data *d;
|
|
|
|
char *color;
|
2008-01-02 17:41:03 +01:00
|
|
|
int i, phys_screen = get_phys_screen(statusbar->screen);
|
2008-01-01 15:33:30 +01:00
|
|
|
cfg_t *cfg;
|
|
|
|
|
2007-12-23 14:27:56 +01:00
|
|
|
w = p_new(Widget, 1);
|
|
|
|
widget_common_new(w, statusbar, config);
|
|
|
|
w->draw = progressbar_draw;
|
|
|
|
w->tell = progressbar_tell;
|
|
|
|
d = w->data = p_new(Data, 1);
|
|
|
|
d->width = cfg_getint(config, "width");
|
2008-03-06 14:30:18 +01:00
|
|
|
d->padding = cfg_getint(config, "padding");
|
|
|
|
|
|
|
|
if(d->width - d->padding < 3)
|
|
|
|
{
|
|
|
|
warn("progressbar widget needs: (width - padding) >= 3\n");
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
2008-02-17 08:42:11 +01:00
|
|
|
d->height = cfg_getfloat(config, "height");
|
|
|
|
d->gap = cfg_getint(config, "gap");
|
|
|
|
|
2008-02-08 10:59:55 +01:00
|
|
|
w->alignment = draw_get_align(cfg_getstr(config, "align"));
|
2008-01-01 15:33:30 +01:00
|
|
|
|
2008-02-17 08:42:11 +01:00
|
|
|
if(!(d->data_items = cfg_size(config, "data")))
|
2008-01-01 15:33:30 +01:00
|
|
|
{
|
2008-03-04 19:06:04 +01:00
|
|
|
warn("progressbar widget needs at least one bar section\n");
|
2008-01-01 15:33:30 +01:00
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
2008-02-17 08:42:11 +01:00
|
|
|
d->fg = p_new(XColor, d->data_items);
|
|
|
|
d->pfg_end = p_new(XColor *, d->data_items);
|
|
|
|
d->pfg_center = p_new(XColor *, d->data_items);
|
|
|
|
d->bg = p_new(XColor, d->data_items);
|
|
|
|
d->bordercolor = p_new(XColor, d->data_items);
|
|
|
|
d->percent = p_new(int, d->data_items);
|
2008-03-02 13:13:12 +01:00
|
|
|
d->reverse = p_new(Bool, d->data_items);
|
2008-02-17 08:42:11 +01:00
|
|
|
d->data_title = p_new(char *, d->data_items);
|
2008-01-01 16:23:28 +01:00
|
|
|
|
2008-02-17 08:42:11 +01:00
|
|
|
for(i = 0; i < d->data_items; i++)
|
2008-01-01 15:33:30 +01:00
|
|
|
{
|
2008-02-17 08:42:11 +01:00
|
|
|
cfg = cfg_getnsec(config, "data", i);
|
|
|
|
|
|
|
|
d->data_title[i] = a_strdup(cfg_title(cfg));
|
2008-01-01 15:33:30 +01:00
|
|
|
|
2008-03-02 13:13:12 +01:00
|
|
|
if(!(d->reverse[i] = cfg_getbool(cfg, "reverse")))
|
|
|
|
d->reverse[i] = False;
|
|
|
|
|
2008-01-01 15:33:30 +01:00
|
|
|
if((color = cfg_getstr(cfg, "fg")))
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, &d->fg[i]);
|
2008-01-01 15:33:30 +01:00
|
|
|
else
|
|
|
|
d->fg[i] = 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 01:27:39 +01:00
|
|
|
{
|
2008-02-06 01:07:27 +01:00
|
|
|
d->pfg_center[i] = p_new(XColor, 1);
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, d->pfg_center[i]);
|
2008-02-05 01:27:39 +01:00
|
|
|
}
|
|
|
|
|
2008-02-06 01:07:27 +01:00
|
|
|
if((color = cfg_getstr(cfg, "fg_end")))
|
2008-02-05 01:27:39 +01:00
|
|
|
{
|
2008-02-06 01:07:27 +01:00
|
|
|
d->pfg_end[i] = p_new(XColor, 1);
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, d->pfg_end[i]);
|
2008-02-05 01:27:39 +01:00
|
|
|
}
|
2008-02-04 11:16:30 +01:00
|
|
|
|
2008-01-01 15:33:30 +01:00
|
|
|
if((color = cfg_getstr(cfg, "bg")))
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, &d->bg[i]);
|
2008-01-01 15:33:30 +01:00
|
|
|
else
|
|
|
|
d->bg[i] = globalconf.screens[statusbar->screen].colors_normal[ColBG];
|
|
|
|
|
2008-01-06 18:23:56 +01:00
|
|
|
if((color = cfg_getstr(cfg, "bordercolor")))
|
2008-02-13 08:58:21 +01:00
|
|
|
draw_color_new(globalconf.display, phys_screen, color, &d->bordercolor[i]);
|
2008-01-01 15:33:30 +01:00
|
|
|
else
|
2008-01-06 18:23:56 +01:00
|
|
|
d->bordercolor[i] = d->fg[i];
|
2008-02-05 01:27:39 +01:00
|
|
|
}
|
2008-01-01 15:33:30 +01:00
|
|
|
|
2007-12-23 14:27:56 +01:00
|
|
|
return w;
|
|
|
|
}
|
|
|
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|