diff --git a/src/AttentionNoticeHandler.cc b/src/AttentionNoticeHandler.cc index 393e566e..9425bb22 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 7d7a84bd..60df968a 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 6be269b0..e61d77f9 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