avoid DC in drawsquare()
This commit is contained in:
parent
aa645b15ab
commit
2887bb8b86
15
draw.c
15
draw.c
|
@ -69,25 +69,20 @@ drawtext(Display *disp, int screen, int x, int y, int w, int h, GC gc, Drawable
|
|||
}
|
||||
|
||||
void
|
||||
drawsquare(Display *disp, DC drawcontext, Drawable drawable, Bool filled, unsigned long col)
|
||||
drawsquare(Display *disp, int x, int y, int h, GC gc, Drawable drawable, Bool filled, unsigned long col)
|
||||
{
|
||||
int x;
|
||||
XGCValues gcv;
|
||||
XRectangle r = { drawcontext.x, drawcontext.y, drawcontext.w, drawcontext.h };
|
||||
XRectangle r = { x, y, h, h };
|
||||
|
||||
x = (drawcontext.font->ascent + drawcontext.font->descent + 2) / 4;
|
||||
gcv.foreground = col;
|
||||
XChangeGC(disp, drawcontext.gc, GCForeground, &gcv);
|
||||
r.x = drawcontext.x + 1;
|
||||
r.y = drawcontext.y + 1;
|
||||
r.width = r.height = x;
|
||||
XChangeGC(disp, gc, GCForeground, &gcv);
|
||||
if(filled)
|
||||
{
|
||||
r.width++; r.height++;
|
||||
XFillRectangles(disp, drawable, drawcontext.gc, &r, 1);
|
||||
XFillRectangles(disp, drawable, gc, &r, 1);
|
||||
}
|
||||
else
|
||||
XDrawRectangles(disp, drawable, drawcontext.gc, &r, 1);
|
||||
XDrawRectangles(disp, drawable, gc, &r, 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
2
draw.h
2
draw.h
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
void drawsquare(Display *, DC, Drawable, Bool, unsigned long);
|
||||
void drawtext(Display *, int, int, int, int, int, GC, Drawable, XftFont *, const char *, unsigned long *, XColor);
|
||||
void drawsquare(Display *, int, int, int, GC, Drawable, Bool, unsigned long);
|
||||
inline unsigned short textwidth(Display *, XftFont *, char *, ssize_t);
|
||||
#endif
|
||||
|
|
|
@ -61,13 +61,13 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
|
|||
{
|
||||
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->tags[i].name, drawcontext->sel, drawcontext->text_selected);
|
||||
if(isoccupied(i, awesomeconf->screen))
|
||||
drawsquare(disp, *drawcontext, awesomeconf->statusbar.drawable, sel && sel->tags[i], drawcontext->sel[ColFG]);
|
||||
drawsquare(disp, drawcontext->x, drawcontext->y, (drawcontext->font->height + 2) / 4, drawcontext->gc, awesomeconf->statusbar.drawable, sel && sel->tags[i], drawcontext->sel[ColFG]);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->tags[i].name, drawcontext->norm, drawcontext->text_normal);
|
||||
if(isoccupied(i, awesomeconf->screen))
|
||||
drawsquare(disp, *drawcontext, awesomeconf->statusbar.drawable, sel && sel->tags[i], drawcontext->norm[ColFG]);
|
||||
drawsquare(disp, drawcontext->x, drawcontext->y, (drawcontext->font->height + 2) / 4, drawcontext->gc, awesomeconf->statusbar.drawable, sel && sel->tags[i], drawcontext->norm[ColFG]);
|
||||
}
|
||||
drawcontext->x += drawcontext->w;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
|
|||
{
|
||||
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, sel->name, drawcontext->sel, drawcontext->text_selected);
|
||||
if(sel->isfloating)
|
||||
drawsquare(disp, *drawcontext, awesomeconf->statusbar.drawable, sel->ismax, drawcontext->sel[ColFG]);
|
||||
drawsquare(disp, drawcontext->x, drawcontext->y, (drawcontext->font->height + 2) / 4, drawcontext->gc, awesomeconf->statusbar.drawable, sel->ismax, drawcontext->sel[ColFG]);
|
||||
}
|
||||
else if(IS_ARRANGE(layout_tile) || IS_ARRANGE(layout_tileleft))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue