aewl

diff bar.c @ 26:e8f627998d6f

simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
author Anselm R. Garbe <garbeam@wmii.de>
date Wed, 12 Jul 2006 15:17:22 +0200
parents bd3a44353916
children 386649deb651
line diff
     1.1 --- a/bar.c	Wed Jul 12 00:53:11 2006 +0200
     1.2 +++ b/bar.c	Wed Jul 12 15:17:22 2006 +0200
     1.3 @@ -8,23 +8,22 @@
     1.4  void
     1.5  draw_bar()
     1.6  {
     1.7 -	brush.rect = barrect;
     1.8 -	brush.rect.x = brush.rect.y = 0;
     1.9 +	brush.x = brush.y = 0;
    1.10 +	brush.w = bw;
    1.11 +	brush.h = bh;
    1.12  	draw(dpy, &brush, False, NULL);
    1.13  
    1.14  	if(stack) {
    1.15 -		brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font);
    1.16 +		brush.w = textw(&brush.font, stack->name) + bh;
    1.17  		swap((void **)&brush.fg, (void **)&brush.bg);
    1.18  		draw(dpy, &brush, True, stack->name);
    1.19  		swap((void **)&brush.fg, (void **)&brush.bg);
    1.20 -		brush.rect.x += brush.rect.width;
    1.21 +		brush.x += brush.w;
    1.22  	}
    1.23  
    1.24 -	brush.rect.width = textwidth(&brush.font, statustext) + labelheight(&brush.font);
    1.25 -	brush.rect.x = barrect.x + barrect.width - brush.rect.width;
    1.26 +	brush.w = textw(&brush.font, statustext) + bh;
    1.27 +	brush.x = bx + bw - brush.w;
    1.28  	draw(dpy, &brush, False, statustext);
    1.29 -
    1.30 -	XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, barrect.width,
    1.31 -			barrect.height, 0, 0);
    1.32 +	XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0);
    1.33  	XFlush(dpy);
    1.34  }