From 69b2d3cafdb580a5123747191c4fe92fccc47ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Thu, 7 Dec 2017 14:19:35 +0100 Subject: win_textwidth is no longer needed outside window.c --- window.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index 46c3c6d..d1a96fb 100644 --- a/window.c +++ b/window.c @@ -360,6 +360,14 @@ void win_clear(win_t *win) XFillRectangle(e->dpy, win->buf.pm, gc, 0, 0, win->buf.w, win->buf.h); } +int win_textwidth(const win_env_t *e, const char *text, unsigned int len, bool with_padding, XftFont *fnt) +{ + XGlyphInfo ext; + + XftTextExtentsUtf8(e->dpy, fnt, (XftChar8*)text, len, &ext); + return ext.xOff + (with_padding ? 2 * H_TEXT_PAD : 0); +} + void win_draw_bar_text(win_t *win, XftDraw *d, XftColor *color, XftFont *font, int x, int y, char *text, int maxlen, int maximum_x) { size_t len = 0; @@ -469,17 +477,6 @@ void win_draw_rect(win_t *win, int x, int y, int w, int h, bool fill, int lw, XDrawRectangle(win->env.dpy, win->buf.pm, gc, x, y, w, h); } -int win_textwidth(const win_env_t *e, const char *text, unsigned int len, bool with_padding, XftFont *fnt) -{ - XGlyphInfo ext; - - if(!fnt) - fnt = font; - - XftTextExtentsUtf8(e->dpy, fnt, (XftChar8*)text, len, &ext); - return ext.xOff + (with_padding ? 2 * H_TEXT_PAD : 0); -} - void win_set_title(win_t *win, const char *title) { if (title == NULL) -- cgit v1.2.3