From ec53f3d070b28cc928ff6ce63dcecb4b9d7bed16 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 3 Jan 2008 16:02:41 +0100 Subject: [PATCH] add align option to textbox --- config.c | 1 + widgets/textbox.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index d0d1cd3cd..ae9413dec 100644 --- a/config.c +++ b/config.c @@ -534,6 +534,7 @@ config_parse(const char *confpatharg) CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE), CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE), CFG_STR((char *) "font", (char *) NULL, CFGF_NONE), + CFG_STR((char *) "align", (char *) "center", CFGF_NONE), CFG_END() }; static cfg_opt_t widget_focustitle_opts[] = diff --git a/widgets/textbox.c b/widgets/textbox.c index 030a72cce..d8a3ab570 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -30,6 +30,7 @@ typedef struct { char *text; int width; + int align; XColor fg; XColor bg; } Data; @@ -51,7 +52,7 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset, widget->alignment); draw_text(ctx, widget->location, 0, widget->width, widget->statusbar->height, - AlignCenter, 0, widget->font, d->text, d->fg, d->bg); + d->align, 0, widget->font, d->text, d->fg, d->bg); return widget->width; } @@ -90,6 +91,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config) d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG]; d->width = cfg_getint(config, "width"); + d->align = draw_get_align(cfg_getstr(config, "align")); if((buf = cfg_getstr(config, "font"))) w->font = XftFontOpenName(globalconf.display, get_phys_screen(statusbar->screen), buf);