diff --git a/widgets/focustitle.c b/widgets/focustitle.c index 84e7178b..868a2aa4 100644 --- a/widgets/focustitle.c +++ b/widgets/focustitle.c @@ -43,31 +43,32 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used) { Data *d = widget->data; Client *sel = focus_get_current_client(widget->statusbar->screen); + Area widget_area = widget->area; if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, 0, offset, widget->alignment); if(widget->area.y < 0) - widget->area.y = 0; + widget_area.y = 0; if(sel) { - draw_text(ctx, widget->area.x, widget->area.y, + draw_text(ctx, widget_area.x, widget_area.y, widget->statusbar->width - used, widget->statusbar->height, d->align, widget->font->height / 2, widget->font, sel->name, d->fg, d->bg); if(sel->isfloating) - draw_circle(ctx, widget->area.x, widget->area.y, + draw_circle(ctx, widget_area.x, widget_area.y, (widget->font->height + 2) / 4, sel->ismax, d->fg); } else - draw_rectangle(ctx, widget->area.x, widget->area.y, + draw_rectangle(ctx, widget_area.x, widget_area.y, widget->statusbar->width - used, widget->statusbar->height, True, d->bg); widget->area.width = widget->statusbar->width - used; diff --git a/widgets/iconbox.c b/widgets/iconbox.c index 4ceaf7cb..6ad6aa01 100644 --- a/widgets/iconbox.c +++ b/widgets/iconbox.c @@ -35,7 +35,7 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { Data *d = widget->data; - Area area = draw_get_image_size(d->image); + Area area = draw_get_image_size(d->image), widget_area = widget->area; if(d->resize) widget->area.width = ((double) widget->statusbar->height / area.height) * area.width; @@ -43,15 +43,15 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset, widget->area.width = area.width; if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, widget->area.width, offset, widget->alignment); if(widget->area.y < 0) - widget->area.y = 0; + widget_area.y = 0; - draw_image(ctx, widget->area.x, widget->area.y, + draw_image(ctx, widget_area.x, widget_area.y, d->resize ? widget->statusbar->height : 0, d->image); return widget->area.width; diff --git a/widgets/layoutinfo.c b/widgets/layoutinfo.c index 46fccb57..cc0e86c5 100644 --- a/widgets/layoutinfo.c +++ b/widgets/layoutinfo.c @@ -34,19 +34,20 @@ layoutinfo_draw(Widget *widget, int used __attribute__ ((unused))) { Tag **curtags = get_current_tags(widget->statusbar->screen); + Area widget_area = widget->area; if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, widget->statusbar->height, offset, widget->alignment); if(widget->area.y < 0) - widget->area.y = 0; + widget_area.y = 0; widget->area.width = widget->statusbar->height; - draw_image(ctx, widget->area.x, widget->area.y, + draw_image(ctx, widget_area.x, widget_area.y, widget->statusbar->height, curtags[0]->layout->image); diff --git a/widgets/netwmicon.c b/widgets/netwmicon.c index c4d667f5..ad70094d 100644 --- a/widgets/netwmicon.c +++ b/widgets/netwmicon.c @@ -34,7 +34,7 @@ static int netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { - Area area; + Area area, widget_area = widget->area; Rule* r; Client *sel = focus_get_current_client(widget->statusbar->screen); NetWMIcon *icon; @@ -52,14 +52,14 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset, widget->area.width = ((double) widget->statusbar->height / (double) area.height) * area.width; if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, widget->area.width, offset, widget->alignment); if(widget->area.y < 0) - widget->area.y = 0; - draw_image(ctx, widget->area.x, widget->area.y, + widget_area.y = 0; + draw_image(ctx, widget_area.x, widget_area.y, widget->statusbar->height, r->icon); return widget->area.width; @@ -75,16 +75,16 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset, widget->area.width = ((double) widget->statusbar->height / (double) icon->height) * icon->width; if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, widget->area.width, offset, widget->alignment); if(widget->area.y < 0) - widget->area.y = 0; + widget_area.y = 0; draw_image_from_argb_data(ctx, - widget->area.x, widget->area.y, + widget_area.x, widget_area.y, icon->width, icon->height, widget->statusbar->height, icon->image); diff --git a/widgets/progressbar.c b/widgets/progressbar.c index c1dfd587..8b6a4ee1 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -55,6 +55,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { int i, width, pwidth, margin_top, pb_height, left_offset; + Area widget_area = widget->area; Data *d = widget->data; @@ -64,17 +65,17 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, width = d->width - d->lpadding; if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, d->width, offset, widget->alignment); if(widget->area.y < 0) - widget->area.y = 0; + widget_area.y = 0; - margin_top = (int) (widget->statusbar->height * (1 - d->height)) / 2 + 0.5 + widget->area.y; + margin_top = (int) (widget->statusbar->height * (1 - d->height)) / 2 + 0.5 + widget_area.y; pb_height = (int) (widget->statusbar->height * d->height - (d->gap * (d->bars - 1))) / d->bars + 0.5; - left_offset = widget->area.x + d->lpadding; + left_offset = widget_area.x + d->lpadding; for(i = 0; i < d->bars; i++) { diff --git a/widgets/taglist.c b/widgets/taglist.c index 29e7622b..166cf58b 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -75,8 +75,7 @@ taglist_draw(Widget *widget, for(tag = vscreen.tags; tag; tag = tag->next) widget->area.width += textwidth(vscreen.font, tag->name) + vscreen.font->height; - if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget->area.x = widget_calculate_offset(widget->statusbar->width, widget->area.width, offset, widget->alignment); diff --git a/widgets/textbox.c b/widgets/textbox.c index 2bac9236..a971b43b 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -40,6 +40,7 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { Data *d = widget->data; + Area widget_area = widget->area; if(d->width) widget->area.width = d->width; @@ -47,13 +48,16 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset, widget->area.width = textwidth(widget->font, d->text); if(widget->area.x < 0) - widget->area.x = widget_calculate_offset(widget->statusbar->width, + widget_area.x = widget_calculate_offset(widget->statusbar->width, widget->area.width, offset, widget->alignment); + if(widget->area.y < 0) + widget_area.y = 0; - draw_text(ctx, widget->area.x, 0, widget->area.width, widget->statusbar->height, - d->align, 0, widget->font, d->text, d->fg, d->bg); + draw_text(ctx, widget_area.x, widget_area.y, widget->area.width, + widget->statusbar->height, d->align, 0, widget->font, + d->text, d->fg, d->bg); return widget->area.width; }