remove h attribute of drawcontext

This commit is contained in:
Julien Danjou 2007-10-09 22:29:44 +02:00
parent 2cc1d24c8c
commit c4b1867a4d
3 changed files with 9 additions and 9 deletions

View File

@ -203,7 +203,7 @@ setup(DC *drawcontext, awesome_config *awesomeconf)
compileregs(awesomeconf->rules, awesomeconf->nrules); compileregs(awesomeconf->rules, awesomeconf->nrules);
/* bar */ /* bar */
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font->height + 2; awesomeconf->statusbar.height = drawcontext->font->height + 2;
initstatusbar(awesomeconf->display, awesomeconf->screen, drawcontext, &awesomeconf->statusbar); initstatusbar(awesomeconf->display, awesomeconf->screen, drawcontext, &awesomeconf->statusbar);
drawcontext->gc = XCreateGC(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), 0, 0); drawcontext->gc = XCreateGC(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), 0, 0);
XSetLineAttributes(awesomeconf->display, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter); XSetLineAttributes(awesomeconf->display, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);

View File

@ -39,7 +39,7 @@ enum
typedef struct typedef struct
{ {
int x, y, w, h; int x, y, w;
unsigned long norm[ColLast]; unsigned long norm[ColLast];
unsigned long sel[ColLast]; unsigned long sel[ColLast];
XColor text_normal; XColor text_normal;

View File

@ -59,20 +59,20 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->tags[i].name, a_strlen(awesomeconf->tags[i].name)) + drawcontext->font->height; drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->tags[i].name, a_strlen(awesomeconf->tags[i].name)) + drawcontext->font->height;
if(awesomeconf->tags[i].selected) if(awesomeconf->tags[i].selected)
{ {
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); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->tags[i].name, drawcontext->sel, drawcontext->text_selected);
if(isoccupied(i, awesomeconf->screen)) if(isoccupied(i, awesomeconf->screen))
drawsquare(disp, drawcontext->x, drawcontext->y, (drawcontext->font->height + 2) / 4, drawcontext->gc, 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 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); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->tags[i].name, drawcontext->norm, drawcontext->text_normal);
if(isoccupied(i, awesomeconf->screen)) if(isoccupied(i, awesomeconf->screen))
drawsquare(disp, drawcontext->x, drawcontext->y, (drawcontext->font->height + 2) / 4, drawcontext->gc, 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; drawcontext->x += drawcontext->w;
} }
drawcontext->w = awesomeconf->statusbar.width; drawcontext->w = awesomeconf->statusbar.width;
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->current_layout->symbol, drawcontext->norm, drawcontext->text_normal); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->current_layout->symbol, drawcontext->norm, drawcontext->text_normal);
x = drawcontext->x + drawcontext->w; x = drawcontext->x + drawcontext->w;
drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->statustext, a_strlen(awesomeconf->statustext)) + drawcontext->font->height; drawcontext->w = textwidth(disp, drawcontext->font, awesomeconf->statustext, a_strlen(awesomeconf->statustext)) + drawcontext->font->height;
drawcontext->x = si[awesomeconf->screen].width - drawcontext->w; drawcontext->x = si[awesomeconf->screen].width - drawcontext->w;
@ -81,13 +81,13 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
drawcontext->x = x; drawcontext->x = x;
drawcontext->w = si[awesomeconf->screen].width - x; drawcontext->w = si[awesomeconf->screen].width - x;
} }
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->statustext, drawcontext->norm, drawcontext->text_normal); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, awesomeconf->statustext, drawcontext->norm, drawcontext->text_normal);
if((drawcontext->w = drawcontext->x - x) > awesomeconf->statusbar.height) if((drawcontext->w = drawcontext->x - x) > awesomeconf->statusbar.height)
{ {
drawcontext->x = x; drawcontext->x = x;
if(sel) if(sel)
{ {
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); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, sel->name, drawcontext->sel, drawcontext->text_selected);
if(sel->isfloating) if(sel->isfloating)
drawsquare(disp, drawcontext->x, drawcontext->y, (drawcontext->font->height + 2) / 4, drawcontext->gc, 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]);
} }
@ -95,10 +95,10 @@ drawstatusbar(Display *disp, DC *drawcontext, awesome_config * awesomeconf)
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact); snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact);
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, buf, drawcontext->norm, drawcontext->text_normal); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, buf, drawcontext->norm, drawcontext->text_normal);
} }
else else
drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, drawcontext->h, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, NULL, drawcontext->norm, drawcontext->text_normal); drawtext(disp, awesomeconf->phys_screen, drawcontext->x, drawcontext->y, drawcontext->w, awesomeconf->statusbar.height, drawcontext->gc, awesomeconf->statusbar.drawable, drawcontext->font, NULL, drawcontext->norm, drawcontext->text_normal);
} }
XCopyArea(disp, awesomeconf->statusbar.drawable, awesomeconf->statusbar.window, drawcontext->gc, 0, 0, si[awesomeconf->screen].width, awesomeconf->statusbar.height, 0, 0); XCopyArea(disp, awesomeconf->statusbar.drawable, awesomeconf->statusbar.window, drawcontext->gc, 0, 0, si[awesomeconf->screen].width, awesomeconf->statusbar.height, 0, 0);
XSync(disp, False); XSync(disp, False);