X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=otk%2Ftimerqueuemanager.cc;h=793351543d8e33a4e2c9775be19c0993ab187cd3;hb=cec568b076e903876a91d2922f9fa11e53e3df0b;hp=5bd906c58516f3047848acb6aeef0a773e7da906;hpb=d0b55be2c7afb5b25b42804c9eab4995e64dff52;p=chaz%2Fopenbox diff --git a/otk/timerqueuemanager.cc b/otk/timerqueuemanager.cc index 5bd906c5..79335154 100644 --- a/otk/timerqueuemanager.cc +++ b/otk/timerqueuemanager.cc @@ -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,8 +46,8 @@ void OBTimerQueueManager::fire() timerList.pop(); - timer->fireTimeout(); - if (timer->isRecurring()) + timer->fire(); + if (timer->recurring()) timer->start(); } }