Move driver->keyboard_linefeed_enable to input_driver.c

This commit is contained in:
twinaphex 2015-11-30 03:23:35 +01:00
parent d4e88324ac
commit 871713dd9d
5 changed files with 27 additions and 9 deletions

View File

@ -217,7 +217,6 @@ typedef struct driver
bool camera_active;
bool location_active;
bool keyboard_linefeed_enable;
#ifdef HAVE_MENU
menu_handle_t *menu;

View File

@ -82,6 +82,7 @@ struct turbo_buttons
unsigned count;
};
static bool main_keyboard_linefeed_enable;
static bool main_osk_enabled;
static bool input_data_own;
static const input_driver_t *main_input;
@ -740,6 +741,14 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
break;
case RARCH_INPUT_CTL_IS_OSK_ENABLED:
return main_osk_enabled;
case RARCH_INPUT_CTL_SET_KEYBOARD_LINEFEED_ENABLED:
main_keyboard_linefeed_enable = true;
break;
case RARCH_INPUT_CTL_UNSET_KEYBOARD_LINEFEED_ENABLED:
main_keyboard_linefeed_enable = false;
break;
case RARCH_INPUT_CTL_IS_KEYBOARD_LINEFEED_ENABLED:
return main_keyboard_linefeed_enable;
case RARCH_INPUT_CTL_NONE:
default:
break;

View File

@ -71,7 +71,10 @@ enum rarch_input_ctl_state
RARCH_INPUT_CTL_OWNS_DRIVER,
RARCH_INPUT_CTL_SET_OSK_ENABLED,
RARCH_INPUT_CTL_UNSET_OSK_ENABLED,
RARCH_INPUT_CTL_IS_OSK_ENABLED
RARCH_INPUT_CTL_IS_OSK_ENABLED,
RARCH_INPUT_CTL_SET_KEYBOARD_LINEFEED_ENABLED,
RARCH_INPUT_CTL_UNSET_KEYBOARD_LINEFEED_ENABLED,
RARCH_INPUT_CTL_IS_KEYBOARD_LINEFEED_ENABLED,
};
struct retro_keybind

View File

@ -43,13 +43,15 @@ static void *g_keyboard_press_data;
static void input_keyboard_line_toggle_osk(bool enable)
{
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
if (!settings->osk.enable)
return;
driver->keyboard_linefeed_enable = enable;
if (enable)
input_driver_ctl(RARCH_INPUT_CTL_SET_KEYBOARD_LINEFEED_ENABLED, NULL);
else
input_driver_ctl(RARCH_INPUT_CTL_UNSET_KEYBOARD_LINEFEED_ENABLED, NULL);
}
/**

View File

@ -508,7 +508,12 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data)
event_command(EVENT_CMD_AUDIO_MUTE_TOGGLE);
if (cmd->osk_pressed)
driver->keyboard_linefeed_enable = !driver->keyboard_linefeed_enable;
{
if (input_driver_ctl(RARCH_INPUT_CTL_IS_KEYBOARD_LINEFEED_ENABLED, NULL))
input_driver_ctl(RARCH_INPUT_CTL_UNSET_KEYBOARD_LINEFEED_ENABLED, NULL);
else
input_driver_ctl(RARCH_INPUT_CTL_SET_KEYBOARD_LINEFEED_ENABLED, NULL);
}
if (cmd->volume_up_pressed)
event_command(EVENT_CMD_VOLUME_UP);
@ -796,18 +801,18 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data)
#ifdef HAVE_OVERLAY
static void rarch_main_iterate_linefeed_overlay(driver_t *driver, settings_t *settings)
static void rarch_main_iterate_linefeed_overlay(settings_t *settings)
{
static char prev_overlay_restore = false;
bool osk_enable = input_driver_ctl(RARCH_INPUT_CTL_IS_OSK_ENABLED, NULL);
if (osk_enable && !driver->keyboard_linefeed_enable)
if (osk_enable && !input_driver_ctl(RARCH_INPUT_CTL_IS_KEYBOARD_LINEFEED_ENABLED, NULL))
{
input_driver_ctl(RARCH_INPUT_CTL_UNSET_OSK_ENABLED, NULL);
prev_overlay_restore = true;
event_command(EVENT_CMD_OVERLAY_DEINIT);
}
else if (!osk_enable && driver->keyboard_linefeed_enable)
else if (!osk_enable && input_driver_ctl(RARCH_INPUT_CTL_IS_KEYBOARD_LINEFEED_ENABLED, NULL))
{
input_driver_ctl(RARCH_INPUT_CTL_SET_OSK_ENABLED, NULL);
prev_overlay_restore = false;
@ -1054,7 +1059,7 @@ int rarch_main_iterate(unsigned *sleep_ms)
#endif
#ifdef HAVE_OVERLAY
rarch_main_iterate_linefeed_overlay(driver, settings);
rarch_main_iterate_linefeed_overlay(settings);
#endif
ret = rarch_main_iterate_time_to_exit(&cmd);