Mercurial > repos > blastem
comparison io.c @ 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 | 5f65a16c23ff |
children | a719e2c98b54 |
comparison
equal
deleted
inserted
replaced
1265:a344885e7c79 | 1266:a4fa897c99ce |
---|---|
348 } | 348 } |
349 } | 349 } |
350 | 350 |
351 void handle_keydown(int keycode, uint8_t scancode) | 351 void handle_keydown(int keycode, uint8_t scancode) |
352 { | 352 { |
353 if (current_io->keyboard_captured) { | 353 int bucket = keycode >> 15 & 0xFFFF; |
354 int idx = keycode & 0x7FFF; | |
355 keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; | |
356 if (binding && (!current_io->keyboard_captured || (binding->bind_type == BIND_UI && binding->subtype_a == UI_TOGGLE_KEYBOARD_CAPTURE))) { | |
357 handle_binding_down(binding); | |
358 } else if (current_io->keyboard_captured) { | |
354 store_key_event(scancode); | 359 store_key_event(scancode); |
355 } else { | |
356 int bucket = keycode >> 15 & 0xFFFF; | |
357 if (!bindings[bucket]) { | |
358 return; | |
359 } | |
360 int idx = keycode & 0x7FFF; | |
361 keybinding * binding = bindings[bucket] + idx; | |
362 handle_binding_down(binding); | |
363 } | 360 } |
364 } | 361 } |
365 | 362 |
366 void handle_joydown(int joystick, int button) | 363 void handle_joydown(int joystick, int button) |
367 { | 364 { |
527 int bucket = keycode >> 15 & 0xFFFF; | 524 int bucket = keycode >> 15 & 0xFFFF; |
528 int idx = keycode & 0x7FFF; | 525 int idx = keycode & 0x7FFF; |
529 keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; | 526 keybinding * binding = bindings[bucket] ? bindings[bucket] + idx : NULL; |
530 if (binding && (!current_io->keyboard_captured || (binding->bind_type == BIND_UI && binding->subtype_a == UI_TOGGLE_KEYBOARD_CAPTURE))) { | 527 if (binding && (!current_io->keyboard_captured || (binding->bind_type == BIND_UI && binding->subtype_a == UI_TOGGLE_KEYBOARD_CAPTURE))) { |
531 handle_binding_up(binding); | 528 handle_binding_up(binding); |
532 } else { | 529 } else if (current_io->keyboard_captured) { |
533 store_key_event(0xF000 | scancode); | 530 store_key_event(0xF000 | scancode); |
534 } | 531 } |
535 } | 532 } |
536 | 533 |
537 void handle_joyup(int joystick, int button) | 534 void handle_joyup(int joystick, int button) |