X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=osdd.c;h=ba279b292816f88fffdb26fe45d666c26f077664;hb=a31f777b7f8bdf581fac8d134793d128a2d53f18;hp=15836ea51b7d36377197c5a94fd307bdb16b64e1;hpb=845e5d4b6ac0a561a0ee55f6a11bdb4380d4e014;p=osdd.git diff --git a/osdd.c b/osdd.c index 15836ea..ba279b2 100644 --- a/osdd.c +++ b/osdd.c @@ -8,20 +8,18 @@ #include #include #include -#include #include #include -#include +#include #include #include #include #undef DEBUG -#include "util.h" +#include "osd.h" static xosd *osd; -typedef uint64_t timestamp_t; static timestamp_t now; /*** Options ***/ @@ -31,7 +29,7 @@ static char *font_name = "-bitstream-bitstream vera sans-bold-r-normal-*-*-320-* static char *default_color = "green"; static char *default_outline_color = "black"; static int default_duration = 1000; -static int default_min_duration = 1000; +static int default_min_duration = 250; static int debug_mode; static const char short_opts[] = "c:d:Df:l:m:o:"; @@ -231,6 +229,7 @@ int main(int argc, char **argv) { parse_opts(argc, argv); + setlocale(LC_CTYPE, ""); XInitThreads(); Display *dpy = XOpenDisplay(NULL); @@ -246,10 +245,7 @@ main(int argc, char **argv) { pid_t pid = fork(); if (pid < 0) - { - fprintf(stderr, "batt: Cannot fork: %m\n"); - return 1; - } + die("Cannot fork: %m"); if (pid > 0) return 0; setsid(); @@ -274,9 +270,7 @@ main(int argc, char **argv) for (;;) { - struct timeval tv; - gettimeofday(&tv, NULL); - now = (timestamp_t) tv.tv_sec * 1000 + tv.tv_usec / 1000; + now = get_current_time(); timestamp_t wait_until = now - 1; if (!current_msg && first_msg)