From bd5bef5acff33a6e2a8b98ba392d8f57b87e8320 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 6 Sep 2007 22:09:00 +0200 Subject: [PATCH] remove textw function, change it with a macro --- draw.c | 33 +++++++++++++-------------------- draw.h | 5 ++++- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/draw.c b/draw.c index 30f304e4..b753bf7e 100644 --- a/draw.c +++ b/draw.c @@ -12,19 +12,6 @@ extern Client *clients, *sel, *stack; /* global client list and stack */ /* static */ -static unsigned int -textnw(const char *text, unsigned int len) -{ - XRectangle r; - - if(dc.font.set) - { - XmbTextExtents(dc.font.set, text, len, NULL, &r); - return r.width; - } - return XTextWidth(dc.font.xfont, text, len); -} - static void drawtext(Display *disp, const char *text, unsigned long col[ColLast]) { @@ -109,6 +96,19 @@ isoccupied(unsigned int t) /* extern */ +unsigned int +textnw(const char *text, unsigned int len) +{ + XRectangle r; + + if(dc.font.set) + { + XmbTextExtents(dc.font.set, text, len, NULL, &r); + return r.width; + } + return XTextWidth(dc.font.xfont, text, len); +} + void drawstatus(Display *disp, jdwm_config * jdwmconf) { @@ -154,10 +154,3 @@ drawstatus(Display *disp, jdwm_config * jdwmconf) XCopyArea(disp, dc.drawable, barwin, dc.gc, 0, 0, sw, bh, 0, 0); XSync(disp, False); } - - -inline unsigned int -textw(const char *text) -{ - return textnw(text, strlen(text)) + dc.font.height; -} diff --git a/draw.h b/draw.h index 25abcab4..deaf1d53 100644 --- a/draw.h +++ b/draw.h @@ -3,9 +3,12 @@ #ifndef JDWM_DRAW_H #define JDWM_DRAW_H +#include #include "config.h" +#define textw(text) (textnw(text, strlen(text)) + dc.font.height) + void drawstatus(Display *, jdwm_config *); /* draw the bar */ -inline unsigned int textw(const char *text); /* return the width of text in px */ +unsigned int textnw(const char *, unsigned int); #endif