diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-01-29 13:58:19 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-01-29 13:58:19 +0100 |
| commit | 2235944e60119795bfeb3bce57f393b60c185faf (patch) | |
| tree | a6957f47111462a96baadca3eb873f4312195088 /src/input_handler.cc | |
| parent | 38a67e72bcd8e142824f431e04f2d9ad100cffda (diff) | |
Add NormalIdle hook support
Diffstat (limited to 'src/input_handler.cc')
| -rw-r--r-- | src/input_handler.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc index ec75d899..a9f5d0a2 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -38,9 +38,11 @@ class Normal : public InputMode { public: Normal(InputHandler& input_handler) - : InputMode(input_handler) - { - } + : InputMode(input_handler), + m_idle_timer{Clock::now() + idle_timeout, [this](Timer& timer) { + context().hooks().run_hook("NormalIdle", "", context()); + }} + {} void on_key(const Key& key) override { @@ -56,10 +58,12 @@ public: } m_count = 0; } + m_idle_timer.set_next_date(Clock::now() + idle_timeout); } private: int m_count = 0; + Timer m_idle_timer; }; class LineEditor |
