From e68511794130388ab9668fdef0dcf48dbbf002fd Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Thu, 9 Sep 2010 12:47:38 +0200 Subject: simpler to use FbTk/Timer api --- src/AttentionNoticeHandler.cc | 7 ++----- src/FbTk/Timer.cc | 5 +++++ src/FbTk/Timer.hh | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc index 393e566..9425bb2 100644 --- a/src/AttentionNoticeHandler.cc +++ b/src/AttentionNoticeHandler.cc @@ -78,14 +78,11 @@ void AttentionNoticeHandler::addAttention(Focusable &client) { if (**timeout_res == 0) return; - Timer *timer = new Timer(); // setup timer - timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = **timeout_res * 1000; RefCount > cmd(new ToggleFrameFocusCmd(client)); + Timer *timer = new Timer(); timer->setCommand(cmd); - timer->setTimeout(timeout); + timer->setTimeout(0, **timeout_res * 1000); timer->fireOnce(false); // will repeat until window has focus timer->start(); diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 7d7a84b..60df968 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc @@ -85,6 +85,11 @@ void Timer::setTimeout(const timeval &t) { m_timeout.tv_usec = t.tv_usec; } +void Timer::setTimeout(unsigned int secs, unsigned int usecs) { + m_timeout.tv_sec = secs; + m_timeout.tv_usec = usecs; +} + void Timer::setCommand(RefCount > &cmd) { m_handler = cmd; } diff --git a/src/FbTk/Timer.hh b/src/FbTk/Timer.hh index 6be269b..e61d77f 100644 --- a/src/FbTk/Timer.hh +++ b/src/FbTk/Timer.hh @@ -64,6 +64,7 @@ public: void setTimeout(time_t val); /// set timeout void setTimeout(const timeval &val); + void setTimeout(unsigned int secs, unsigned int usecs); void setCommand(RefCount > &cmd); void setInterval(int val) { m_interval = val; } /// start timing -- cgit v0.11.2