nicer frame drawing

This commit is contained in:
Denis Grelich 2006-12-24 21:35:23 +01:00
parent 33ad150558
commit babe3af6e2
3 changed files with 15 additions and 5 deletions

16
draw.c
View File

@ -74,7 +74,13 @@ labelh(BlitzFont *font) {
void
draw_tile(BlitzBrush *b) {
drawbg(b->blitz->dpy, b->drawable, b->gc, b->rect,
b->color, b->border);
b->color, True, b->border);
}
void
draw_border(BlitzBrush *b) {
drawbg(b->blitz->dpy, b->drawable, b->gc, b->rect,
b->color, False, True);
}
void
@ -132,11 +138,13 @@ draw_label(BlitzBrush *b, char *text) {
void
drawbg(Display *dpy, Drawable drawable, GC gc, XRectangle rect,
BlitzColor c, Bool border)
BlitzColor c, Bool fill, Bool border)
{
XPoint points[5];
XSetForeground(dpy, gc, c.bg);
XFillRectangles(dpy, drawable, gc, &rect, 1);
if(fill) {
XSetForeground(dpy, gc, c.bg);
XFillRectangles(dpy, drawable, gc, &rect, 1);
}
if(!border)
return;
XSetLineAttributes(dpy, gc, 1, LineSolid, CapButt, JoinMiter);

View File

@ -85,6 +85,7 @@ draw_frame(Frame *f) {
draw_tile(&f->tile);
draw_tile(&f->grabbox);
draw_label(&f->titlebar, f->client->name);
draw_border(&f->tile);
XCopyArea(blz.dpy, pmap, f->client->framewin, f->client->gc,
0, 0, f->rect.width, f->rect.height, 0, 0);
XSync(blz.dpy, False);

3
wmii.h
View File

@ -297,9 +297,10 @@ extern Area *new_column(View *v, Area *pos, unsigned int w);
extern int loadcolor(Blitz *blitz, BlitzColor *c);
extern void draw_label(BlitzBrush *b, char *text);
extern void draw_tile(BlitzBrush *b);
extern void draw_rect(BlitzBrush *b);
extern void drawbg(Display *dpy, Drawable drawable, GC gc,
XRectangle rect, BlitzColor c, Bool border);
XRectangle rect, BlitzColor c, Bool fill, Bool border);
extern void drawcursor(Display *dpy, Drawable drawable, GC gc,
int x, int y, unsigned int h, BlitzColor c);
extern unsigned int textwidth(BlitzFont *font, char *text);