dwm-meillo

diff client.c @ 57:f005d46462e8

implemented bar for dwm (I miss status text), I plan that status text is read from stdin in dwm
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 10:07:38 +0200
parents fcbf7213d96f
children 24f9c674d03f
line diff
     1.1 --- a/client.c	Fri Jul 14 08:45:30 2006 +0200
     1.2 +++ b/client.c	Fri Jul 14 10:07:38 2006 +0200
     1.3 @@ -49,9 +49,9 @@
     1.4  	if(!sel)
     1.5  		return;
     1.6  	sel->x = sx;
     1.7 -	sel->y = sy;
     1.8 +	sel->y = sy + bh;
     1.9  	sel->w = sw - 2 * sel->border;
    1.10 -	sel->h = sh - 2 * sel->border;
    1.11 +	sel->h = sh - 2 * sel->border - bh;
    1.12  	craise(sel);
    1.13  	resize(sel, False);
    1.14  	discard_events(EnterWindowMask);
    1.15 @@ -67,6 +67,7 @@
    1.16  
    1.17  	for(c = clients; c; c = next(c->next))
    1.18  		draw_client(c);
    1.19 +	draw_bar();
    1.20  }
    1.21  
    1.22  void
    1.23 @@ -131,7 +132,10 @@
    1.24  		if(c->tags[tsel] && !c->floating)
    1.25  			n++;
    1.26  
    1.27 -	h = (n > 1) ? sh / (n - 1) : sh;
    1.28 +	if(n > 1)
    1.29 +		h = (sh - bh) / (n - 1);
    1.30 +	else
    1.31 +		h = sh - bh;
    1.32  
    1.33  	for(i = 0, c = clients; c; c = c->next) {
    1.34  		if(c->tags[tsel]) {
    1.35 @@ -142,19 +146,19 @@
    1.36  			}
    1.37  			if(n == 1) {
    1.38  				c->x = sx;
    1.39 -				c->y = sy;
    1.40 +				c->y = sy + bh;
    1.41  				c->w = sw - 2 * c->border;
    1.42 -				c->h = sh - 2 * c->border;
    1.43 +				c->h = sh - 2 * c->border - bh;
    1.44  			}
    1.45  			else if(i == 0) {
    1.46  				c->x = sx;
    1.47 -				c->y = sy;
    1.48 +				c->y = sy + bh;
    1.49  				c->w = mw - 2 * c->border;
    1.50 -				c->h = sh - 2 * c->border;
    1.51 +				c->h = sh - 2 * c->border - bh;
    1.52  			}
    1.53  			else {
    1.54  				c->x = sx + mw;
    1.55 -				c->y = sy + (i - 1) * h;
    1.56 +				c->y = sy + (i - 1) * h + bh;
    1.57  				c->w = w - 2 * c->border;
    1.58  				c->h = h - 2 * c->border;
    1.59  			}
    1.60 @@ -373,9 +377,11 @@
    1.61  	c->win = w;
    1.62  	c->tx = c->x = wa->x;
    1.63  	c->ty = c->y = wa->y;
    1.64 +	if(c->y < bh)
    1.65 +		c->ty = c->y += bh;
    1.66  	c->tw = c->w = wa->width;
    1.67  	c->h = wa->height;
    1.68 -	c->th = th;
    1.69 +	c->th = bh;
    1.70  	c->border = 1;
    1.71  	c->proto = win_proto(c->win);
    1.72  	update_size(c);
    1.73 @@ -570,6 +576,7 @@
    1.74  {
    1.75  	int i;
    1.76  	if(c == sel) {
    1.77 +		draw_bar();
    1.78  		XUnmapWindow(dpy, c->title);
    1.79  		XSetWindowBorder(dpy, c->win, dc.fg);
    1.80  		return;
    1.81 @@ -579,19 +586,18 @@
    1.82  	XMapWindow(dpy, c->title);
    1.83  
    1.84  	dc.x = dc.y = 0;
    1.85 -	dc.h = c->th;
    1.86  
    1.87  	dc.w = 0;
    1.88  	for(i = 0; i < TLast; i++) {
    1.89  		if(c->tags[i]) {
    1.90  			dc.x += dc.w;
    1.91  			dc.w = textw(c->tags[i]) + dc.font.height;
    1.92 -			draw(True, c->tags[i]);
    1.93 +			drawtext(c->tags[i], True);
    1.94  		}
    1.95  	}
    1.96  	dc.x += dc.w;
    1.97  	dc.w = textw(c->name) + dc.font.height;
    1.98 -	draw(True, c->name);
    1.99 +	drawtext(c->name, True);
   1.100  	XCopyArea(dpy, dc.drawable, c->title, dc.gc,
   1.101  			0, 0, c->tw, c->th, 0, 0);
   1.102  	XFlush(dpy);