Create runloop_is_focused

This commit is contained in:
twinaphex 2016-05-08 06:34:25 +02:00
parent 3f36c7f877
commit 8e599379f6
2 changed files with 11 additions and 9 deletions

View File

@ -571,6 +571,14 @@ void runloop_iterate_data(void)
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
}
static bool runloop_is_focused(void)
{
settings_t *settings = config_get_ptr();
if (settings->pause_nonactive)
return video_driver_ctl(RARCH_DISPLAY_CTL_IS_FOCUSED, NULL);
return true;
}
bool runloop_ctl(enum runloop_ctl_state state, void *data)
{
settings_t *settings = config_get_ptr();
@ -766,15 +774,10 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
strlcpy(runloop_fullpath, fullpath, sizeof(runloop_fullpath));
}
break;
case RUNLOOP_CTL_CHECK_FOCUS:
if (settings->pause_nonactive)
return video_driver_ctl(RARCH_DISPLAY_CTL_IS_FOCUSED, NULL);
break;
case RUNLOOP_CTL_CHECK_IDLE_STATE:
{
event_cmd_state_t *cmd = (event_cmd_state_t*)data;
bool focused =
runloop_ctl(RUNLOOP_CTL_CHECK_FOCUS, NULL);
bool focused = runloop_is_focused();
check_pause(settings, focused,
runloop_cmd_triggered(cmd, RARCH_PAUSE_TOGGLE),
@ -1403,8 +1406,8 @@ int runloop_iterate(unsigned *sleep_ms)
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
{
menu_ctx_iterate_t iter;
bool focused = runloop_ctl(RUNLOOP_CTL_CHECK_FOCUS, NULL)
&& !ui_companion_is_on_foreground();
bool focused = runloop_is_focused() &&
!ui_companion_is_on_foreground();
bool is_idle = runloop_ctl(RUNLOOP_CTL_IS_IDLE, NULL);
enum menu_action action = (enum menu_action)
menu_input_frame_retropad(cmd.state[0], cmd.state[2]);

View File

@ -63,7 +63,6 @@ enum runloop_ctl_state
RUNLOOP_CTL_CLEAR_STATE,
RUNLOOP_CTL_STATE_FREE,
RUNLOOP_CTL_GLOBAL_FREE,
RUNLOOP_CTL_CHECK_FOCUS,
RUNLOOP_CTL_SET_CORE_SHUTDOWN,
RUNLOOP_CTL_UNSET_CORE_SHUTDOWN,
RUNLOOP_CTL_IS_CORE_SHUTDOWN,