menu_input_bind_dialog.c - more refactors

This commit is contained in:
twinaphex 2016-09-15 20:52:08 +02:00
parent a9b8114109
commit e602f534c7
6 changed files with 17 additions and 18 deletions

View File

@ -198,10 +198,6 @@ bool menu_input_ctl(enum menu_input_ctl_state state, void *data)
case MENU_INPUT_CTL_UNSET_POINTER_DRAGGED:
pointer_dragging = false;
break;
case MENU_INPUT_CTL_BIND_NONE:
case MENU_INPUT_CTL_BIND_SINGLE:
case MENU_INPUT_CTL_BIND_ALL:
return menu_input_key_bind_set_mode(state, data);
default:
case MENU_INPUT_CTL_NONE:
break;

View File

@ -76,10 +76,7 @@ enum menu_input_ctl_state
MENU_INPUT_CTL_IS_POINTER_DRAGGED,
MENU_INPUT_CTL_SET_POINTER_DRAGGED,
MENU_INPUT_CTL_UNSET_POINTER_DRAGGED,
MENU_INPUT_CTL_DEINIT,
MENU_INPUT_CTL_BIND_NONE,
MENU_INPUT_CTL_BIND_SINGLE,
MENU_INPUT_CTL_BIND_ALL
MENU_INPUT_CTL_DEINIT
};
typedef struct menu_input_ctx_hitbox

View File

@ -1242,7 +1242,7 @@ static int setting_action_right_bind_device(void *data, bool wraparound)
static int setting_action_ok_bind_all(void *data, bool wraparound)
{
(void)wraparound;
if (!menu_input_ctl(MENU_INPUT_CTL_BIND_ALL, data))
if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_ALL, data))
return -1;
return 0;
}

View File

@ -78,7 +78,7 @@ static bool menu_input_key_bind_custom_bind_keyboard_cb(
}
static int menu_input_key_bind_set_mode_common(
enum menu_input_ctl_state state,
enum menu_input_binds_ctl_state state,
rarch_setting_t *setting)
{
size_t selection;
@ -98,9 +98,7 @@ static int menu_input_key_bind_set_mode_common(
switch (state)
{
case MENU_INPUT_CTL_BIND_NONE:
return -1;
case MENU_INPUT_CTL_BIND_SINGLE:
case MENU_INPUT_BINDS_CTL_BIND_SINGLE:
keybind = (struct retro_keybind*)setting_get_ptr(setting);
if (!keybind)
@ -123,7 +121,7 @@ static int menu_input_key_bind_set_mode_common(
if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info))
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
break;
case MENU_INPUT_CTL_BIND_ALL:
case MENU_INPUT_BINDS_CTL_BIND_ALL:
menu_input_binds.target = &settings->input.binds
[index_offset][0];
menu_input_binds.begin = MENU_SETTINGS_BIND_BEGIN;
@ -141,7 +139,7 @@ static int menu_input_key_bind_set_mode_common(
menu_displaylist_ctl(DISPLAYLIST_PROCESS, &info);
break;
default:
case MENU_INPUT_CTL_NONE:
case MENU_INPUT_BINDS_CTL_BIND_NONE:
break;
}
@ -236,7 +234,7 @@ static void menu_input_key_bind_poll_bind_state(
}
bool menu_input_key_bind_set_mode(
enum menu_input_ctl_state state, void *data)
enum menu_input_binds_ctl_state state, void *data)
{
unsigned index_offset;
input_keyboard_ctx_wait_t keys;

View File

@ -28,6 +28,13 @@
RETRO_BEGIN_DECLS
enum menu_input_binds_ctl_state
{
MENU_INPUT_BINDS_CTL_BIND_NONE = 0,
MENU_INPUT_BINDS_CTL_BIND_SINGLE,
MENU_INPUT_BINDS_CTL_BIND_ALL
};
typedef struct menu_input_ctx_bind
{
char *s;
@ -41,7 +48,7 @@ typedef struct menu_input_ctx_bind_limits
} menu_input_ctx_bind_limits_t;
bool menu_input_key_bind_set_mode(
enum menu_input_ctl_state state, void *data);
enum menu_input_binds_ctl_state state, void *data);
bool menu_input_key_bind_set_min_max(menu_input_ctx_bind_limits_t *lim);

View File

@ -26,6 +26,7 @@
#ifdef HAVE_MENU
#include "menu/menu_driver.h"
#include "menu/widgets/menu_input_dialog.h"
#include "menu/widgets/menu_input_bind_dialog.h"
#endif
#include "configuration.h"
@ -141,7 +142,7 @@ static int setting_bind_action_ok(void *data, bool wraparound)
#ifdef HAVE_MENU
/* TODO - get rid of menu dependency */
if (!menu_input_ctl(MENU_INPUT_CTL_BIND_SINGLE, data))
if (!menu_input_key_bind_set_mode(MENU_INPUT_BINDS_CTL_BIND_SINGLE, data))
return -1;
#endif
return 0;