all repos — fluxbox @ cfcc4d44aa07c0e33ee299e38c94e3f7f6c0458e

custom fork of the fluxbox windowmanager

FbTk::Timer accepts Slots instead of Commands as the former are more general
Pavel Labath pavelo@centrum.sk
commit

cfcc4d44aa07c0e33ee299e38c94e3f7f6c0458e

parent

d338e6c003cca84733c7900be256a991790f7018

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

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

@@ -59,7 +59,7 @@ Timer::Timer():m_timing(false), m_once(false), m_interval(0) {

} -Timer::Timer(RefCount<Command<void> > &handler): +Timer::Timer(const RefCount<Slot<void> > &handler): m_handler(handler), m_timing(false), m_once(false),

@@ -90,7 +90,7 @@ m_timeout.tv_sec = secs;

m_timeout.tv_usec = usecs; } -void Timer::setCommand(RefCount<Command<void> > &cmd) { +void Timer::setCommand(const RefCount<Slot<void> > &cmd) { m_handler = cmd; }

@@ -122,7 +122,7 @@

void Timer::fireTimeout() { if (m_handler) - m_handler->execute(); + (*m_handler)(); } void Timer::updateTimers(int fd) {

@@ -284,7 +284,7 @@ }

REGISTER_COMMAND_PARSER(delay, DelayedCmd::parse, void); -DelayedCmd::DelayedCmd(RefCount<Command<void> > &cmd, unsigned int timeout) { +DelayedCmd::DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout) { timeval to; // defaults to 200ms to.tv_sec = timeout/1000000; to.tv_usec = timeout % 1000000;
M src/FbTk/Timer.hhsrc/FbTk/Timer.hh

@@ -56,7 +56,7 @@ */

class Timer { public: Timer(); - explicit Timer(RefCount<Command<void> > &handler); + explicit Timer(const RefCount<Slot<void> > &handler); virtual ~Timer(); void fireOnce(bool once) { m_once = once; }

@@ -65,7 +65,7 @@ void setTimeout(time_t val);

/// set timeout void setTimeout(const timeval &val); void setTimeout(unsigned int secs, unsigned int usecs); - void setCommand(RefCount<Command<void> > &cmd); + void setCommand(const RefCount<Slot<void> > &cmd); void setInterval(int val) { m_interval = val; } /// start timing void start();

@@ -96,7 +96,7 @@

typedef std::list<Timer *> TimerList; static TimerList m_timerlist; ///< list of all timers, sorted by next trigger time (start + timeout) - RefCount<Command<void> > m_handler; ///< what to do on a timeout + RefCount<Slot<void> > m_handler; ///< what to do on a timeout bool m_timing; ///< clock running? bool m_once; ///< do timeout only once?

@@ -110,7 +110,7 @@

/// executes a command after a specified timeout class DelayedCmd: public Command<void> { public: - DelayedCmd(RefCount<Command<void> > &cmd, unsigned int timeout = 200000); + DelayedCmd(const RefCount<Slot<void> > &cmd, unsigned int timeout = 200000); void execute(); static Command<void> *parse(const std::string &command, const std::string &args, bool trusted);