Create RARCH_MENU_CTL_TOGGLE

This commit is contained in:
twinaphex 2015-12-11 15:39:19 +01:00
parent 74015188a9
commit 733d71ebd3
2 changed files with 12 additions and 3 deletions

View File

@ -288,10 +288,8 @@ static void menu_driver_toggle(bool latch)
rarch_system_info_t *system = NULL;
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &system);
menu_driver_ctl(RARCH_MENU_CTL_TOGGLE, &latch);
if (driver->toggle)
driver->toggle(
menu_userdata ? menu_userdata : NULL, latch);
if (latch)
menu_driver_ctl(RARCH_MENU_CTL_SET_ALIVE, NULL);
@ -843,6 +841,16 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
driver->list_clear(list);
}
return true;
case RARCH_MENU_CTL_TOGGLE:
{
bool *latch = (bool*)data;
if (!latch)
return false;
if (driver->toggle)
driver->toggle(menu_userdata, *latch);
}
break;
default:
case RARCH_MENU_CTL_NONE:
break;

View File

@ -127,6 +127,7 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_PLAYLIST_INIT,
RARCH_MENU_CTL_PLAYLIST_GET,
RARCH_MENU_CTL_LIST_CLEAR,
RARCH_MENU_CTL_TOGGLE,
RARCH_MENU_CTL_POPULATE_ENTRIES
};