Add support for text_align option in titlebars

This commit is contained in:
Julien Danjou 2008-03-15 11:13:45 +01:00
parent 74777016af
commit bc6656320d
5 changed files with 7 additions and 4 deletions

View File

@ -543,7 +543,7 @@ Note: when there is no whitespace, quotes are optional.
{ font = <font> fg = <color> bg = <color> border = <color>
shadow = <color> shadow_offset = <integer> }
<titlebar> -> a section with position and icon position.
{ position = <position> icon = <position> }
{ position = <position> icon = <position> text_align = <{center,right,left}> }
[MULTI] means, you can use an item multiple times.

View File

@ -157,7 +157,7 @@ client_updatetitlebar(Client *c)
geometry = c->titlebar.sw->geometry;
geometry.x = geometry.y = 0;
draw_text(ctx, geometry, AlignCenter, 0,
draw_text(ctx, geometry, c->titlebar.text_align, style.font->height / 2,
c->name, style);
simplewindow_refresh_drawable(c->titlebar.sw, phys_screen);
@ -358,7 +358,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
ewmh_check_client_hints(c);
/* default titlebar position */
c->titlebar.position = globalconf.screens[screen].titlebar_default.position;
c->titlebar = globalconf.screens[screen].titlebar_default;
/* First check clients hints */
ewmh_check_client_hints(c);
@ -398,7 +398,7 @@ client_manage(Window w, XWindowAttributes *wa, int screen)
}
if(rule && rule->titlebar.position != Auto)
c->titlebar.position = rule->titlebar.position;
c->titlebar = rule->titlebar;
switch(c->titlebar.position)
{

View File

@ -70,6 +70,7 @@ cfg_awesome_include(cfg_t *cfg, cfg_opt_t *opt,
cfg_opt_t titlebar_opts[] =
{
CFG_STR((char *) "position", (char *) "auto", CFGF_NONE),
CFG_STR((char *) "text_align", (char *) "center", CFGF_NONE),
CFG_STR((char *) "icon", (char *) "left", CFGF_NONE),
CFG_AWESOME_END()
};

View File

@ -277,6 +277,7 @@ config_section_titlebar_init(cfg_t *cfg_titlebar, Titlebar *tb)
{
tb->position = position_get_from_str(cfg_getstr(cfg_titlebar, "position"));
tb->icon = position_get_from_str(cfg_getstr(cfg_titlebar, "icon"));
tb->text_align = draw_get_align(cfg_getstr(cfg_titlebar, "text_align"));
}
static void

View File

@ -44,6 +44,7 @@ typedef struct
{
SimpleWindow *sw;
Position position;
Alignment text_align;
Position icon;
} Titlebar;