From c9b113fd5f0c01b33babec0980575e6fc5d26cef Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 30 Jan 2013 19:04:03 +0100 Subject: [PATCH] InputHandler: add some new hooks --- src/input_handler.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index a9f5d0a2..db4aede4 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -42,7 +42,14 @@ public: m_idle_timer{Clock::now() + idle_timeout, [this](Timer& timer) { context().hooks().run_hook("NormalIdle", "", context()); }} - {} + { + context().hooks().run_hook("NormalBegin", "", context()); + } + + ~Normal() + { + context().hooks().run_hook("NormalEnd", "", context()); + } void on_key(const Key& key) override { @@ -58,6 +65,7 @@ public: } m_count = 0; } + context().hooks().run_hook("NormalKey", key_to_str(key), context()); m_idle_timer.set_next_date(Clock::now() + idle_timeout); } @@ -573,7 +581,10 @@ public: moved = true; } else if (key.modifiers == Key::Modifiers::None) + { m_inserter.insert(codepoint_to_str(key.key)); + context().hooks().run_hook("InsertKey", key_to_str(key), context()); + } else if (key == Key{ Key::Modifiers::Control, 'r' }) m_insert_reg = true; else if ( key == Key{ Key::Modifiers::Control, 'm' }) @@ -594,7 +605,7 @@ public: if (update_completions) m_idle_timer.set_next_date(Clock::now() + idle_timeout); if (moved) - context().hooks().run_hook("InsertMove", "", context()); + context().hooks().run_hook("InsertMove", key_to_str(key), context()); } private: bool m_insert_reg = false;