bar.c
changeset 31 386649deb651
parent 26 e8f627998d6f
equal deleted inserted replaced
30:2e0fb4130bfb 31:386649deb651
     6 #include "wm.h"
     6 #include "wm.h"
     7 
     7 
     8 void
     8 void
     9 draw_bar()
     9 draw_bar()
    10 {
    10 {
       
    11 	int i;
    11 	brush.x = brush.y = 0;
    12 	brush.x = brush.y = 0;
    12 	brush.w = bw;
    13 	brush.w = bw;
    13 	brush.h = bh;
    14 	brush.h = bh;
    14 	draw(dpy, &brush, False, NULL);
    15 	draw(dpy, &brush, False, NULL);
    15 
    16 
       
    17 	brush.w = 0;
       
    18 	for(i = 0; i < TLast; i++) {
       
    19 		brush.x += brush.w;
       
    20 		brush.w = textw(&brush.font, tags[i]) + bh;
       
    21 		if(i == tsel) {
       
    22 			swap((void **)&brush.fg, (void **)&brush.bg);
       
    23 			draw(dpy, &brush, True, tags[i]);
       
    24 			swap((void **)&brush.fg, (void **)&brush.bg);
       
    25 		}
       
    26 		else
       
    27 			draw(dpy, &brush, True, tags[i]);
       
    28 	}
    16 	if(stack) {
    29 	if(stack) {
       
    30 		swap((void **)&brush.fg, (void **)&brush.bg);
       
    31 		brush.x += brush.w;
    17 		brush.w = textw(&brush.font, stack->name) + bh;
    32 		brush.w = textw(&brush.font, stack->name) + bh;
    18 		swap((void **)&brush.fg, (void **)&brush.bg);
       
    19 		draw(dpy, &brush, True, stack->name);
    33 		draw(dpy, &brush, True, stack->name);
    20 		swap((void **)&brush.fg, (void **)&brush.bg);
    34 		swap((void **)&brush.fg, (void **)&brush.bg);
    21 		brush.x += brush.w;
       
    22 	}
    35 	}
    23 
    36 	brush.w = textw(&brush.font, stext) + bh;
    24 	brush.w = textw(&brush.font, statustext) + bh;
       
    25 	brush.x = bx + bw - brush.w;
    37 	brush.x = bx + bw - brush.w;
    26 	draw(dpy, &brush, False, statustext);
    38 	draw(dpy, &brush, False, stext);
    27 	XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0);
    39 	XCopyArea(dpy, brush.drawable, barwin, brush.gc, 0, 0, bw, bh, 0, 0);
    28 	XFlush(dpy);
    40 	XFlush(dpy);
    29 }
    41 }