aewl

annotate bar.c @ 69:cc68153c9a8a

Added tag 0.1 for changeset d31b5ad96b0ba7b5b0a30928fcf000428339a577
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 18:40:36 +0200
parents 1269bd127551
children 7681ef838201
rev   line source
garbeam@57 1 /*
garbeam@57 2 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
garbeam@57 3 * See LICENSE file for license details.
garbeam@57 4 */
garbeam@57 5
garbeam@57 6 #include "dwm.h"
garbeam@57 7
garbeam@57 8 void
garbeam@58 9 barclick(XButtonPressedEvent *e)
garbeam@58 10 {
garbeam@58 11 int x = 0;
garbeam@58 12 Arg a;
garbeam@58 13 for(a.i = 0; a.i < TLast; a.i++) {
garbeam@58 14 x += textw(tags[a.i]) + dc.font.height;
garbeam@58 15 if(e->x < x) {
garbeam@58 16 view(&a);
garbeam@58 17 return;
garbeam@58 18 }
garbeam@58 19 }
garbeam@58 20 }
garbeam@58 21
garbeam@58 22 void
garbeam@57 23 draw_bar()
garbeam@57 24 {
garbeam@57 25 int i;
garbeam@57 26 dc.x = dc.y = 0;
garbeam@57 27 dc.w = bw;
garbeam@66 28 drawtext(NULL, False, False);
garbeam@57 29
garbeam@57 30 dc.w = 0;
garbeam@57 31 for(i = 0; i < TLast; i++) {
garbeam@57 32 dc.x += dc.w;
garbeam@57 33 dc.w = textw(tags[i]) + dc.font.height;
garbeam@66 34 drawtext(tags[i], i == tsel, True);
garbeam@57 35 }
garbeam@57 36 if(sel) {
garbeam@57 37 dc.x += dc.w;
garbeam@57 38 dc.w = textw(sel->name) + dc.font.height;
garbeam@66 39 drawtext(sel->name, True, True);
garbeam@57 40 }
garbeam@57 41 dc.w = textw(stext) + dc.font.height;
garbeam@57 42 dc.x = bx + bw - dc.w;
garbeam@66 43 drawtext(stext, False, False);
garbeam@57 44 XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
garbeam@57 45 XFlush(dpy);
garbeam@57 46 }