summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-01-30 19:04:03 +0100
committerMaxime Coste <frrrwww@gmail.com>2013-01-30 19:04:03 +0100
commitc9b113fd5f0c01b33babec0980575e6fc5d26cef (patch)
treefe0eff9661cf1e1cdf3215488fc34fba8da0b076 /src/input_handler.cc
parentde0f765498260baa987f8b6efefde83155891d86 (diff)
InputHandler: add some new hooks
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc15
1 files 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;