From 5f5374eb8ec00ff4d793c6a037f20dd2a1a91cd8 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 28 Sep 2016 17:06:33 +0000 Subject: Inline Xft draw and extents wrappers; too much abstraction. --- mousefunc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'mousefunc.c') diff --git a/mousefunc.c b/mousefunc.c index 047b825..c351e72 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.106 2016/09/28 15:54:54 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.107 2016/09/28 17:06:33 okan Exp $ */ #include @@ -39,16 +39,22 @@ mousefunc_sweep_draw(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; char s[14]; /* fits " nnnn x nnnn \0" */ + XGlyphInfo extents; (void)snprintf(s, sizeof(s), " %4d x %-4d ", cc->dim.w, cc->dim.h); + XftTextExtentsUtf8(X_Dpy, sc->xftfont, (const FcChar8*)s, + strlen(s), &extents); + XReparentWindow(X_Dpy, sc->menuwin, cc->win, 0, 0); XMoveResizeWindow(X_Dpy, sc->menuwin, 0, 0, - xu_xft_width(sc->xftfont, s, strlen(s)), sc->xftfont->height); + extents.xOff, sc->xftfont->height); XMapWindow(X_Dpy, sc->menuwin); XClearWindow(X_Dpy, sc->menuwin); - xu_xft_draw(sc, s, CWM_COLOR_MENU_FONT, 0, sc->xftfont->ascent + 1); + XftDrawStringUtf8(sc->xftdraw, &sc->xftcolor[CWM_COLOR_MENU_FONT], + sc->xftfont, 0, sc->xftfont->ascent + 1, + (const FcChar8*)s, strlen(s)); } void -- cgit v1.2.3-2-gb3c3