X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=obrender%2Fcolor.c;h=221ebc40302153eb7a92d4eb938206dad6b68604;hb=2ea60e77c085a724b2ec28273e24e12ece0e84f3;hp=5e3f2169bad9a1d6ace43eb649ba4cbf4413d058;hpb=31f0c8c1ad8c9acf369ab8336765f4bf673b8e21;p=chaz%2Fopenbox diff --git a/obrender/color.c b/obrender/color.c index 5e3f2169..221ebc40 100644 --- a/obrender/color.c +++ b/obrender/color.c @@ -81,7 +81,7 @@ RrColor *RrColorNew(const RrInstance *inst, gint r, gint g, gint b) xcol.green = (g << 8) | g; xcol.blue = (b << 8) | b; if (XAllocColor(RrDisplay(inst), RrColormap(inst), &xcol)) { - out = g_new(RrColor, 1); + out = g_slice_new(RrColor); out->inst = inst; out->r = xcol.red >> 8; out->g = xcol.green >> 8; @@ -101,6 +101,11 @@ RrColor *RrColorNew(const RrInstance *inst, gint r, gint g, gint b) return out; } +RrColor *RrColorCopy(RrColor* c) +{ + return RrColorNew(c->inst, c->r, c->g, c->b); +} + void RrColorFree(RrColor *c) { if (c) { @@ -112,7 +117,7 @@ void RrColorFree(RrColor *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); + g_slice_free(RrColor, c); } } }