# HG changeset patch # User Michael Pavone # Date 1488692055 28800 # Node ID a4fa897c99ce83aea1b711aa16074b0f51ea21ca # Parent a344885e7c7942172d1afcba0537cccb0733fcc6 Don't allow the keyboard capture key to get passed to the emulated keyboard diff -r a344885e7c79 -r a4fa897c99ce io.c --- 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); } }