Turn check_block_hotkey into static function

This commit is contained in:
twinaphex 2015-11-24 01:54:21 +01:00
parent cd51102281
commit 1639f27f8c
3 changed files with 42 additions and 42 deletions

View File

@ -77,6 +77,8 @@ typedef struct video_driver_state
* TODO: Refactor this better. */
static bool gfx_use_rgba;
static uint64_t video_frame_count;
static void *video_data;
static const video_driver_t *current_video;
@ -312,7 +314,6 @@ uintptr_t video_driver_get_current_framebuffer(void)
return 0;
}
static uint64_t video_frame_count;
retro_proc_address_t video_driver_get_proc_address(const char *sym)
{

View File

@ -504,6 +504,46 @@ void input_pop_analog_dpad(struct retro_keybind *binds)
binds[i].joyaxis = binds[i].orig_joyaxis;
}
/**
* check_block_hotkey:
* @enable_hotkey : Is hotkey enable key enabled?
*
* Checks if 'hotkey enable' key is pressed.
**/
static bool check_block_hotkey(bool enable_hotkey)
{
bool use_hotkey_enable;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
const struct retro_keybind *bind =
&settings->input.binds[0][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *autoconf_bind =
&settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
/* Don't block the check to RARCH_ENABLE_HOTKEY
* unless we're really supposed to. */
driver->block_hotkey = input_driver_keyboard_mapping_is_blocked();
/* If we haven't bound anything to this,
* always allow hotkeys. */
use_hotkey_enable =
(bind->key != RETROK_UNKNOWN)
|| (bind->joykey != NO_BTN)
|| (bind->joyaxis != AXIS_NONE)
|| (autoconf_bind->key != RETROK_UNKNOWN )
|| (autoconf_bind->joykey != NO_BTN)
|| (autoconf_bind->joyaxis != AXIS_NONE);
driver->block_hotkey =
input_driver_keyboard_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. */
return (use_hotkey_enable && enable_hotkey);
}
/**
* input_keys_pressed:
*
@ -564,45 +604,6 @@ retro_input_t input_keys_pressed(void)
return ret;
}
/**
* check_block_hotkey:
* @enable_hotkey : Is hotkey enable key enabled?
*
* Checks if 'hotkey enable' key is pressed.
**/
bool check_block_hotkey(bool enable_hotkey)
{
bool use_hotkey_enable;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
const struct retro_keybind *bind =
&settings->input.binds[0][RARCH_ENABLE_HOTKEY];
const struct retro_keybind *autoconf_bind =
&settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
/* Don't block the check to RARCH_ENABLE_HOTKEY
* unless we're really supposed to. */
driver->block_hotkey = input_driver_keyboard_mapping_is_blocked();
/* If we haven't bound anything to this,
* always allow hotkeys. */
use_hotkey_enable =
(bind->key != RETROK_UNKNOWN)
|| (bind->joykey != NO_BTN)
|| (bind->joyaxis != AXIS_NONE)
|| (autoconf_bind->key != RETROK_UNKNOWN )
|| (autoconf_bind->joykey != NO_BTN)
|| (autoconf_bind->joyaxis != AXIS_NONE);
driver->block_hotkey =
input_driver_keyboard_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. */
return (use_hotkey_enable && enable_hotkey);
}
/**
* input_poll:

View File

@ -121,8 +121,6 @@ void input_pop_analog_dpad(struct retro_keybind *binds);
retro_input_t input_keys_pressed(void);
bool check_block_hotkey(bool enable_hotkey);
/**
* input_poll:
*