diff options
| author | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-13 01:55:54 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <garbeam@wmii.de> | 2006-07-13 01:55:54 +0200 |
| commit | d7e17087ed2fc5eed57efa03e81460e3e41f7238 (patch) | |
| tree | efaa34fdd54e485be21c5e98f617678a61e4a9e1 /draw.c | |
| parent | removed unnecessary crap (diff) | |
| download | dwm-d7e17087ed2fc5eed57efa03e81460e3e41f7238.tar.gz dwm-d7e17087ed2fc5eed57efa03e81460e3e41f7238.zip | |
new stuff (some warning elimination)
Diffstat (limited to 'draw.c')
| -rw-r--r-- | draw.c | 27 |
1 files changed, 13 insertions, 14 deletions
| @@ -11,7 +11,7 @@ | |||
| 11 | #include "wm.h" | 11 | #include "wm.h" |
| 12 | 12 | ||
| 13 | static void | 13 | static void |
| 14 | drawborder(Display *dpy, Brush *b) | 14 | drawborder(Brush *b) |
| 15 | { | 15 | { |
| 16 | XPoint points[5]; | 16 | XPoint points[5]; |
| 17 | XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter); | 17 | XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter); |
| @@ -30,9 +30,10 @@ drawborder(Display *dpy, Brush *b) | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | void | 32 | void |
| 33 | draw(Display *dpy, Brush *b, Bool border, const char *text) | 33 | draw(Brush *b, Bool border, const char *text) |
| 34 | { | 34 | { |
| 35 | unsigned int x, y, w, h, len; | 35 | int x, y, w, h; |
| 36 | unsigned int len; | ||
| 36 | static char buf[256]; | 37 | static char buf[256]; |
| 37 | XGCValues gcv; | 38 | XGCValues gcv; |
| 38 | XRectangle r = { b->x, b->y, b->w, b->h }; | 39 | XRectangle r = { b->x, b->y, b->w, b->h }; |
| @@ -42,7 +43,7 @@ draw(Display *dpy, Brush *b, Bool border, const char *text) | |||
| 42 | 43 | ||
| 43 | w = 0; | 44 | w = 0; |
| 44 | if(border) | 45 | if(border) |
| 45 | drawborder(dpy, b); | 46 | drawborder(b); |
| 46 | 47 | ||
| 47 | if(!text) | 48 | if(!text) |
| 48 | return; | 49 | return; |
| @@ -79,7 +80,7 @@ draw(Display *dpy, Brush *b, Bool border, const char *text) | |||
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | static unsigned long | 82 | static unsigned long |
| 82 | xloadcolors(Display *dpy, Colormap cmap, const char *colstr) | 83 | xloadcolors(Colormap cmap, const char *colstr) |
| 83 | { | 84 | { |
| 84 | XColor color; | 85 | XColor color; |
| 85 | XAllocNamedColor(dpy, cmap, colstr, &color, &color); | 86 | XAllocNamedColor(dpy, cmap, colstr, &color, &color); |
| @@ -87,13 +88,13 @@ xloadcolors(Display *dpy, Colormap cmap, const char *colstr) | |||
| 87 | } | 88 | } |
| 88 | 89 | ||
| 89 | void | 90 | void |
| 90 | loadcolors(Display *dpy, int screen, Brush *b, | 91 | loadcolors(int scr, Brush *b, |
| 91 | const char *bg, const char *fg, const char *border) | 92 | const char *bg, const char *fg, const char *border) |
| 92 | { | 93 | { |
| 93 | Colormap cmap = DefaultColormap(dpy, screen); | 94 | Colormap cmap = DefaultColormap(dpy, scr); |
| 94 | b->bg = xloadcolors(dpy, cmap, bg); | 95 | b->bg = xloadcolors(cmap, bg); |
| 95 | b->fg = xloadcolors(dpy, cmap, fg); | 96 | b->fg = xloadcolors(cmap, fg); |
| 96 | b->border = xloadcolors(dpy, cmap, border); | 97 | b->border = xloadcolors(cmap, border); |
| 97 | } | 98 | } |
| 98 | 99 | ||
| 99 | unsigned int | 100 | unsigned int |
| @@ -120,13 +121,12 @@ texth(Fnt *font) | |||
| 120 | } | 121 | } |
| 121 | 122 | ||
| 122 | void | 123 | void |
| 123 | loadfont(Display *dpy, Fnt *font, const char *fontstr) | 124 | loadfont(Fnt *font, const char *fontstr) |
| 124 | { | 125 | { |
| 125 | char **missing, *def; | 126 | char **missing, *def; |
| 126 | int n; | 127 | int i, n; |
| 127 | 128 | ||
| 128 | missing = NULL; | 129 | missing = NULL; |
| 129 | def = "?"; | ||
| 130 | setlocale(LC_ALL, ""); | 130 | setlocale(LC_ALL, ""); |
| 131 | if(font->set) | 131 | if(font->set) |
| 132 | XFreeFontSet(dpy, font->set); | 132 | XFreeFontSet(dpy, font->set); |
| @@ -144,7 +144,6 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr) | |||
| 144 | XFontSetExtents *font_extents; | 144 | XFontSetExtents *font_extents; |
| 145 | XFontStruct **xfonts; | 145 | XFontStruct **xfonts; |
| 146 | char **font_names; | 146 | char **font_names; |
| 147 | unsigned int i; | ||
| 148 | 147 | ||
| 149 | font->ascent = font->descent = 0; | 148 | font->ascent = font->descent = 0; |
| 150 | font_extents = XExtentsOfFontSet(font->set); | 149 | font_extents = XExtentsOfFontSet(font->set); |
