From: Michael D. Lowis Date: Tue, 27 Nov 2018 04:35:50 +0000 (-0500) Subject: tried adding background color X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=61a1f997427306dc15055499283eb3966ec4906b;p=projs%2Ftide.git tried adding background color --- diff --git a/src/pick.c b/src/pick.c index d4befea..44445cd 100644 --- a/src/pick.c +++ b/src/pick.c @@ -122,7 +122,24 @@ static void xresize(XConf* x, XEvent* e) { } } +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) { @@ -134,6 +151,7 @@ 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);