draw.c
changeset 74 5370ef170cc9
parent 73 c2ddb9dbbd10
child 75 f08271b7cb20
equal deleted inserted replaced
73:c2ddb9dbbd10 74:5370ef170cc9
     9 #include <X11/Xlocale.h>
     9 #include <X11/Xlocale.h>
    10 
    10 
    11 #include "dwm.h"
    11 #include "dwm.h"
    12 
    12 
    13 void
    13 void
    14 draw_bar()
    14 drawstatus()
    15 {
    15 {
    16 	int i;
    16 	int i;
    17 
    17 
    18 	dc.x = dc.y = 0;
    18 	dc.x = dc.y = 0;
    19 	dc.w = bw;
    19 	dc.w = bw;
    42 	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    42 	XCopyArea(dpy, dc.drawable, barwin, dc.gc, 0, 0, bw, bh, 0, 0);
    43 	XFlush(dpy);
    43 	XFlush(dpy);
    44 }
    44 }
    45 
    45 
    46 void
    46 void
    47 draw_client(Client *c)
    47 drawtitle(Client *c)
    48 {
    48 {
    49 	int i;
    49 	int i;
    50 	if(c == sel) {
    50 	if(c == sel) {
    51 		draw_bar();
    51 		drawstatus();
    52 		XUnmapWindow(dpy, c->title);
    52 		XUnmapWindow(dpy, c->title);
    53 		XSetWindowBorder(dpy, c->win, dc.fg);
    53 		XSetWindowBorder(dpy, c->win, dc.fg);
    54 		return;
    54 		return;
    55 	}
    55 	}
    56 
    56 
   143 		XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len);
   143 		XDrawImageString(dpy, dc.drawable, dc.gc, x, y, buf, len);
   144 	}
   144 	}
   145 }
   145 }
   146 
   146 
   147 unsigned long
   147 unsigned long
   148 initcolor(const char *colstr)
   148 getcolor(const char *colstr)
   149 {
   149 {
   150 	XColor color;
   150 	XColor color;
   151 	Colormap cmap = DefaultColormap(dpy, screen);
   151 	Colormap cmap = DefaultColormap(dpy, screen);
   152 
   152 
   153 	XAllocNamedColor(dpy, cmap, colstr, &color, &color);
   153 	XAllocNamedColor(dpy, cmap, colstr, &color, &color);
   170 {
   170 {
   171 	return textnw(text, strlen(text)) + dc.font.height;
   171 	return textnw(text, strlen(text)) + dc.font.height;
   172 }
   172 }
   173 
   173 
   174 void
   174 void
   175 initfont(const char *fontstr)
   175 setfont(const char *fontstr)
   176 {
   176 {
   177 	char **missing, *def;
   177 	char **missing, *def;
   178 	int i, n;
   178 	int i, n;
   179 
   179 
   180 	missing = NULL;
   180 	missing = NULL;