Add input event DAG

This PR adds code for hotkey recognition and event emission.
Still WIP, but you can review the code that is present now.
Targets #321.
Sure? It should be stated in the doc. Also: When identifying a leaf by the depth of the DAG, wouldn't that result in something like "key combos must have N characters, not more, not less"?