summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-11-26 13:29:17 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-11-26 13:29:17 +0000
commitb337f99ca7a03d2cf4bc4999f8c9630637b9bd02 (patch)
tree3d31f136e843093374d97a9e144b4fea881be33e /src
parente340e0ed396609aca7569903d6963aa36acbe5d7 (diff)
Add a 'keys' debug flag, showing the keystrokes comming to clients
Diffstat (limited to 'src')
-rw-r--r--src/client.cc6
-rw-r--r--src/option_types.hh6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/client.cc b/src/client.cc
index 6019f391..c95e8281 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -77,8 +77,14 @@ void Client::handle_available_input(EventMode mode)
try
{
+ const bool debug_keys = (bool)(context().options()["debug"].get<DebugFlags>() & DebugFlags::Keys);
+
while (Optional<Key> key = get_next_key(mode))
{
+ if (debug_keys)
+ write_to_debug_buffer(format("Client '{}' got key '{}'",
+ context().name(), key_to_str(*key)));
+
if (*key == ctrl('c'))
killpg(getpgrp(), SIGINT);
else if (*key == Key::FocusIn)
diff --git a/src/option_types.hh b/src/option_types.hh
index a37f37f3..b0d9b054 100644
--- a/src/option_types.hh
+++ b/src/option_types.hh
@@ -242,17 +242,19 @@ enum class DebugFlags
Hooks = 1 << 0,
Shell = 1 << 1,
Profile = 1 << 2,
+ Keys = 1 << 3,
};
template<>
struct WithBitOps<DebugFlags> : std::true_type {};
-constexpr Array<EnumDesc<DebugFlags>, 3> enum_desc(DebugFlags)
+constexpr Array<EnumDesc<DebugFlags>, 4> enum_desc(DebugFlags)
{
return { {
{ DebugFlags::Hooks, "hooks" },
{ DebugFlags::Shell, "shell" },
- { DebugFlags::Profile, "profile" }
+ { DebugFlags::Profile, "profile" },
+ { DebugFlags::Keys, "keys" }
} };
}