-
-
-/* handle events from x windows and block until the next frame */
-
-void input_eventloop(void)
-{
- static struct timeval tv1 = { 0, 0 };
- static struct timeval tv2 = { 0, 0 };
- unsigned long count;
-
- XSync(display, False); /* block until all graphics are drawn */
-
- if (gettimeofday(&tv2, 0) == -1)
- tv2.tv_usec = 0;
-
- count = tv2.tv_usec + 1000000 - tv1.tv_usec;
- if (count >= 1000000)
- count -= 1000000;
-
- tv1.tv_usec = tv2.tv_usec;
- if (count < 25000)
- {
- tv2.tv_sec = 0;
- tv2.tv_usec = 25000 - count;
-#if 1
- select(0, 0, 0, 0, &tv2); /* sleep a bit */
-#else
- usleep(tv2.tv_usec);
-#endif
- }
-}
-
-#endif