aboutsummaryrefslogtreecommitdiffstats
path: root/font.c
diff options
context:
space:
mode:
authorokan2011-09-08 12:35:33 +0000
committerokan2011-09-08 12:35:33 +0000
commitce2d7e32150af2dba656d99ed0bf931645425ee7 (patch)
treec3035f9d197cd3137faf2d34230ea932335733ee /font.c
parentf62e165e708a0095e787f98912d4d2e24c0d8b01 (diff)
downloadcwm-ce2d7e32150af2dba656d99ed0bf931645425ee7.tar.gz
allow configurable menu font color; from Alexander Polakov with a tweak
from me. ok oga@
Diffstat (limited to '')
-rw-r--r--font.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/font.c b/font.c
index 1aa19cb..cebb2bd 100644
--- a/font.c
+++ b/font.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: font.c,v 1.16 2011/06/27 12:46:54 okan Exp $
+ * $OpenBSD: font.c,v 1.17 2011/09/08 12:35:33 okan Exp $
*/
#include <sys/param.h>
@@ -49,15 +49,20 @@ font_height(struct screen_ctx *sc)
}
void
-font_init(struct screen_ctx *sc)
+font_init(struct screen_ctx *sc, const char *color)
{
+ if (sc->xftdraw)
+ XftDrawDestroy(sc->xftdraw);
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
if (sc->xftdraw == NULL)
errx(1, "XftDrawCreate");
+ if (sc->xftcolor.pixel)
+ XftColorFree(X_Dpy, DefaultVisual(X_Dpy, sc->which),
+ DefaultColormap(X_Dpy, sc->which), &sc->xftcolor);
if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
- DefaultColormap(X_Dpy, sc->which), "black", &sc->xftcolor))
+ DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor))
errx(1, "XftColorAllocName");
}