win_textwidth is no longer needed outside window.c
This commit is contained in:
parent
30e2356622
commit
69b2d3cafd
1
sxiv.h
1
sxiv.h
|
@ -442,7 +442,6 @@ void win_toggle_bar(win_t*);
|
||||||
void win_clear(win_t*);
|
void win_clear(win_t*);
|
||||||
void win_draw(win_t*);
|
void win_draw(win_t*);
|
||||||
void win_draw_rect(win_t*, int, int, int, int, bool, int, unsigned long);
|
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_title(win_t*, const char*);
|
||||||
void win_set_cursor(win_t*, cursor_t);
|
void win_set_cursor(win_t*, cursor_t);
|
||||||
void win_cursor_pos(win_t*, int*, int*);
|
void win_cursor_pos(win_t*, int*, int*);
|
||||||
|
|
19
window.c
19
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);
|
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)
|
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;
|
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);
|
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)
|
void win_set_title(win_t *win, const char *title)
|
||||||
{
|
{
|
||||||
if (title == NULL)
|
if (title == NULL)
|
||||||
|
|
Loading…
Reference in a new issue