Optimize check_input_driver_block_hotkey

This commit is contained in:
twinaphex 2015-11-30 08:32:30 +01:00
parent 88d0b94ab2
commit 41916b123f

View File

@ -538,14 +538,16 @@ static bool check_input_driver_block_hotkey(bool enable_hotkey)
&settings->input.binds[0][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *autoconf_bind =
&settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
bool kb_mapping_is_blocked = (current_input->keyboard_mapping_is_blocked) ?
current_input->keyboard_mapping_is_blocked(current_input_data) : false;
/* Don't block the check to RARCH_ENABLE_HOTKEY
* unless we're really supposed to. */
input_driver_block_hotkey = input_driver_ctl(RARCH_INPUT_CTL_KB_MAPPING_IS_BLOCKED, NULL);
input_driver_block_hotkey = kb_mapping_is_blocked;
/* If we haven't bound anything to this,
* always allow hotkeys. */
use_hotkey_enable =
use_hotkey_enable =
(bind->key != RETROK_UNKNOWN)
|| (bind->joykey != NO_BTN)
|| (bind->joyaxis != AXIS_NONE)
@ -553,9 +555,7 @@ static bool check_input_driver_block_hotkey(bool enable_hotkey)
|| (autoconf_bind->joykey != NO_BTN)
|| (autoconf_bind->joyaxis != AXIS_NONE);
input_driver_block_hotkey =
input_driver_ctl(RARCH_INPUT_CTL_KB_MAPPING_IS_BLOCKED, NULL) ||
(use_hotkey_enable && !enable_hotkey);
input_driver_block_hotkey = kb_mapping_is_blocked || (use_hotkey_enable && !enable_hotkey);
/* If we hold ENABLE_HOTKEY button, block all libretro input to allow
* hotkeys to be bound to same keys as RetroPad. */