}
}
+static void xftcolor(XConf* x, XftColor* xc, unsigned int c) {
+ #define COLOR(c) ((c) | ((c) >> 8))
+ xc->color.alpha = 0xFFFF;
+ xc->color.red = COLOR((c & 0x00FF0000) >> 8);
+ xc->color.green = COLOR((c & 0x0000FF00));
+ xc->color.blue = COLOR((c & 0x000000FF) << 8);
+ XftColorAllocValue(x->display, x->visual, x->colormap, &(xc->color), xc);
+}
+
+static void draw_rect(XConf* x, int color, int px, int py, int width, int height) {
+ XftColor clr;
+ xftcolor(x, &clr, color);
+ XftDrawRect(x->xft, &clr, px, py, width, height);
+ XftColorFree(x->display, x->visual, x->colormap, &clr);
+}
+
static void redraw(XConf* x) {
+ draw_rect(x, 0x0, 0, 0, x->width, x->height);
}
void filter(void) {
x.eventfns[KeyPress] = xkeypress;
x.eventfns[ButtonPress] = xbtnpress;
x.eventfns[ConfigureNotify] = xresize;
+ redraw(&x);
while (true) {
x11_event_loop(&x);
redraw(&x);