removed a bunch of lines through swap removal

new_dwm
Anselm R. Garbe 19 years ago
parent 5b44976a2d
commit e7fa504c3e

16
bar.c

@ -25,30 +25,22 @@ draw_bar()
int i; int i;
dc.x = dc.y = 0; dc.x = dc.y = 0;
dc.w = bw; dc.w = bw;
drawtext(NULL, False); drawtext(NULL, False, False);
dc.w = 0; dc.w = 0;
for(i = 0; i < TLast; i++) { for(i = 0; i < TLast; i++) {
dc.x += dc.w; dc.x += dc.w;
dc.w = textw(tags[i]) + dc.font.height; dc.w = textw(tags[i]) + dc.font.height;
if(i == tsel) { drawtext(tags[i], i == tsel, True);
swap((void **)&dc.fg, (void **)&dc.bg);
drawtext(tags[i], True);
swap((void **)&dc.fg, (void **)&dc.bg);
}
else
drawtext(tags[i], True);
} }
if(sel) { if(sel) {
swap((void **)&dc.fg, (void **)&dc.bg);
dc.x += dc.w; dc.x += dc.w;
dc.w = textw(sel->name) + dc.font.height; dc.w = textw(sel->name) + dc.font.height;
drawtext(sel->name, True); drawtext(sel->name, True, True);
swap((void **)&dc.fg, (void **)&dc.bg);
} }
dc.w = textw(stext) + dc.font.height; dc.w = textw(stext) + dc.font.height;
dc.x = bx + bw - dc.w; dc.x = bx + bw - dc.w;
drawtext(stext, False); drawtext(stext, False, False);
XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0); XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
XFlush(dpy); XFlush(dpy);
} }

@ -598,12 +598,12 @@ draw_client(Client *c)
if(c->tags[i]) { if(c->tags[i]) {
dc.x += dc.w; dc.x += dc.w;
dc.w = textw(c->tags[i]) + dc.font.height; dc.w = textw(c->tags[i]) + dc.font.height;
drawtext(c->tags[i], True); drawtext(c->tags[i], False, True);
} }
} }
dc.x += dc.w; dc.x += dc.w;
dc.w = textw(c->name) + dc.font.height; dc.w = textw(c->name) + dc.font.height;
drawtext(c->name, True); drawtext(c->name, False, True);
XCopyArea(dpy, dc.drawable, c->title, dc.gc, XCopyArea(dpy, dc.drawable, c->title, dc.gc,
0, 0, c->tw, c->th, 0, 0); 0, 0, c->tw, c->th, 0, 0);
XFlush(dpy); XFlush(dpy);

@ -30,7 +30,7 @@ drawborder(void)
} }
void void
drawtext(const char *text, Bool border) drawtext(const char *text, Bool invert, Bool border)
{ {
int x, y, w, h; int x, y, w, h;
unsigned int len; unsigned int len;
@ -38,7 +38,7 @@ drawtext(const char *text, Bool border)
XGCValues gcv; XGCValues gcv;
XRectangle r = { dc.x, dc.y, dc.w, dc.h }; XRectangle r = { dc.x, dc.y, dc.w, dc.h };
XSetForeground(dpy, dc.gc, dc.bg); XSetForeground(dpy, dc.gc, invert ? dc.fg : dc.bg);
XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
w = 0; w = 0;
@ -65,8 +65,8 @@ drawtext(const char *text, Bool border)
if(w > dc.w) if(w > dc.w)
return; /* too long */ return; /* too long */
gcv.foreground = dc.fg; gcv.foreground = invert ? dc.bg : dc.fg;
gcv.background = dc.bg; gcv.background = invert ? dc.fg : dc.bg;
if(dc.font.set) { if(dc.font.set) {
XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv); XChangeGC(dpy, dc.gc, GCForeground | GCBackground, &gcv);
XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc, XmbDrawImageString(dpy, dc.drawable, dc.font.set, dc.gc,

@ -130,7 +130,7 @@ extern void zoom(Arg *arg);
extern void gravitate(Client *c, Bool invert); extern void gravitate(Client *c, Bool invert);
/* draw.c */ /* draw.c */
extern void drawtext(const char *text, Bool border); extern void drawtext(const char *text, Bool invert, Bool border);
extern unsigned long initcolor(const char *colstr); extern unsigned long initcolor(const char *colstr);
extern void initfont(const char *fontstr); extern void initfont(const char *fontstr);
extern unsigned int textnw(char *text, unsigned int len); extern unsigned int textnw(char *text, unsigned int len);
@ -153,4 +153,3 @@ extern void quit(Arg *arg);
extern void error(const char *errstr, ...); extern void error(const char *errstr, ...);
extern void *emallocz(unsigned int size); extern void *emallocz(unsigned int size);
extern void spawn(Arg *arg); extern void spawn(Arg *arg);
extern void swap(void **p1, void **p2);

@ -38,14 +38,6 @@ emallocz(unsigned int size)
return res; return res;
} }
void
swap(void **p1, void **p2)
{
void *tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
void void
spawn(Arg *arg) spawn(Arg *arg)
{ {

Loading…
Cancel
Save