Make empty status bar look nice.

It's now possible to have unfilled space on the status bar. Fill it with the
background colour on creation.

Normalise line lengths while I'm at it.
This commit is contained in:
Aldo Cortesi 2007-12-16 19:44:40 +11:00 committed by Julien Danjou
parent 5923c90aaa
commit 5715b70ab3
2 changed files with 22 additions and 6 deletions

View file

@ -46,8 +46,15 @@ statusbar_draw(int screen)
return; return;
DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen, DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen,
vscreen.statusbar.width, vscreen.statusbar.height); vscreen.statusbar.width,
vscreen.statusbar.height);
drawrectangle(ctx,
0,
0,
vscreen.statusbar.width,
vscreen.statusbar.height,
True,
vscreen.colors_normal[ColBG]);
for(widget = vscreen.statusbar.widgets; widget; widget = widget->next) for(widget = vscreen.statusbar.widgets; widget; widget = widget->next)
if (widget->alignment == AlignLeft) if (widget->alignment == AlignLeft)
left += widget->draw(widget, ctx, left, (left + right)); left += widget->draw(widget, ctx, left, (left + right));
@ -58,13 +65,22 @@ statusbar_draw(int screen)
if (widget->alignment == AlignFlex) if (widget->alignment == AlignFlex)
left += widget->draw(widget, ctx, left, (left + right)); left += widget->draw(widget, ctx, left, (left + right));
if(vscreen.statusbar.position == BarRight || vscreen.statusbar.position == BarLeft) if(vscreen.statusbar.position == BarRight ||
vscreen.statusbar.position == BarLeft)
{ {
Drawable d; Drawable d;
if(vscreen.statusbar.position == BarRight) if(vscreen.statusbar.position == BarRight)
d = draw_rotate(ctx, phys_screen, M_PI_2, vscreen.statusbar.height, 0); d = draw_rotate(ctx,
phys_screen,
M_PI_2,
vscreen.statusbar.height,
0);
else else
d = draw_rotate(ctx, phys_screen, - M_PI_2, 0, vscreen.statusbar.width); d = draw_rotate(ctx,
phys_screen,
- M_PI_2,
0,
vscreen.statusbar.width);
XCopyArea(globalconf.display, d, XCopyArea(globalconf.display, d,
vscreen.statusbar.window, vscreen.statusbar.window,
DefaultGC(globalconf.display, phys_screen), 0, 0, DefaultGC(globalconf.display, phys_screen), 0, 0,

View file

@ -39,8 +39,8 @@ focustitle_new(Statusbar *statusbar, const char *name)
Widget *w; Widget *w;
w = p_new(Widget, 1); w = p_new(Widget, 1);
w->draw = focustitle_draw; w->draw = focustitle_draw;
common_new(w, statusbar, name);
w->alignment = AlignFlex; w->alignment = AlignFlex;
common_new(w, statusbar, name);
return w; return w;
} }