dwm-meillo

diff draw.c @ 75:f08271b7cb20

rearranged several stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Sat, 15 Jul 2006 16:30:50 +0200
parents 5370ef170cc9
children 4bd49f404f10
line diff
     1.1 --- a/draw.c	Fri Jul 14 22:54:09 2006 +0200
     1.2 +++ b/draw.c	Sat Jul 15 16:30:50 2006 +0200
     1.3 @@ -11,33 +11,42 @@
     1.4  #include "dwm.h"
     1.5  
     1.6  void
     1.7 +drawall()
     1.8 +{
     1.9 +	Client *c;
    1.10 +
    1.11 +	for(c = clients; c; c = getnext(c->next))
    1.12 +		drawtitle(c);
    1.13 +	drawstatus();
    1.14 +}
    1.15 +
    1.16 +void
    1.17  drawstatus()
    1.18  {
    1.19  	int i;
    1.20 +	Bool istile = arrange == dotile;
    1.21  
    1.22  	dc.x = dc.y = 0;
    1.23  	dc.w = bw;
    1.24 -	drawtext(NULL, False, False);
    1.25 +	drawtext(NULL, !istile, False);
    1.26  
    1.27 -	if(arrange == floating) {
    1.28 -		dc.w = textw("~");
    1.29 -		drawtext("~", False, False);
    1.30 -	}
    1.31 -	else
    1.32 -		dc.w = 0;
    1.33 +	dc.w = 0;
    1.34  	for(i = 0; i < TLast; i++) {
    1.35  		dc.x += dc.w;
    1.36  		dc.w = textw(tags[i]);
    1.37 -		drawtext(tags[i], i == tsel, True);
    1.38 +		if(istile)
    1.39 +			drawtext(tags[i], (i == tsel), True);
    1.40 +		else
    1.41 +			drawtext(tags[i], (i != tsel), True);
    1.42  	}
    1.43  	if(sel) {
    1.44  		dc.x += dc.w;
    1.45  		dc.w = textw(sel->name);
    1.46 -		drawtext(sel->name, True, True);
    1.47 +		drawtext(sel->name, istile, True);
    1.48  	}
    1.49  	dc.w = textw(stext);
    1.50  	dc.x = bx + bw - dc.w;
    1.51 -	drawtext(stext, False, False);
    1.52 +	drawtext(stext, !istile, False);
    1.53  
    1.54  	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    1.55  	XFlush(dpy);
    1.56 @@ -47,6 +56,8 @@
    1.57  drawtitle(Client *c)
    1.58  {
    1.59  	int i;
    1.60 +	Bool istile = arrange == dotile;
    1.61 +
    1.62  	if(c == sel) {
    1.63  		drawstatus();
    1.64  		XUnmapWindow(dpy, c->title);
    1.65 @@ -64,12 +75,12 @@
    1.66  		if(c->tags[i]) {
    1.67  			dc.x += dc.w;
    1.68  			dc.w = textw(c->tags[i]);
    1.69 -			drawtext(c->tags[i], False, True);
    1.70 +			drawtext(c->tags[i], !istile, True);
    1.71  		}
    1.72  	}
    1.73  	dc.x += dc.w;
    1.74  	dc.w = textw(c->name);
    1.75 -	drawtext(c->name, False, True);
    1.76 +	drawtext(c->name, !istile, True);
    1.77  	XCopyArea(dpy, dc.drawable, c->title, dc.gc,
    1.78  			0, 0, c->tw, c->th, 0, 0);
    1.79  	XFlush(dpy);
    1.80 @@ -215,7 +226,7 @@
    1.81  		if (!dc.font.xfont)
    1.82  			dc.font.xfont = XLoadQueryFont(dpy, "fixed");
    1.83  		if (!dc.font.xfont)
    1.84 -			error("error, cannot init 'fixed' font\n");
    1.85 +			eprint("error, cannot init 'fixed' font\n");
    1.86  		dc.font.ascent = dc.font.xfont->ascent;
    1.87  		dc.font.descent = dc.font.xfont->descent;
    1.88  	}