X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fconfig.c;h=caebe6476638bd3bf3ef9d132eb1b2f01518581b;hb=35e206acc0a7b9dca7611fe4a7e17c7acc381ad0;hp=d93d2c3d4166115c237fe9fadb8ec2d0bf5771f2;hpb=1b1f2a1a069edcf3db99ae07020eeedae3023f76;p=chaz%2Ftint2 diff --git a/src/config.c b/src/config.c index d93d2c3..caebe64 100644 --- a/src/config.c +++ b/src/config.c @@ -45,6 +45,7 @@ #include "config.h" #include "window.h" #include "tooltip.h" +#include "timer.h" #ifdef ENABLE_BATTERY #include "battery.h" @@ -524,20 +525,12 @@ void add_entry (char *key, char *value) else if (strcmp (key, "tooltip") == 0) g_tooltip.enabled = atoi(value); else if (strcmp (key, "tooltip_show_timeout") == 0) { - double timeout = atof(value); - int sec = (int)timeout; - int nsec = (timeout-sec)*1e9; - if (nsec < 0) // can happen because of double is not precise such that (sec > timeout)==TRUE - nsec = 0; - g_tooltip.show_timeout = (struct timespec){.tv_sec=sec, .tv_nsec=nsec}; + int timeout_msec = 1000*atof(value); + g_tooltip.show_timeout_msec = timeout_msec; } else if (strcmp (key, "tooltip_hide_timeout") == 0) { - double timeout = atof(value); - int sec = (int)timeout; - int nsec = (timeout-sec)*1e9; - if (nsec < 0) // can happen because of double is not precise such that (sec > timeout)==TRUE - nsec = 0; - g_tooltip.hide_timeout = (struct timespec){.tv_sec=sec, .tv_nsec=nsec}; + int timeout_msec = 1000*atof(value); + g_tooltip.hide_timeout_msec = timeout_msec; } else if (strcmp (key, "tooltip_padding") == 0) { extract_values(value, &value1, &value2, &value3);