Ok, here is my alternative approach to hotkey configuration. Downside: It does *not* allow to freely choose any keys for hotkeys. Hotkeys are restricted to be one normal key combined with up to three modifiers (no modifiers is fine too).
Upside: The code is simpler. We don't have to keep back events because they might be part of a hotkey. The code also supports multiple hotkeys. While being at it have the code also track all key state, so user interfaces don't have to do that on their own any more. The sdl2 ui is used to show this in action. No command line option parsing added yet, so hotkeys are not actually configurable for now. The groundwork to change them at runtime is there though. Gerd Hoffmann (5): kbd-state: add keyboard state tracker kbd-state: add hotkey registry kbd-state: use state tracker for sdl2 kbd-state: register sdl2 hotkeys sdl2: use only QKeyCode in sdl2_process_key() include/ui/kbd-state.h | 49 ++++++++++++++++ include/ui/sdl2.h | 2 + ui/kbd-state.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++++ ui/sdl2-input.c | 54 ++---------------- ui/sdl2.c | 114 ++++++++++++++++++++----------------- ui/Makefile.objs | 2 +- 6 files changed, 270 insertions(+), 103 deletions(-) create mode 100644 include/ui/kbd-state.h create mode 100644 ui/kbd-state.c -- 2.9.3