Don't fetch delay over and over ... do it once, and stash the result in state.
authorRobert Bihlmeyer <r.bihlmeyer@arrowecs.at>
Wed, 14 Oct 2015 14:11:10 +0000 (16:11 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Fri, 16 Oct 2015 19:55:55 +0000 (21:55 +0200)
unicode.c

index 6be60a6..41a1292 100644 (file)
--- a/unicode.c
+++ b/unicode.c
@@ -27,6 +27,7 @@ struct unicode_state {
        XftDraw*        draw;
        XftColor        font_color;
        XColor          bg_color;
+       unsigned        delay;
 };
 
 static void *
@@ -66,6 +67,7 @@ unicode_init (Display *dpy, Window window)
        color.pixel = get_pixel_resource(dpy, cmap, "foreground", "Foreground");
        XQueryColor(dpy, cmap, &color);
 
+       state->delay = get_seconds_resource(dpy, "delay", "Delay")*1000*1000;
        font_color.red = color.red;
        font_color.green = color.green;
        font_color.blue = color.blue;
@@ -125,7 +127,7 @@ unicode_draw (Display *dpy, Window win, void *void_state) {
                XSync (dpy, False);
 
                state->blank = False;
-               return (get_seconds_resource(dpy, "delay", "Delay")*1000*1000);
+               return (state->delay);
        } else {
                XClearWindow (dpy, win);
                XSync (dpy, False);