X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=render%2Fcolor.c;h=f791b9c48582a16d2fe5581c9d9e9a5603824603;hb=fa55dc4bb1a349cfb3a55f7d0f85b03d6fa0e09f;hp=d16bbf0cdd93b8e06cc2eee2664f2f6ea2fe5edf;hpb=5be0a82a353b67160142134de1cc51fa31d72759;p=chaz%2Fopenbox diff --git a/render/color.c b/render/color.c index d16bbf0c..f791b9c4 100644 --- a/render/color.c +++ b/render/color.c @@ -59,6 +59,8 @@ RrColor *RrColorNew(const RrInstance *inst, gint r, gint g, gint b) void RrColorFree(RrColor *c) { if (c) { + if (c->pixel) XFreeColors(RrDisplay(c->inst), RrColormap(c->inst), + &c->pixel, 1, 0); if (c->gc) XFreeGC(RrDisplay(c->inst), c->gc); g_free(c); } @@ -257,3 +259,11 @@ gulong RrColorPixel(const RrColor *c) { return c->pixel; } + +GC RrColorGC(RrColor *c) /* XXX make this const RrColor* when the GCs are in + a cache.. if possible? */ +{ + if (!c->gc) + RrColorAllocateGC(c); + return c->gc; +}