diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-03-04 21:34:15 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-03-04 21:34:15 -0800 |
commit | d9f0da59c3cc8cbcc6b41208a9ad34dbb0be367c (patch) | |
tree | a610b9b25e3aa32327ffb6abaa18019200b3a280 | |
parent | 231ee5b4c0c60c93a2227b7d1649559b8fcd7ec9 (diff) |
Don't allow the keyboard capture key to get passed to the emulated keyboard
-rw-r--r-- | io.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -350,16 +350,13 @@ void store_key_event(uint16_t code) void handle_keydown(int keycode, uint8_t scancode) { - 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; + 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); } } @@ -529,7 +526,7 @@ void handle_keyup(int keycode, uint8_t scancode) 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); } } |