Add a 'keys' debug flag, showing the keystrokes comming to clients
This commit is contained in:
parent
e340e0ed39
commit
b337f99ca7
|
@ -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)
|
||||
|
|
|
@ -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" }
|
||||
} };
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user