X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Futil%2Farea.c;h=acce72550f109e8a847b539aca23f7521fe2ab34;hb=367bf8f76227dea6e7e10e974967ae1d60cfe38e;hp=fc80a89d629584c1e6dc2a19a11015adc1fd15ed;hpb=be465e9a323ee71d7a6ab71040a117d3d64db813;p=chaz%2Ftint2 diff --git a/src/util/area.c b/src/util/area.c index fc80a89..acce725 100644 --- a/src/util/area.c +++ b/src/util/area.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -107,19 +108,10 @@ void draw (Area *a, int active) if (*pmap) XFreePixmap (server.dsp, *pmap); *pmap = XCreatePixmap (server.dsp, server.root_win, a->width, a->height, server.depth); - // add layer of root pixmap - if (real_transparency) { - cairo_surface_t *tmp = cairo_xlib_surface_create (server.dsp, *pmap, server.visual, a->width, a->height); - cairo_t *cr = cairo_create(tmp); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_rectangle(cr, 0, 0, a->width, a->height); - cairo_set_source_rgba(cr, 1, 1, 1, 0); - cairo_paint (cr); - cairo_destroy (cr); - cairo_surface_destroy (tmp); - } - else - XCopyArea (server.dsp, ((Panel *)a->panel)->temp_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0); + // add layer of root pixmap (or clear pixmap if real_transparency==true) + if (real_transparency) + clear_pixmap(*pmap, 0 ,0, a->width, a->height); + XCopyArea (server.dsp, ((Panel *)a->panel)->temp_pmap, *pmap, server.gc, a->posx, a->posy, a->width, a->height, 0, 0); cairo_surface_t *cs; cairo_t *c; @@ -259,3 +251,10 @@ void draw_rect(cairo_t *c, double x, double y, double w, double h, double r) } +void clear_pixmap(Pixmap p, int x, int y, int w, int h) +{ + Picture pict = XRenderCreatePicture(server.dsp, p, XRenderFindVisualFormat(server.dsp, server.visual), 0, 0); + XRenderColor col = { .red=0, .green=0, .blue=0, .alpha=0 }; + XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h); + XRenderFreePicture(server.dsp, pict); +}