From 5715b70ab3fafc45ad599f0b33b5fb7458d7c891 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 16 Dec 2007 19:44:40 +1100 Subject: [PATCH] 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. --- statusbar.c | 26 +++++++++++++++++++++----- widgets/focustitle.c | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/statusbar.c b/statusbar.c index db2f2744..89751a70 100644 --- a/statusbar.c +++ b/statusbar.c @@ -46,8 +46,15 @@ statusbar_draw(int screen) return; 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) if (widget->alignment == AlignLeft) left += widget->draw(widget, ctx, left, (left + right)); @@ -58,13 +65,22 @@ statusbar_draw(int screen) if (widget->alignment == AlignFlex) 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; 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 - 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, vscreen.statusbar.window, DefaultGC(globalconf.display, phys_screen), 0, 0, diff --git a/widgets/focustitle.c b/widgets/focustitle.c index 08dab7a4..6be53c05 100644 --- a/widgets/focustitle.c +++ b/widgets/focustitle.c @@ -39,8 +39,8 @@ focustitle_new(Statusbar *statusbar, const char *name) Widget *w; w = p_new(Widget, 1); w->draw = focustitle_draw; - common_new(w, statusbar, name); w->alignment = AlignFlex; + common_new(w, statusbar, name); return w; }