diff draw.c @ 3:faa4cb9d7bd6

add TASKBAR and CLICK_TO_FOCUS
author paulo@localhost
date Thu, 23 Apr 2009 02:43:13 -0700
parents 7024076fa948
children 0968b3739b8d
line diff
     1.1 --- a/draw.c	Tue Mar 24 12:52:45 2009 -0700
     1.2 +++ b/draw.c	Thu Apr 23 02:43:13 2009 -0700
     1.3 @@ -80,25 +80,31 @@
     1.4  	drawtext(stext, dc.norm);
     1.5  	if((dc.w = dc.x - x) > bh) {
     1.6  		dc.x = x;
     1.7 +		drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm);
     1.8 +	}
     1.9 +	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
    1.10 +
    1.11 +	if (TASKBAR) {
    1.12 +		dc.x = dc.y = 0;
    1.13 +		dc.w = sw;
    1.14  		for(j=0, c = clients; c; c = c->next) {
    1.15  			if(isvisible(c))
    1.16  				j++;
    1.17  		}
    1.18  		if(j && j < MAX_TASKS)
    1.19  			dc.w /= j;
    1.20 -		else {
    1.21 -			drawtext(sel ? sel->name : NULL, sel ? dc.sel : dc.norm);
    1.22 -			j = 0;
    1.23 -		}
    1.24 -		for(c = clients; j && c; c = c->next) {
    1.25 +		else
    1.26 +			drawtext("", dc.norm);
    1.27 +		for(c = clients; j && c && dc.x < sw; c = c->next) {
    1.28  			if(isvisible(c)) {
    1.29  				drawtext(c->name, (c == sel) ? dc.sel : dc.norm);
    1.30  				dc.x += dc.w;
    1.31  				j--;
    1.32  			}
    1.33  		}
    1.34 +		XCopyArea(dpy, dc.drawable, tbarwin, dc.gc, 0, 0, sw, bh, 0, 0);
    1.35  	}
    1.36 -	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0);
    1.37 +
    1.38  	XSync(dpy, False);
    1.39  }
    1.40