[awesome-menu] Add support for empty prompt

This commit is contained in:
Julien Danjou 2008-03-09 16:02:21 +01:00
parent 1fb61f54df
commit a5f0df0c95

View file

@ -144,7 +144,7 @@ config_parse(const char *confpatharg, const char *menu_title, Area *geometry)
if(ret) if(ret)
return ret; return ret;
if(!(cfg_menu = cfg_gettsec(cfg, "menu", menu_title))) if(menu_title && !(cfg_menu = cfg_gettsec(cfg, "menu", menu_title)))
warn("no definition for menu %s in configuration file: using default\n", menu_title); warn("no definition for menu %s in configuration file: using default\n", menu_title);
/* get global screen section */ /* get global screen section */
@ -353,14 +353,17 @@ redraw(void)
geometry.width = globalconf.sw->geometry.width; geometry.width = globalconf.sw->geometry.width;
geometry.height = globalconf.sw->geometry.height; geometry.height = globalconf.sw->geometry.height;
draw_text(globalconf.ctx, geometry, AlignLeft, if(a_strlen(globalconf.prompt))
MARGIN, globalconf.font, globalconf.prompt, {
globalconf.shadow_offset, draw_text(globalconf.ctx, geometry, AlignLeft,
globalconf.fg_focus, globalconf.bg_focus); MARGIN, globalconf.font, globalconf.prompt,
globalconf.shadow_offset,
globalconf.fg_focus, globalconf.bg_focus);
len = MARGIN * 2 + draw_textwidth(globalconf.display, globalconf.font, globalconf.prompt); len = MARGIN * 2 + draw_textwidth(globalconf.display, globalconf.font, globalconf.prompt);
geometry.x += len; geometry.x += len;
geometry.width -= len; geometry.width -= len;
}
draw_text(globalconf.ctx, geometry, AlignLeft, draw_text(globalconf.ctx, geometry, AlignLeft,
MARGIN, globalconf.font, globalconf.text, MARGIN, globalconf.font, globalconf.text,