From d9f0da59c3cc8cbcc6b41208a9ad34dbb0be367c Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 4 Mar 2017 21:34:15 -0800 Subject: Don't allow the keyboard capture key to get passed to the emulated keyboard --- io.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 2081e2f..0e3571c 100644 --- a/io.c +++ b/io.c @@ -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); } } -- cgit v1.2.3