diff --git a/common/configopts.c b/common/configopts.c index 4510a615..5d768d47 100644 --- a/common/configopts.c +++ b/common/configopts.c @@ -372,8 +372,6 @@ cfg_opt_t widget_graph_opts[] = CFG_INT((char *) "width", 100, CFGF_NONE), /** Put new values onto the 'left' or 'right'. */ CFG_POSITION((char *) "grow", (char *) "left", CFGF_NONE), - /** Empty space on the left in pixel. */ - CFG_INT((char *) "padding_left", 0, CFGF_NONE), /** Set height (i.e. 0.9 = 90%). */ CFG_FLOAT((char *) "height", 0.67, CFGF_NONE), /** Background color. */ @@ -426,8 +424,6 @@ cfg_opt_t widget_progressbar_opts[] = CFG_INT((char *) "ticks_gap", 1, CFGF_NONE), /** Number of 'ticks' to draw. */ CFG_INT((char *) "ticks_count", 0, CFGF_NONE), - /** Empty space on both sides. */ - CFG_INT((char *) "padding", 0, CFGF_NONE), /** Set height (i.e. 0.9 = 90%). */ CFG_FLOAT((char *) "height", 0.67, CFGF_NONE), /** Draw the bar(s) vertically. */ diff --git a/widgets/graph.c b/widgets/graph.c index ca1d1980..fcd00500 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -37,7 +37,6 @@ typedef struct 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 */ @@ -85,7 +84,7 @@ static int graph_draw(Widget *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { - int margin_top, left_offset; + int margin_top; int z, y, x, tmp, cur_index, test_index; Data *d = widget->data; area_t rectangle, pattern_area; @@ -101,15 +100,13 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset, if(!widget->user_supplied_y) widget->area.y = 0; - left_offset = widget->area.x + d->padding_left; - /* box = the graph inside the rectangle */ if(!(d->box_height)) d->box_height = (int) (widget->statusbar->height * d->height + 0.5) - 2; margin_top = (int)((widget->statusbar->height - (d->box_height + 2)) / 2 + 0.5) + widget->area.y; - rectangle.x = left_offset; + rectangle.x = widget->area.x; rectangle.y = margin_top; rectangle.width = d->size + 2; rectangle.height = d->box_height + 2; @@ -122,7 +119,7 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset, draw_rectangle(ctx, rectangle, 1.0, True, d->bg); /* for graph drawing */ - rectangle.x = left_offset + 2; + rectangle.x = widget->area.x + 2; rectangle.y = margin_top + d->box_height + 1; /* bottom left corner as starting point */ rectangle.width = d->size; /* rectangle.height is not used */ @@ -390,14 +387,6 @@ graph_new(Statusbar *statusbar, cfg_t *config) d->width = cfg_getint(config, "width"); d->height = cfg_getfloat(config, "height"); - d->padding_left = cfg_getint(config, "padding_left"); - d->size = d->width - d->padding_left - 2; - - if(d->size < 1) - { - warn("graph widget needs: (width - padding_left) >= 3\n"); - return w; - } if(!(d->data_items = cfg_size(config, "data"))) { diff --git a/widgets/progressbar.c b/widgets/progressbar.c index 5261042b..7b8696d5 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -39,8 +39,6 @@ typedef struct char **data_title; /** Width of the data_items */ int width; - /** Padding */ - int padding; /** Pixel between data items (bars) */ int gap; /** border width in pixels */ @@ -78,14 +76,13 @@ Bool check_settings(Data *, int); Bool check_settings(Data *d, int status_height) { - int simple, h_total, v_total; + int simple, h_total; - v_total = d->width - d->padding; h_total = (int)(status_height * d->height + 0.5); if(!d->vertical) /* horizontal */ { - simple = v_total - 2 * (d->border_width + d->border_padding) - 1; + simple = d->width - 2 * (d->border_width + d->border_padding) - 1; if((d->ticks_count && simple - (d->ticks_count - 1) * d->ticks_gap - d->ticks_count + 1 < 0) || (!d->ticks_count && simple < 0)) { @@ -108,7 +105,7 @@ check_settings(Data *d, int status_height) warn("progressbar's 'height' is too small for the given configuration options\n"); return False; } - simple = v_total - d->data_items * (d->border_width + d->border_padding + 1) - (d->data_items - 1) * d->gap; + simple = d->width - d->data_items * (d->border_width + d->border_padding + 1) - (d->data_items - 1) * d->gap; if(simple < 0) { warn("progressbar's 'width' is too small for the given configuration options\n"); @@ -152,7 +149,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, * 4. finally draw the gaps */ - pb_x = widget->area.x + d->padding + 1; + pb_x = widget->area.x + 1; border_offset = d->border_width / 2; pb_offset = 0; @@ -166,7 +163,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, pb_height = unit * d->ticks_count - d->ticks_gap; /* rounded to match ticks... */ } - pb_width = (int) ((d->width - d->padding - 2 * (d->border_width + d->border_padding) * d->data_items - + pb_width = (int) ((d->width - 2 * (d->border_width + d->border_padding) * d->data_items - d->gap * (d->data_items - 1)) / d->data_items); pb_y = widget->area.y + ((int) (widget->statusbar->height * (1 - d->height)) / 2) + d->border_width + d->border_padding; @@ -268,7 +265,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, } else /* a horizontal progressbar */ { - pb_width = d->width - d->padding - d->border_width - 2 * d->border_padding; + pb_width = d->width - d->border_width - 2 * d->border_padding; if(d->ticks_count && d->ticks_gap) { unit = (pb_width + d->ticks_gap) / d->ticks_count; @@ -443,17 +440,6 @@ progressbar_tell(Widget *widget, char *property, char *command) return WIDGET_ERROR_CUSTOM; } } - else if(!a_strcmp(property, "border_padding")) - { - tmp = d->padding; - d->padding = atoi(command); - if(!check_settings(d, widget->statusbar->height)) - { - d->padding = tmp; - return WIDGET_ERROR_CUSTOM; - } - - } else return WIDGET_ERROR; @@ -480,7 +466,6 @@ progressbar_new(Statusbar *statusbar, cfg_t *config) d->height = cfg_getfloat(config, "height"); d->width = cfg_getint(config, "width"); - d->padding = cfg_getint(config, "padding"); d->border_padding = cfg_getint(config, "border_padding"); d->ticks_gap = cfg_getint(config, "ticks_gap");