[bar] Regulate size with font...

This commit is contained in:
Martin Duquesnoy
2008-10-10 07:24:47 +02:00
parent 7f16933904
commit e9feae6c5b
2 changed files with 18 additions and 17 deletions

31
wmfs.c
View File

@@ -351,8 +351,8 @@ init(void)
for(i = 0; i < conf.ntag + 1; ++i) for(i = 0; i < conf.ntag + 1; ++i)
tags[i] = conf.tag[i - 1]; tags[i] = conf.tag[i - 1];
/* INIT FONT */ /* INIT FONT
/* make the font string with * make the font string with
* the configuration information */ * the configuration information */
sprintf(fontbuf, "-*-%s-%s-*-%d-*", sprintf(fontbuf, "-*-%s-%s-*-%d-*",
@@ -367,8 +367,8 @@ init(void)
font = XLoadQueryFont(dpy, "*-*-*-*-12-*"); font = XLoadQueryFont(dpy, "*-*-*-*-12-*");
} }
XSetFont(dpy, gc, font->fid); XSetFont(dpy, gc, font->fid);
fonth = (font->ascent + font->descent) - 1; fonth = (font->ascent + font->descent);
barheight = fonth + 3; barheight = fonth + 4;
/* INIT CURSOR */ /* INIT CURSOR */
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
@@ -965,13 +965,6 @@ updatebar(void)
XFillRectangle(dpy, dr, gc, taglen[i]-sp, 0, conf.tagbordwidth, barheight); XFillRectangle(dpy, dr, gc, taglen[i]-sp, 0, conf.tagbordwidth, barheight);
} }
/* Under tag border */
if(conf.tagbordwidth)
XFillRectangle(dpy, dr, gc, 0,
((conf.bartop) ? barheight-1: 0),
taglen[conf.ntag],
1);
/* Layout symbol */ /* Layout symbol */
xprint(dr, taglen[conf.ntag] - sp/2 - 1, fonth, xprint(dr, taglen[conf.ntag] - sp/2 - 1, fonth,
conf.colors.layout_fg, conf.colors.layout_bg, conf.colors.layout_fg, conf.colors.layout_bg,
@@ -982,6 +975,14 @@ updatebar(void)
xprint(dr, mw-k, fonth, conf.colors.text, conf.colors.bar, 0, 0, bartext); xprint(dr, mw-k, fonth, conf.colors.text, conf.colors.bar, 0, 0, bartext);
XDrawLine(dpy, dr, gc, mw-k-5, 0, mw-k-5, barheight); XDrawLine(dpy, dr, gc, mw-k-5, 0, mw-k-5, barheight);
/* Bar border */
if(conf.tagbordwidth)
{
XSetForeground(dpy, gc, conf.colors.tagbord);
XFillRectangle(dpy, dr, gc, 0,
((conf.bartop) ? barheight-1: 0), mw, 1);
}
XCopyArea(dpy, dr, bar, gc, 0, 0, mw, barheight, 0, 0); XCopyArea(dpy, dr, bar, gc, 0, 0, mw, barheight, 0, 0);
XSync(dpy, False); XSync(dpy, False);
@@ -998,7 +999,6 @@ updatebutton(Bool c)
{ {
int i, j, x, pm = 0; int i, j, x, pm = 0;
int y = 3, h = barheight - 5; int y = 3, h = barheight - 5;
int fonth_l = fonth - 3;
XSetWindowAttributes at; XSetWindowAttributes at;
at.override_redirect = 1; at.override_redirect = 1;
@@ -1027,7 +1027,7 @@ updatebutton(Bool c)
CWOverrideRedirect | CWBackPixmap | CWEventMask, &at); CWOverrideRedirect | CWBackPixmap | CWEventMask, &at);
XSetWindowBackground(dpy, conf.barbutton[i].win, conf.barbutton[i].bg_color); XSetWindowBackground(dpy, conf.barbutton[i].win, conf.barbutton[i].bg_color);
XMapRaised(dpy, conf.barbutton[i].win); XMapRaised(dpy, conf.barbutton[i].win);
xprint(conf.barbutton[i].win, 1, fonth_l, conf.barbutton[i].fg_color, xprint(conf.barbutton[i].win, 1, (fonth - 3), conf.barbutton[i].fg_color,
conf.barbutton[i].bg_color, 0, 0, conf.barbutton[i].text); conf.barbutton[i].bg_color, 0, 0, conf.barbutton[i].text);
} }
else else
@@ -1035,7 +1035,7 @@ updatebutton(Bool c)
if(!conf.barbutton[i].win) if(!conf.barbutton[i].win)
return; return;
XMoveWindow(dpy, conf.barbutton[i].win, x, y); XMoveWindow(dpy, conf.barbutton[i].win, x, y);
xprint(conf.barbutton[i].win, 1, fonth_l, conf.barbutton[i].fg_color, xprint(conf.barbutton[i].win, 1, (fonth - 3), conf.barbutton[i].fg_color,
conf.barbutton[i].bg_color, 0, 0, conf.barbutton[i].text); conf.barbutton[i].bg_color, 0, 0, conf.barbutton[i].text);
} }
} }
@@ -1070,10 +1070,11 @@ updatetitle(Client *c)
if(conf.ttbarheight > 10) if(conf.ttbarheight > 10)
{ {
XClearWindow(dpy, c->tbar); XClearWindow(dpy, c->tbar);
xprint(c->tbar, 3, ((fonth-2) + ((conf.ttbarheight - fonth) / 2)), xprint(c->tbar, 3, ((fonth - 3) + ((conf.ttbarheight - fonth) / 2)),
((c == sel) ? conf.colors.ttbar_text_focus : conf.colors.ttbar_text_normal), ((c == sel) ? conf.colors.ttbar_text_focus : conf.colors.ttbar_text_normal),
conf.colors.bar, 0, 0, c->title); conf.colors.bar, 0, 0, c->title);
} }
return; return;
} }

4
wmfsrc
View File

@@ -12,7 +12,7 @@ misc
raiseswitch = true raiseswitch = true
border_height = 1 border_height = 1
titlebar_height = 12 titlebar_height = 12
tag_border_width = 0 tag_border_width = 1
} }
font font
@@ -38,7 +38,7 @@ colors
#Tag #Tag
tag_sel_fg = "#191919" tag_sel_fg = "#191919"
tag_sel_bg = "#7E89A2" tag_sel_bg = "#7E89A2"
tag_border = "#191919" tag_border = "#3F485E"
#Layout #Layout
layout_fg = "#191919" layout_fg = "#191919"