diff options
author | Bert Münnich <ber.t@posteo.de> | 2017-12-07 14:19:35 +0100 |
---|---|---|
committer | Bert Münnich <ber.t@posteo.de> | 2017-12-07 14:19:35 +0100 |
commit | 69b2d3cafdb580a5123747191c4fe92fccc47ced (patch) | |
tree | f991e3c6eebdd420996bf877e1a44d6d242ed760 | |
parent | 30e235662251d24e855ef12eaf9a5a338fbe5d65 (diff) |
win_textwidth is no longer needed outside window.c
-rw-r--r-- | sxiv.h | 1 | ||||
-rw-r--r-- | window.c | 19 |
2 files changed, 8 insertions, 12 deletions
@@ -442,7 +442,6 @@ void win_toggle_bar(win_t*); void win_clear(win_t*); void win_draw(win_t*); void win_draw_rect(win_t*, int, int, int, int, bool, int, unsigned long); -int win_textwidth(const win_env_t*, const char*, unsigned int, bool, XftFont*); void win_set_title(win_t*, const char*); void win_set_cursor(win_t*, cursor_t); void win_cursor_pos(win_t*, int*, int*); @@ -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) |