]> git.mdlowis.com Git - projs/tide.git/commitdiff
tried adding background color
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 27 Nov 2018 04:35:50 +0000 (23:35 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 27 Nov 2018 04:35:50 +0000 (23:35 -0500)
src/pick.c

index d4befeacb882f05d1a503c7606fc138a39d41597..44445cdc7668255d071f58971e5a1f05d86d5fb4 100644 (file)
@@ -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);