Mercurial > aewl
comparison 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 |
comparison
equal
deleted
inserted
replaced
25:e238dc4844d7 | 26:e8f627998d6f |
---|---|
6 #include "wm.h" | 6 #include "wm.h" |
7 | 7 |
8 void | 8 void |
9 draw_bar() | 9 draw_bar() |
10 { | 10 { |
11 brush.rect = barrect; | 11 brush.x = brush.y = 0; |
12 brush.rect.x = brush.rect.y = 0; | 12 brush.w = bw; |
13 brush.h = bh; | |
13 draw(dpy, &brush, False, NULL); | 14 draw(dpy, &brush, False, NULL); |
14 | 15 |
15 if(stack) { | 16 if(stack) { |
16 brush.rect.width = textwidth(&brush.font, stack->name) + labelheight(&brush.font); | 17 brush.w = textw(&brush.font, stack->name) + bh; |
17 swap((void **)&brush.fg, (void **)&brush.bg); | 18 swap((void **)&brush.fg, (void **)&brush.bg); |
18 draw(dpy, &brush, True, stack->name); | 19 draw(dpy, &brush, True, stack->name); |
19 swap((void **)&brush.fg, (void **)&brush.bg); | 20 swap((void **)&brush.fg, (void **)&brush.bg); |
20 brush.rect.x += brush.rect.width; | 21 brush.x += brush.w; |
21 } | 22 } |
22 | 23 |
23 brush.rect.width = textwidth(&brush.font, statustext) + labelheight(&brush.font); | 24 brush.w = textw(&brush.font, statustext) + bh; |
24 brush.rect.x = barrect.x + barrect.width - brush.rect.width; | 25 brush.x = bx + bw - brush.w; |
25 draw(dpy, &brush, False, statustext); | 26 draw(dpy, &brush, False, statustext); |
26 | 27 XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0); |
27 XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, barrect.width, | |
28 barrect.height, 0, 0); | |
29 XFlush(dpy); | 28 XFlush(dpy); |
30 } | 29 } |