summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2017-03-04 21:34:15 -0800
committerMichael Pavone <pavone@retrodev.com>2017-03-04 21:34:15 -0800
commitd9f0da59c3cc8cbcc6b41208a9ad34dbb0be367c (patch)
treea610b9b25e3aa32327ffb6abaa18019200b3a280 /io.c
parent231ee5b4c0c60c93a2227b7d1649559b8fcd7ec9 (diff)
Don't allow the keyboard capture key to get passed to the emulated keyboard
Diffstat (limited to 'io.c')
-rw-r--r--io.c17
1 files changed, 7 insertions, 10 deletions
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);
}
}