simplify drawsquare()

This commit is contained in:
Julien Danjou 2007-09-19 15:42:40 +02:00
parent 007ddef76b
commit ce367ebfba
3 changed files with 6 additions and 6 deletions

4
draw.c
View File

@ -70,13 +70,13 @@ drawtext(Display *disp, DC drawcontext, Drawable drawable, const char *text, uns
}
void
drawsquare(Display *disp, DC drawcontext, Bool filled, Bool empty, unsigned long col[ColLast], Statusbar *statusbar)
drawsquare(Display *disp, DC drawcontext, Bool filled, Bool empty, unsigned long col, Statusbar *statusbar)
{
int x;
XGCValues gcv;
XRectangle r = { drawcontext.x, drawcontext.y, drawcontext.w, drawcontext.h };
gcv.foreground = col[ColFG];
gcv.foreground = col;
XChangeGC(disp, drawcontext.gc, GCForeground, &gcv);
x = (drawcontext.font.ascent + drawcontext.font.descent + 2) / 4;
r.x = drawcontext.x + 1;

2
draw.h
View File

@ -26,7 +26,7 @@
#define textw(set, xfont, text, height) (textnw(set, xfont, text, a_strlen(text)) + height)
void drawsquare(Display *, DC, Bool, Bool, unsigned long *, Statusbar *);
void drawsquare(Display *, DC, Bool, Bool, unsigned long, Statusbar *);
void drawtext(Display *, DC, Drawable, const char *, unsigned long *);
unsigned int textnw(XFontSet, XFontStruct *, const char *, unsigned int);

View File

@ -55,12 +55,12 @@ drawstatusbar(Display *disp, int screen, DC *drawcontext, awesome_config * aweso
if(awesomeconf->selected_tags[i])
{
drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i], drawcontext->sel);
drawsquare(disp, *drawcontext, sel && sel->tags[i], isoccupied(i, screen), drawcontext->sel, &awesomeconf->statusbar);
drawsquare(disp, *drawcontext, sel && sel->tags[i], isoccupied(i, screen), drawcontext->sel[ColFG], &awesomeconf->statusbar);
}
else
{
drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, awesomeconf->tags[i], drawcontext->norm);
drawsquare(disp, *drawcontext, sel && sel->tags[i], isoccupied(i, screen), drawcontext->norm, &awesomeconf->statusbar);
drawsquare(disp, *drawcontext, sel && sel->tags[i], isoccupied(i, screen), drawcontext->norm[ColFG], &awesomeconf->statusbar);
}
drawcontext->x += drawcontext->w;
}
@ -81,7 +81,7 @@ drawstatusbar(Display *disp, int screen, DC *drawcontext, awesome_config * aweso
if(sel)
{
drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, sel->name, drawcontext->sel);
drawsquare(disp, *drawcontext, sel->ismax, sel->isfloating, drawcontext->sel, &awesomeconf->statusbar);
drawsquare(disp, *drawcontext, sel->ismax, sel->isfloating, drawcontext->sel[ColFG], &awesomeconf->statusbar);
}
else
drawtext(disp, *drawcontext, awesomeconf->statusbar.drawable, NULL, drawcontext->norm);