Fix race condition issue in threaded video mode when OSK is

brought up/down
This commit is contained in:
twinaphex 2015-02-21 08:42:19 +01:00
parent 61bbb2a3fb
commit 50baeba22a
4 changed files with 25 additions and 7 deletions

View File

@ -213,7 +213,8 @@ typedef struct driver
bool video_active; bool video_active;
bool camera_active; bool camera_active;
bool location_active; bool location_active;
bool osk_active; bool osk_enable;
bool keyboard_linefeed_enable;
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_handle_t *menu; menu_handle_t *menu;

View File

@ -42,9 +42,7 @@ static void input_keyboard_line_toggle_osk(bool enable)
if (!g_settings.osk.enable) if (!g_settings.osk.enable)
return; return;
rarch_main_command(RARCH_CMD_OVERLAY_DEINIT); driver.keyboard_linefeed_enable = enable;
driver.osk_active = enable;
rarch_main_command(RARCH_CMD_OVERLAY_INIT);
} }
/** /**

View File

@ -2353,7 +2353,7 @@ bool rarch_main_command(unsigned cmd)
case RARCH_CMD_OVERLAY_INIT: case RARCH_CMD_OVERLAY_INIT:
rarch_main_command(RARCH_CMD_OVERLAY_DEINIT); rarch_main_command(RARCH_CMD_OVERLAY_DEINIT);
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (driver.osk_active) if (driver.osk_enable)
{ {
if (!*g_settings.osk.overlay) if (!*g_settings.osk.overlay)
break; break;
@ -2364,8 +2364,8 @@ bool rarch_main_command(unsigned cmd)
break; break;
} }
driver.overlay = input_overlay_new(driver.osk_active ? g_settings.osk.overlay : g_settings.input.overlay, driver.overlay = input_overlay_new(driver.osk_enable ? g_settings.osk.overlay : g_settings.input.overlay,
driver.osk_active ? g_settings.osk.enable : g_settings.input.overlay_enable, driver.osk_enable ? g_settings.osk.enable : g_settings.input.overlay_enable,
g_settings.input.overlay_opacity, g_settings.input.overlay_scale); g_settings.input.overlay_opacity, g_settings.input.overlay_scale);
if (!driver.overlay) if (!driver.overlay)
RARCH_ERR("Failed to load overlay.\n"); RARCH_ERR("Failed to load overlay.\n");

View File

@ -1034,6 +1034,22 @@ void rarch_main_iterate_overlay_state(void)
} }
#endif #endif
static void rarch_main_iterate_linefeed(void)
{
if (driver.osk_enable && !driver.keyboard_linefeed_enable)
{
driver.osk_enable = false;
rarch_main_command(RARCH_CMD_OVERLAY_DEINIT);
return;
}
else if (!driver.osk_enable && driver.keyboard_linefeed_enable)
{
driver.osk_enable = true;
rarch_main_command(RARCH_CMD_OVERLAY_INIT);
return;
}
}
/** /**
* rarch_main_iterate: * rarch_main_iterate:
* *
@ -1065,6 +1081,9 @@ int rarch_main_iterate(void)
do_pre_state_checks(input, old_input, trigger_input); do_pre_state_checks(input, old_input, trigger_input);
if (driver.keyboard_linefeed_enable || driver.osk_enable)
rarch_main_iterate_linefeed();
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
if (driver.overlay) if (driver.overlay)
rarch_main_iterate_overlay_state(); rarch_main_iterate_overlay_state();