From: Michael D. Lowis Date: Sun, 23 Dec 2018 05:19:01 +0000 (-0500) Subject: added logic to draw the query and scroll for lengthy queries X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=65852de9d00670484ac507bc136cf5341144a98d;p=projs%2Ftide.git added logic to draw the query and scroll for lengthy queries --- diff --git a/src/pick.c b/src/pick.c index 51f2872..743c93a 100644 --- a/src/pick.c +++ b/src/pick.c @@ -150,6 +150,17 @@ static void redraw(XConf* x) { x11_draw_rect(x, Palette[EditBg], 0, 0, x->width, x->height); x11_draw_rect(x, Palette[TagsBg], 0, 0, x->width, fheight + 4); x11_draw_rect(x, Palette[HorBdr], 0, fheight + 4, x->width, 1); + + XGlyphInfo glyphinfo; + XftTextExtentsUtf8 (x->display, x->font, (const FcChar8*)Query, strlen(Query), &glyphinfo); + int offset = 0; + if (glyphinfo.width >= (x->width - 4)) + offset = ((x->width - 4) - glyphinfo.width); + XftColor clr; + xftcolor(x, &clr, Palette[TagsFg]); + XftDrawStringUtf8(x->xft, &clr, x->font, offset + 2, fheight, (const FcChar8*)Query, strlen(Query)); + XftColorFree(x->display, x->visual, x->colormap, &clr); + x11_flip(x); } @@ -162,12 +173,12 @@ static void filter(void) { | ButtonPressMask | ExposureMask ); + x11_init_gc(&x); + x11_centerwin(&x); if (!(x.font = x11_font_load(&x, Fonts[0]))) { perror("unable to load base font"); exit(EXIT_FAILURE); } - x11_init_gc(&x); - x11_centerwin(&x); x11_show(&x); x.eventfns[KeyPress] = xkeypress; x.eventfns[ButtonPress] = xbtnpress;