From 0b92b9335821cf4536565289efc1c943b5a6dd64 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Wed, 24 Oct 2018 18:51:02 +0200 Subject: [PATCH] Capture Alt and Meta keys Alt and Meta keys should not be forwarded to the device. For now, they are not used for shortcuts, but they could be. --- app/src/input_manager.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/input_manager.c b/app/src/input_manager.c index af84c8f3..075ac01a 100644 --- a/app/src/input_manager.c +++ b/app/src/input_manager.c @@ -151,6 +151,14 @@ void input_manager_process_text_input(struct input_manager *input_manager, void input_manager_process_key(struct input_manager *input_manager, const SDL_KeyboardEvent *event) { SDL_bool ctrl = event->keysym.mod & (KMOD_LCTRL | KMOD_RCTRL); + SDL_bool alt = event->keysym.mod & (KMOD_LALT | KMOD_RALT); + SDL_bool meta = event->keysym.mod & (KMOD_LGUI | KMOD_RGUI); + + if (alt | meta) { + // no shortcut involves Alt or Meta, and they should not be forwarded + // to the device + return; + } // capture all Ctrl events if (ctrl) {