allow textbox to have special width

This commit is contained in:
Julien Danjou 2007-12-30 14:49:03 +01:00
parent 0eb4743385
commit 75c7d04adf
2 changed files with 6 additions and 1 deletions

View file

@ -517,6 +517,7 @@ config_parse(const char *confpatharg)
static cfg_opt_t widget_textbox_focus_opts[] =
{
CFG_SEC((char *) "mouse", mouse_generic_opts, CFGF_MULTI),
CFG_INT((char *) "width", 0, CFGF_NONE),
CFG_STR((char *) "text", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "fg", (char *) NULL, CFGF_NONE),
CFG_STR((char *) "bg", (char *) NULL, CFGF_NONE),

View file

@ -48,7 +48,9 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset,
{
Data *d = widget->data;
widget->width = textwidth(widget->font, d->text);
if(!widget->width)
widget->width = textwidth(widget->font, d->text);
widget->location = widget_calculate_offset(widget->statusbar->width,
widget->width,
offset,
@ -91,6 +93,8 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
else
d->bg = globalconf.screens[statusbar->screen].colors_normal[ColBG];
w->width = cfg_getint(config, "width");
if((buf = cfg_getstr(config, "font")))
w->font = XftFontOpenName(globalconf.display, get_phys_screen(statusbar->screen), buf);