Mercurial > repos > blastem
changeset 1266:a4fa897c99ce
Don't allow the keyboard capture key to get passed to the emulated keyboard
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 04 Mar 2017 21:34:15 -0800 |
parents | a344885e7c79 |
children | 3772bb926be5 |
files | io.c |
diffstat | 1 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/io.c Sat Mar 04 19:02:53 2017 -0800 +++ b/io.c Sat Mar 04 21:34:15 2017 -0800 @@ -350,16 +350,13 @@ void handle_keydown(int keycode, uint8_t scancode) { - if (current_io->keyboard_captured) { + int bucket = keycode >> 15 & 0xFFFF; + int idx = keycode & 0x7FFF; + keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; + if (binding && (!current_io->keyboard_captured || (binding->bind_type == BIND_UI && binding->subtype_a == UI_TOGGLE_KEYBOARD_CAPTURE))) { + handle_binding_down(binding); + } else if (current_io->keyboard_captured) { store_key_event(scancode); - } else { - int bucket = keycode >> 15 & 0xFFFF; - if (!bindings[bucket]) { - return; - } - int idx = keycode & 0x7FFF; - keybinding * binding = bindings[bucket] + idx; - handle_binding_down(binding); } } @@ -529,7 +526,7 @@ keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; if (binding && (!current_io->keyboard_captured || (binding->bind_type == BIND_UI && binding->subtype_a == UI_TOGGLE_KEYBOARD_CAPTURE))) { handle_binding_up(binding); - } else { + } else if (current_io->keyboard_captured) { store_key_event(0xF000 | scancode); } }