X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fconfig.c;h=fe3f9fee2bce686cf2804bbac436378034ec2c53;hb=b9ceca0af9fbad70fe14f087ccdda72d8c7e7cf6;hp=d93d2c3d4166115c237fe9fadb8ec2d0bf5771f2;hpb=1b1f2a1a069edcf3db99ae07020eeedae3023f76;p=chaz%2Ftint2 diff --git a/src/config.c b/src/config.c index d93d2c3..fe3f9fe 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); @@ -704,7 +697,7 @@ int config_read () int config_read_file (const char *path) { FILE *fp; - char line[80]; + char line[512]; char *key, *value; if ((fp = fopen(path, "r")) == NULL) return 0;