diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-12 15:17:22 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-12 15:17:22 +0200 |
| commit | dfd84f9bf3b9d949412a73bc62a43109b340d395 (patch) | |
| tree | ebeac582951e2ef574f50018298c4bc928849d64 /bar.c | |
| parent | fixed configurerequest (diff) | |
| download | dwm-dfd84f9bf3b9d949412a73bc62a43109b340d395.tar.gz dwm-dfd84f9bf3b9d949412a73bc62a43109b340d395.zip | |
simplified several portions of code through replacing rect structs with x,y,h,w counterparts (much more readable)
Diffstat (limited to '')
| -rw-r--r-- | bar.c | 17 |
1 files changed, 8 insertions, 9 deletions
| @@ -8,23 +8,22 @@ | |||
| 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 | } |
