all repos — fluxbox @ 2f279e96b16b40ac8f1aa0b9850dd13f7ec4d0ae

custom fork of the fluxbox windowmanager

Fix regression: switch back to microseconds for DelayCmd
Mathias Gumz akira at fluxbox dot org
commit

2f279e96b16b40ac8f1aa0b9850dd13f7ec4d0ae

parent

59d097bcead9b349e20a4ec193d76330e6899e53

2 files changed, 12 insertions(+), 8 deletions(-)

jump to
M src/FbTk/Timer.ccsrc/FbTk/Timer.cc

@@ -239,21 +239,21 @@ RefCount<Command<void> > cmd(CommandParser<void>::instance().parse(cmd_str, trusted));

if (cmd == 0) return 0; - int delay = 200; - StringUtil::fromString<int>(args.c_str() + err, delay); + uint64_t delay = 200; + StringUtil::fromString<uint64_t>(args.c_str() + err, delay); return new DelayedCmd(cmd, delay); } REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); -DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) { +DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, uint64_t timeout) { initTimer(timeout); m_timer.setCommand(cmd); } -void DelayedCmd::initTimer(unsigned int timeout) { - m_timer.setTimeout(timeout * FbTime::IN_MILLISECONDS); +void DelayedCmd::initTimer(uint64_t timeout) { + m_timer.setTimeout(timeout); m_timer.fireOnce(true); }
M src/FbTk/Timer.hhsrc/FbTk/Timer.hh

@@ -85,15 +85,19 @@ uint64_t m_start; ///< start time in microseconds

uint64_t m_timeout; ///< time length in microseconds }; + + /// executes a command after a specified timeout class DelayedCmd: public Command<void> { public: - DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout = 200); + + // timeout in microseconds + DelayedCmd(const RefCount<Slot<void> > &cmd, uint64_t timeout = 200); // this constructor has inverted order of parameters to avoid ambiguity with the previous // constructor template<typename Functor> - DelayedCmd(unsigned int timeout, const Functor &functor) { + DelayedCmd(uint64_t timeout, const Functor &functor) { initTimer(timeout); m_timer.setFunctor(functor); }

@@ -102,7 +106,7 @@ void execute();

static Command<void> *parse(const std::string &command, const std::string &args, bool trusted); private: - void initTimer(unsigned int timeout); + void initTimer(uint64_t timeout); Timer m_timer; };