Merge pull request #12168 from sonninnos/key-blocking

Duplicate key event blocking additions
This commit is contained in:
Autechre 2021-03-18 03:35:30 +01:00 committed by GitHub
commit 89fdd16e5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25815,14 +25815,23 @@ void input_keyboard_event(bool down, unsigned code,
return; return;
/* Block hotkey + RetroPad mapped keyboard key events, /* Block hotkey + RetroPad mapped keyboard key events,
* but not with game focus and from keyboard device type */ * but not with game focus, and from keyboard device type,
if (!p_rarch->game_focus_state.enabled) * and with 'enable_hotkey' modifier set and unpressed */
if (!p_rarch->game_focus_state.enabled &&
BIT512_GET(p_rarch->keyboard_mapping_bits, code))
{ {
input_mapper_t *handle = p_rarch->input_driver_mapper; input_mapper_t *handle = p_rarch->input_driver_mapper;
if (BIT512_GET( struct retro_keybind hotkey = input_config_binds[0][RARCH_ENABLE_HOTKEY];
p_rarch->keyboard_mapping_bits, code)) bool hotkey_pressed =
if (!(handle && MAPPER_GET_KEY(handle, code))) (p_rarch->input_hotkey_block_counter > 0) || (hotkey.key == code);
return;
if (!(handle && MAPPER_GET_KEY(handle, code)) &&
!(!hotkey_pressed && (
hotkey.key != RETROK_UNKNOWN ||
hotkey.joykey != NO_BTN ||
hotkey.joyaxis != AXIS_NONE
)))
return;
} }
{ {
@ -25890,6 +25899,9 @@ static void input_config_parse_key(
fill_pathname_join_delim(key, prefix, btn, '_', sizeof(key)); fill_pathname_join_delim(key, prefix, btn, '_', sizeof(key));
/* Clear old mapping bit */
input_keyboard_mapping_bits(0, bind->key);
if ( if (
(entry = config_get_entry(conf, key)) (entry = config_get_entry(conf, key))
&& (!string_is_empty(entry->value)) && (!string_is_empty(entry->value))