From 8a1f15c4607dcd682aa932888e8e6325c81665a8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 3 Oct 2014 00:46:14 +0200 Subject: [PATCH] Move rarch_check_block_hotkey to input/input_common.c and make the function static --- general.h | 1 - input/input_common.c | 27 ++++++++++++++++++++++++--- retroarch.c | 23 ----------------------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/general.h b/general.h index b6439a12c8..ba146d4593 100644 --- a/general.h +++ b/general.h @@ -791,7 +791,6 @@ void rarch_main_command(unsigned action); bool rarch_main_iterate(void); void rarch_main_deinit(void); void rarch_render_cached_frame(void); -void rarch_check_block_hotkey(bool pressed); bool rarch_check_fullscreen(bool pressed); void rarch_disk_control_set_eject(bool state, bool log); void rarch_disk_control_set_index(unsigned index); diff --git a/input/input_common.c b/input/input_common.c index 9f72980d12..31627fbf61 100644 --- a/input/input_common.c +++ b/input/input_common.c @@ -1463,6 +1463,29 @@ void input_pop_analog_dpad(struct retro_keybind *binds) } #if !defined(IS_JOYCONFIG) && !defined(IS_RETROLAUNCH) +static void check_block_hotkey(bool enable_hotkey) +{ + bool use_hotkey_enable; + static const struct retro_keybind *bind = + &g_settings.input.binds[0][RARCH_ENABLE_HOTKEY]; + + /* Don't block the check to RARCH_ENABLE_HOTKEY + * unless we're really supposed to. */ + driver.block_hotkey = driver.block_input; + + // 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; + + driver.block_hotkey = driver.block_input || + (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. */ + driver.block_libretro_input = use_hotkey_enable && enable_hotkey; +} + /* Returns a 64-bit mask of all pressed meta keys, starting * from the specified key up until the last queryable key * (key_end). @@ -1479,10 +1502,8 @@ retro_input_t meta_input_keys_pressed(unsigned key, retro_input_t ret = 0; int i; -#ifdef RARCH_INTERNAL - rarch_check_block_hotkey(driver.input->key_pressed(driver.input_data, + check_block_hotkey(driver.input->key_pressed(driver.input_data, RARCH_ENABLE_HOTKEY)); -#endif input_push_analog_dpad((struct retro_keybind*)binds[0], (g_settings.input.analog_dpad_mode[0] == ANALOG_DPAD_NONE) ? diff --git a/retroarch.c b/retroarch.c index 5f97d53ebc..ad4823f1e0 100644 --- a/retroarch.c +++ b/retroarch.c @@ -2239,29 +2239,6 @@ static void check_netplay_flip(bool pressed, bool fullscreen_toggle_pressed) } #endif -void rarch_check_block_hotkey(bool enable_hotkey) -{ - static const struct retro_keybind *bind = - &g_settings.input.binds[0][RARCH_ENABLE_HOTKEY]; - bool use_hotkey_enable; - - /* Don't block the check to RARCH_ENABLE_HOTKEY - * unless we're really supposed to. */ - driver.block_hotkey = driver.block_input; - - // 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; - - driver.block_hotkey = driver.block_input || - (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. */ - driver.block_libretro_input = use_hotkey_enable && enable_hotkey; -} - static void check_grab_mouse_toggle(void) { static bool grab_mouse_state = false;