--- wmmoonclock-1.27.orig/Src/wmMoonClock.c +++ wmmoonclock-1.27/Src/wmMoonClock.c @@ -123,7 +123,7 @@ /* * Delay between refreshes (in microseconds) */ -#define DELAY 100000L +#define DELAY 1000000L #define WMMOONCLOCK_VERSION "1.27" @@ -165,6 +165,8 @@ double UT, val, RA, DEC, UTRise, UTSet, LocalHour, hour24(); int D, H, M, S, sgn, A, B, q; CTrans c; + struct timeval timeout; + fd_set xfdset; @@ -703,6 +705,11 @@ + /* + * Add X display to file descriptor set for polling. + */ + FD_ZERO(&xfdset); + FD_SET(ConnectionNumber(display), &xfdset); @@ -732,7 +739,9 @@ * Redraw and wait for next update */ RedrawWindow(); - usleep(DELAY); + timeout.tv_sec = DELAY / 1000000L; + timeout.tv_usec = DELAY % 1000000L; + select(ConnectionNumber(display) + 1, &xfdset, NULL, NULL, &timeout); }