#include <stdio.h>
#include <string.h>
-#include "draw.h"
-#include "util.h"
+#include <X11/Xlocale.h>
+
+#include "wm.h"
static void
-drawborder(Display *dpy, Brush *b)
+drawborder(Brush *b)
{
XPoint points[5];
XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter);
}
void
-draw(Display *dpy, Brush *b, Bool border, const char *text)
+draw(Brush *b, Bool border, const char *text)
{
- unsigned int x, y, w, h, len;
+ int x, y, w, h;
+ unsigned int len;
static char buf[256];
XGCValues gcv;
XRectangle r = { b->x, b->y, b->w, b->h };
XSetForeground(dpy, b->gc, b->bg);
XFillRectangles(dpy, b->drawable, b->gc, &r, 1);
+ w = 0;
if(border)
- drawborder(dpy, b);
+ drawborder(b);
if(!text)
return;
}
static unsigned long
-xloadcolors(Display *dpy, Colormap cmap, const char *colstr)
+xloadcolors(Colormap cmap, const char *colstr)
{
XColor color;
XAllocNamedColor(dpy, cmap, colstr, &color, &color);
}
void
-loadcolors(Display *dpy, int screen, Brush *b,
+loadcolors(int scr, Brush *b,
const char *bg, const char *fg, const char *border)
{
- Colormap cmap = DefaultColormap(dpy, screen);
- b->bg = xloadcolors(dpy, cmap, bg);
- b->fg = xloadcolors(dpy, cmap, fg);
- b->border = xloadcolors(dpy, cmap, border);
+ Colormap cmap = DefaultColormap(dpy, scr);
+ b->bg = xloadcolors(cmap, bg);
+ b->fg = xloadcolors(cmap, fg);
+ b->border = xloadcolors(cmap, border);
}
unsigned int
}
void
-loadfont(Display *dpy, Fnt *font, const char *fontstr)
+loadfont(Fnt *font, const char *fontstr)
{
char **missing, *def;
- int n;
+ int i, n;
missing = NULL;
- def = "?";
setlocale(LC_ALL, "");
if(font->set)
XFreeFontSet(dpy, font->set);
XFontSetExtents *font_extents;
XFontStruct **xfonts;
char **font_names;
- unsigned int i;
font->ascent = font->descent = 0;
font_extents = XExtentsOfFontSet(font->set);