]> git.mdlowis.com Git - projs/tide.git/commitdiff
added logic to draw the query and scroll for lengthy queries
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 23 Dec 2018 05:19:01 +0000 (00:19 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 23 Dec 2018 05:19:01 +0000 (00:19 -0500)
src/pick.c

index 51f2872d483d98da8aca9b49a5ba7e10baf1d147..743c93abbf9471ab16c1dd40b87a4c0dfbc82df7 100644 (file)
@@ -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;