aewl

diff draw.c @ 124:75576e44c1d8

made status bar drawing more robust, implemented togglemax and togglemode, works quite well
author arg@10ksloc.org
date Thu, 20 Jul 2006 15:07:35 +0200
parents 61490330e90a
children 9b9deafa0508
line diff
     1.1 --- a/draw.c	Thu Jul 20 12:18:06 2006 +0200
     1.2 +++ b/draw.c	Thu Jul 20 15:07:35 2006 +0200
     1.3 @@ -107,7 +107,7 @@
     1.4  void
     1.5  drawstatus()
     1.6  {
     1.7 -	int i;
     1.8 +	int i, x;
     1.9  	Bool istile = arrange == dotile;
    1.10  
    1.11  	dc.x = dc.y = 0;
    1.12 @@ -123,15 +123,14 @@
    1.13  		else
    1.14  			drawtext(tags[i], (i != tsel), True);
    1.15  	}
    1.16 -	if(sel) {
    1.17 -		dc.x += dc.w;
    1.18 -		dc.w = textw(sel->name);
    1.19 -		drawtext(sel->name, istile, True);
    1.20 -	}
    1.21 +	x = dc.x + dc.w;
    1.22  	dc.w = textw(stext);
    1.23  	dc.x = bx + bw - dc.w;
    1.24  	drawtext(stext, !istile, False);
    1.25 -
    1.26 +	if(sel && ((dc.w = dc.x - x) >= bh)) {
    1.27 +		dc.x = x;
    1.28 +		drawtext(sel->name, istile, True);
    1.29 +	}
    1.30  	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    1.31  	XSync(dpy, False);
    1.32  }