]> Dogcows Code - chaz/openbox/blobdiff - otk/timerqueuemanager.cc
state_above/below work now
[chaz/openbox] / otk / timerqueuemanager.cc
index 0d7d4983be51646a973620ed532ab3550f0519f5..793351543d8e33a4e2c9775be19c0993ab187cd3 100644 (file)
@@ -1,4 +1,4 @@
-// -*- mode: C++; indent-tabs-mode: nil; -*-
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
 #ifdef    HAVE_CONFIG_H
 #  include "../config.h"
@@ -9,7 +9,7 @@
 
 namespace otk {
 
-void OBTimerQueueManager::fire()
+void OBTimerQueueManager::fire(bool wait)
 {
   fd_set rfds;
   timeval now, tm, *timeout = (timeval *) 0;
@@ -19,17 +19,19 @@ void OBTimerQueueManager::fire()
   FD_ZERO(&rfds);
   FD_SET(xfd, &rfds); // break on any x events
 
-  if (! timerList.empty()) {
-    const OBTimer* const timer = timerList.top();
-
-    gettimeofday(&now, 0);
-    tm = timer->timeRemaining(now);
-
-    timeout = &tm;
+  if (wait) {
+    if (! timerList.empty()) {
+      const OBTimer* const timer = timerList.top();
+      
+      gettimeofday(&now, 0);
+      tm = timer->remainingTime(now);
+      
+      timeout = &tm;
+    }
+
+    select(xfd + 1, &rfds, 0, 0, timeout);
   }
 
-  select(xfd + 1, &rfds, 0, 0, timeout);
-
   // check for timer timeout
   gettimeofday(&now, 0);
 
@@ -44,9 +46,8 @@ void OBTimerQueueManager::fire()
 
     timerList.pop();
 
-    timer->fireTimeout();
-    timer->halt();
-    if (timer->isRecurring())
+    timer->fire();
+    if (timer->recurring())
       timer->start();
   }
 }
This page took 0.027087 seconds and 4 git commands to generate.