aewl

changeset 572:427708bf5f36

added a similiar patch to Daves solution to indicate if there are clients with a specific tag
author arg@mig29
date Wed, 22 Nov 2006 14:57:09 +0100
parents f0688a69f17f
children 797e27162b43
files draw.c
diffstat 1 files changed, 24 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/draw.c	Tue Nov 21 15:03:08 2006 +0100
     1.2 +++ b/draw.c	Wed Nov 22 14:57:09 2006 +0100
     1.3 @@ -8,6 +8,16 @@
     1.4  
     1.5  /* static */
     1.6  
     1.7 +static Bool
     1.8 +isoccupied(unsigned int t)
     1.9 +{
    1.10 +	Client *c;
    1.11 +	for(c = clients; c; c = c->next)
    1.12 +		if(c->tags[t])
    1.13 +			return True;
    1.14 +	return False;
    1.15 +}
    1.16 +
    1.17  static unsigned int
    1.18  textnw(const char *text, unsigned int len) {
    1.19  	XRectangle r;
    1.20 @@ -20,7 +30,7 @@
    1.21  }
    1.22  
    1.23  static void
    1.24 -drawtext(const char *text, unsigned long col[ColLast], Bool highlight) {
    1.25 +drawtext(const char *text, unsigned long col[ColLast], Bool ldot, Bool rdot) {
    1.26  	int x, y, w, h;
    1.27  	static char buf[256];
    1.28  	unsigned int len, olen;
    1.29 @@ -63,12 +73,18 @@
    1.30  		XChangeGC(dpy, dc.gc, GCForeground | GCFont, &gcv);
    1.31  		XDrawString(dpy, dc.drawable, dc.gc, x, y, buf, len);
    1.32  	}
    1.33 -	if(highlight) {
    1.34 +	if(ldot) {
    1.35  		r.x = dc.x + 2;
    1.36  		r.y = dc.y + 2;
    1.37  		r.width = r.height = (h + 2) / 4;
    1.38  		XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    1.39  	}
    1.40 +	if(rdot) {
    1.41 +		r.width = r.height = (h + 2) / 4;
    1.42 +		r.x = dc.x + dc.w - r.width - 2;
    1.43 +		r.y = dc.y + dc.h - r.height - 2;
    1.44 +		XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    1.45 +	}
    1.46  }
    1.47  
    1.48  /* extern */
    1.49 @@ -90,13 +106,13 @@
    1.50  	for(i = 0; i < ntags; i++) {
    1.51  		dc.w = textw(tags[i]);
    1.52  		if(seltag[i])
    1.53 -			drawtext(tags[i], dc.sel, sel && sel->tags[i]);
    1.54 +			drawtext(tags[i], dc.sel, sel && sel->tags[i], isoccupied(i));
    1.55  		else
    1.56 -			drawtext(tags[i], dc.norm, sel && sel->tags[i]);
    1.57 +			drawtext(tags[i], dc.norm, sel && sel->tags[i], isoccupied(i));
    1.58  		dc.x += dc.w;
    1.59  	}
    1.60  	dc.w = bmw;
    1.61 -	drawtext(arrange == dofloat ?  FLOATSYMBOL : TILESYMBOL, dc.status, False);
    1.62 +	drawtext(arrange == dofloat ?  FLOATSYMBOL : TILESYMBOL, dc.status, False, False);
    1.63  	x = dc.x + dc.w;
    1.64  	dc.w = textw(stext);
    1.65  	dc.x = bw - dc.w;
    1.66 @@ -104,10 +120,10 @@
    1.67  		dc.x = x;
    1.68  		dc.w = bw - x;
    1.69  	}
    1.70 -	drawtext(stext, dc.status, False);
    1.71 +	drawtext(stext, dc.status, False, False);
    1.72  	if((dc.w = dc.x - x) > bh) {
    1.73  		dc.x = x;
    1.74 -		drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False);
    1.75 +		drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm, False, False);
    1.76  	}
    1.77  	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    1.78  	XSync(dpy, False);
    1.79 @@ -125,7 +141,7 @@
    1.80  	XMapWindow(dpy, c->twin);
    1.81  	dc.x = dc.y = 0;
    1.82  	dc.w = c->tw;
    1.83 -	drawtext(c->name, dc.norm, False);
    1.84 +	drawtext(c->name, dc.norm, False,False);
    1.85  	XCopyArea(dpy, dc.drawable, c->twin, dc.gc, 0, 0, c->tw, c->th, 0, 0);
    1.86  	XSync(dpy, False);
    1.87  }