diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-09 10:47:38 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-09 10:47:38 (GMT) |
commit | e68511794130388ab9668fdef0dcf48dbbf002fd (patch) | |
tree | 94f5ad86689e8fd1ffc62864a99c4c76fe1e8cbe | |
parent | 82d0de9ef46d38288d2f1daa77ac18276d57390f (diff) | |
download | fluxbox_paul-e68511794130388ab9668fdef0dcf48dbbf002fd.zip fluxbox_paul-e68511794130388ab9668fdef0dcf48dbbf002fd.tar.bz2 |
simpler to use FbTk/Timer api
-rw-r--r-- | src/AttentionNoticeHandler.cc | 7 | ||||
-rw-r--r-- | src/FbTk/Timer.cc | 5 | ||||
-rw-r--r-- | 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) { | |||
78 | if (**timeout_res == 0) | 78 | if (**timeout_res == 0) |
79 | return; | 79 | return; |
80 | 80 | ||
81 | Timer *timer = new Timer(); | ||
82 | // setup timer | 81 | // setup timer |
83 | timeval timeout; | ||
84 | timeout.tv_sec = 0; | ||
85 | timeout.tv_usec = **timeout_res * 1000; | ||
86 | RefCount<Command<void> > cmd(new ToggleFrameFocusCmd(client)); | 82 | RefCount<Command<void> > cmd(new ToggleFrameFocusCmd(client)); |
83 | Timer *timer = new Timer(); | ||
87 | timer->setCommand(cmd); | 84 | timer->setCommand(cmd); |
88 | timer->setTimeout(timeout); | 85 | timer->setTimeout(0, **timeout_res * 1000); |
89 | timer->fireOnce(false); // will repeat until window has focus | 86 | timer->fireOnce(false); // will repeat until window has focus |
90 | timer->start(); | 87 | timer->start(); |
91 | 88 | ||
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) { | |||
85 | m_timeout.tv_usec = t.tv_usec; | 85 | m_timeout.tv_usec = t.tv_usec; |
86 | } | 86 | } |
87 | 87 | ||
88 | void Timer::setTimeout(unsigned int secs, unsigned int usecs) { | ||
89 | m_timeout.tv_sec = secs; | ||
90 | m_timeout.tv_usec = usecs; | ||
91 | } | ||
92 | |||
88 | void Timer::setCommand(RefCount<Command<void> > &cmd) { | 93 | void Timer::setCommand(RefCount<Command<void> > &cmd) { |
89 | m_handler = cmd; | 94 | m_handler = cmd; |
90 | } | 95 | } |
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: | |||
64 | void setTimeout(time_t val); | 64 | void setTimeout(time_t val); |
65 | /// set timeout | 65 | /// set timeout |
66 | void setTimeout(const timeval &val); | 66 | void setTimeout(const timeval &val); |
67 | void setTimeout(unsigned int secs, unsigned int usecs); | ||
67 | void setCommand(RefCount<Command<void> > &cmd); | 68 | void setCommand(RefCount<Command<void> > &cmd); |
68 | void setInterval(int val) { m_interval = val; } | 69 | void setInterval(int val) { m_interval = val; } |
69 | /// start timing | 70 | /// start timing |