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.
This commit is contained in:
parent
c20245630e
commit
0b92b93358
1 changed files with 8 additions and 0 deletions
|
@ -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,
|
void input_manager_process_key(struct input_manager *input_manager,
|
||||||
const SDL_KeyboardEvent *event) {
|
const SDL_KeyboardEvent *event) {
|
||||||
SDL_bool ctrl = event->keysym.mod & (KMOD_LCTRL | KMOD_RCTRL);
|
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
|
// capture all Ctrl events
|
||||||
if (ctrl) {
|
if (ctrl) {
|
||||||
|
|
Loading…
Reference in a new issue