]> Dogcows Code - chaz/openbox/blobdiff - otk/timer.cc
use the unfocused label when not focused
[chaz/openbox] / otk / timer.cc
index ceee8f2a2c57abc9488a8342c4ed3e0969e98bd8..0a0083146afee234012a7e30796f33d4bd60b393 100644 (file)
@@ -1,8 +1,6 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
-#ifdef    HAVE_CONFIG_H
-#  include "../config.h"
-#endif // HAVE_CONFIG_H
+#include "config.h"
 
 #include "timer.hh"
 #include "display.hh"
 extern "C" {
 #ifdef    HAVE_SYS_SELECT_H
 #  include <sys/select.h>
-#else
-#  ifdef    HAVE_UNISTD_H
-#    include <sys/types.h>
-#    include <unistd.h>
-#  endif // HAVE_UNISTD_H
 #endif // HAVE_SYS_SELECT_H
+
+#ifdef    HAVE_SYS_TIME_H
+#  include <sys/time.h>
+#endif
 }
 
 namespace otk {
@@ -87,6 +84,11 @@ void Timer::dispatchTimers(bool wait)
     curr->_action(curr->_data);
     timevalAdd(curr->_timeout, curr->_delay);
     _q.push(curr);
+
+    /* if at least one timer fires, then don't wait on X events, as there may
+       already be some in the queue from the timer callbacks.
+    */
+    wait = false;
   }
 
   if (wait) {
@@ -94,9 +96,9 @@ void Timer::dispatchTimers(bool wait)
     fd = ConnectionNumber(**display);
     FD_ZERO(&selset);
     FD_SET(fd, &selset);
-    if (nearestTimeout(next))
+    if (nearestTimeout(next)) {
       select(fd + 1, &selset, NULL, NULL, &next);
-    else
+    else
       select(fd + 1, &selset, NULL, NULL, NULL);
   }
 }
This page took 0.020949 seconds and 4 git commands to generate.