aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Timer.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-08-02 10:08:58 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-09-14 17:39:11 (GMT)
commite67b9a6f833fd8af3be105ef411f8743d94e25d9 (patch)
tree980d080d476436708eb0a72a084bcad1c9cbdefd /src/FbTk/Timer.cc
parentae252c62cb2714dc3d7f1fbdfa81e19cee3828fd (diff)
downloadfluxbox_paul-e67b9a6f833fd8af3be105ef411f8743d94e25d9.zip
fluxbox_paul-e67b9a6f833fd8af3be105ef411f8743d94e25d9.tar.bz2
Upgrade FbTk::Timer so it can take an arbitrary functor as a parameter
Diffstat (limited to 'src/FbTk/Timer.cc')
-rw-r--r--src/FbTk/Timer.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc
index 13bfc05..9b3fe8c 100644
--- a/src/FbTk/Timer.cc
+++ b/src/FbTk/Timer.cc
@@ -285,11 +285,15 @@ Command<void> *DelayedCmd::parse(const std::string &command,
285REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); 285REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void);
286 286
287DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) { 287DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) {
288 timeval to; // defaults to 200ms 288 initTimer(timeout);
289 m_timer.setCommand(cmd);
290}
291
292void DelayedCmd::initTimer(unsigned int timeout) {
293 timeval to;
289 to.tv_sec = timeout/1000000; 294 to.tv_sec = timeout/1000000;
290 to.tv_usec = timeout % 1000000; 295 to.tv_usec = timeout % 1000000;
291 m_timer.setTimeout(to); 296 m_timer.setTimeout(to);
292 m_timer.setCommand(cmd);
293 m_timer.fireOnce(true); 297 m_timer.fireOnce(true);
294} 298}
295 299