]> Dogcows Code - chaz/openbox/blobdiff - otk/timer.cc
don't wait for x events if any timers fired
[chaz/openbox] / otk / timer.cc
index ceee8f2a2c57abc9488a8342c4ed3e0969e98bd8..4f993616b1ac0a6df3af1b1ad69be8a73a6c5f44 100644 (file)
@@ -87,6 +87,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 +99,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.024322 seconds and 4 git commands to generate.