dwm-meillo

diff draw.c @ 73:c2ddb9dbbd10

rearranged
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 22:33:38 +0200
parents 50450aa24a46
children 5370ef170cc9
line diff
     1.1 --- a/draw.c	Fri Jul 14 18:59:25 2006 +0200
     1.2 +++ b/draw.c	Fri Jul 14 22:33:38 2006 +0200
     1.3 @@ -10,6 +10,71 @@
     1.4  
     1.5  #include "dwm.h"
     1.6  
     1.7 +void
     1.8 +draw_bar()
     1.9 +{
    1.10 +	int i;
    1.11 +
    1.12 +	dc.x = dc.y = 0;
    1.13 +	dc.w = bw;
    1.14 +	drawtext(NULL, False, False);
    1.15 +
    1.16 +	if(arrange == floating) {
    1.17 +		dc.w = textw("~");
    1.18 +		drawtext("~", False, False);
    1.19 +	}
    1.20 +	else
    1.21 +		dc.w = 0;
    1.22 +	for(i = 0; i < TLast; i++) {
    1.23 +		dc.x += dc.w;
    1.24 +		dc.w = textw(tags[i]);
    1.25 +		drawtext(tags[i], i == tsel, True);
    1.26 +	}
    1.27 +	if(sel) {
    1.28 +		dc.x += dc.w;
    1.29 +		dc.w = textw(sel->name);
    1.30 +		drawtext(sel->name, True, True);
    1.31 +	}
    1.32 +	dc.w = textw(stext);
    1.33 +	dc.x = bx + bw - dc.w;
    1.34 +	drawtext(stext, False, False);
    1.35 +
    1.36 +	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    1.37 +	XFlush(dpy);
    1.38 +}
    1.39 +
    1.40 +void
    1.41 +draw_client(Client *c)
    1.42 +{
    1.43 +	int i;
    1.44 +	if(c == sel) {
    1.45 +		draw_bar();
    1.46 +		XUnmapWindow(dpy, c->title);
    1.47 +		XSetWindowBorder(dpy, c->win, dc.fg);
    1.48 +		return;
    1.49 +	}
    1.50 +
    1.51 +	XSetWindowBorder(dpy, c->win, dc.bg);
    1.52 +	XMapWindow(dpy, c->title);
    1.53 +
    1.54 +	dc.x = dc.y = 0;
    1.55 +
    1.56 +	dc.w = 0;
    1.57 +	for(i = 0; i < TLast; i++) {
    1.58 +		if(c->tags[i]) {
    1.59 +			dc.x += dc.w;
    1.60 +			dc.w = textw(c->tags[i]);
    1.61 +			drawtext(c->tags[i], False, True);
    1.62 +		}
    1.63 +	}
    1.64 +	dc.x += dc.w;
    1.65 +	dc.w = textw(c->name);
    1.66 +	drawtext(c->name, False, True);
    1.67 +	XCopyArea(dpy, dc.drawable, c->title, dc.gc,
    1.68 +			0, 0, c->tw, c->th, 0, 0);
    1.69 +	XFlush(dpy);
    1.70 +}
    1.71 +
    1.72  static void
    1.73  drawborder(void)
    1.74  {
    1.75 @@ -103,7 +168,7 @@
    1.76  unsigned int
    1.77  textw(char *text)
    1.78  {
    1.79 -	return textnw(text, strlen(text));
    1.80 +	return textnw(text, strlen(text)) + dc.font.height;
    1.81  }
    1.82  
    1.83  void