use right statusbar in various widgets

This commit is contained in:
Julien Danjou 2008-01-03 17:15:21 +01:00
parent 817aab0450
commit 675b6e6255
3 changed files with 11 additions and 13 deletions

View File

@ -41,11 +41,10 @@ typedef struct
static int static int
focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used) focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
{ {
VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
Data *d = widget->data; Data *d = widget->data;
Client *sel = focus_get_current_client(widget->statusbar->screen); Client *sel = focus_get_current_client(widget->statusbar->screen);
widget->location = widget_calculate_offset(vscreen.statusbar->width, widget->location = widget_calculate_offset(widget->statusbar->width,
0, 0,
offset, offset,
widget->alignment); widget->alignment);
@ -53,8 +52,8 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
if(sel) if(sel)
{ {
draw_text(ctx, widget->location, 0, draw_text(ctx, widget->location, 0,
vscreen.statusbar->width - used, widget->statusbar->width - used,
vscreen.statusbar->height, widget->statusbar->height,
d->align, d->align,
widget->font->height / 2, widget->font, sel->name, widget->font->height / 2, widget->font, sel->name,
d->fg, d->bg); d->fg, d->bg);
@ -65,9 +64,9 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
} }
else else
draw_rectangle(ctx, widget->location, 0, draw_rectangle(ctx, widget->location, 0,
vscreen.statusbar->width - used, vscreen.statusbar->height, True, d->bg); widget->statusbar->width - used, widget->statusbar->height, True, d->bg);
widget->width = vscreen.statusbar->width - used; widget->width = widget->statusbar->width - used;
return widget->width; return widget->width;
} }

View File

@ -92,7 +92,7 @@ taglist_draw(Widget *widget,
colors = vscreen.colors_normal; colors = vscreen.colors_normal;
draw_text(ctx, draw_text(ctx,
widget->location + widget->width, 0, widget->location + widget->width, 0,
w, vscreen.statusbar->height, w, widget->statusbar->height,
AlignCenter, AlignCenter,
vscreen.font->height / 2, vscreen.font->height / 2,
vscreen.font, vscreen.font,

View File

@ -44,7 +44,6 @@ typedef struct
static int static int
tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used) tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
{ {
VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
Client *c; Client *c;
Data *d = widget->data; Data *d = widget->data;
Client *sel = focus_get_current_client(widget->statusbar->screen); Client *sel = focus_get_current_client(widget->statusbar->screen);
@ -60,9 +59,9 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
return widget->width; return widget->width;
} }
box_width = (vscreen.statusbar->width - used) / n; box_width = (widget->statusbar->width - used) / n;
widget->location = widget_calculate_offset(vscreen.statusbar->width, widget->location = widget_calculate_offset(widget->statusbar->width,
0, 0,
offset, offset,
widget->alignment); widget->alignment);
@ -74,7 +73,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
{ {
draw_text(ctx, widget->location + box_width * i, 0, draw_text(ctx, widget->location + box_width * i, 0,
box_width, box_width,
vscreen.statusbar->height, widget->statusbar->height,
d->align, d->align,
widget->font->height / 2, widget->font, c->name, widget->font->height / 2, widget->font, c->name,
d->fg_sel, d->bg_sel); d->fg_sel, d->bg_sel);
@ -82,7 +81,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
else else
draw_text(ctx, widget->location + box_width * i, 0, draw_text(ctx, widget->location + box_width * i, 0,
box_width, box_width,
vscreen.statusbar->height, widget->statusbar->height,
d->align, d->align,
widget->font->height / 2, widget->font, c->name, widget->font->height / 2, widget->font, c->name,
d->fg, d->bg); d->fg, d->bg);
@ -93,7 +92,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
i++; i++;
} }
widget->width = vscreen.statusbar->width - used; widget->width = widget->statusbar->width - used;
return widget->width; return widget->width;
} }