fix fullscreen toggle

This commit is contained in:
radius 2017-12-17 12:56:26 -05:00
parent 3ed436dbd0
commit a7f989fdb6
8 changed files with 28 additions and 20 deletions

View File

@ -1957,6 +1957,10 @@ bool command_event(enum event_command cmd, void *data)
cheevos_toggle_hardcore_mode();
#endif
break;
/* this fallthrough is on purpose, it should do
a CMD_EVENT_REINIT too */
case CMD_EVENT_REINIT_FROM_TOGGLE:
retroarch_unset_forced_fullscreen();
case CMD_EVENT_REINIT:
video_driver_reinit();
/* Poll input to avoid possibly stale data to corrupt things. */
@ -2567,15 +2571,21 @@ TODO: Add a setting for these tweaks */
case CMD_EVENT_FULLSCREEN_TOGGLE:
{
settings_t *settings = config_get_ptr();
bool new_fullscreen_state = !settings->bools.video_fullscreen;
bool new_fullscreen_state = !settings->bools.video_fullscreen
&& !retroarch_is_forced_fullscreen();
if (!video_driver_has_windowed())
return false;
/* If we go fullscreen we drop all drivers and
* reinitialize to be safe. */
/* we toggled manually, write the new value to settings */
configuration_set_bool(settings, settings->bools.video_fullscreen,
new_fullscreen_state);
/* we toggled manually, the cli arg is irrelevant now */
if (retroarch_is_forced_fullscreen())
retroarch_unset_forced_fullscreen();
/* If we go fullscreen we drop all drivers and
* reinitialize to be safe. */
command_event(CMD_EVENT_REINIT, NULL);
if (settings->bools.video_fullscreen)
video_driver_hide_mouse();

View File

@ -61,6 +61,8 @@ enum event_command
/* Quits RetroArch. */
CMD_EVENT_QUIT,
/* Reinitialize all drivers. */
CMD_EVENT_REINIT_FROM_TOGGLE,
/* Reinitialize all drivers. */
CMD_EVENT_REINIT,
/* Toggles cheevos hardcore mode. */
CMD_EVENT_CHEEVOS_HARDCORE_MODE_TOGGLE,

View File

@ -1578,11 +1578,6 @@ static void config_set_defaults(void)
#endif
settings->floats.video_scale = scale;
if (retroarch_is_forced_fullscreen())
{
configuration_set_bool(settings, settings->bools.video_fullscreen, true);
}
if (g_defaults.settings.video_threaded_enable != video_threaded)
video_driver_set_threaded(g_defaults.settings.video_threaded_enable);
@ -2377,9 +2372,6 @@ static bool config_load_file(const char *path, bool set_defaults,
*bool_settings[i].ptr = tmp;
}
if (!retroarch_is_forced_fullscreen())
CONFIG_GET_BOOL_BASE(conf, settings, bools.video_fullscreen, "video_fullscreen");
#ifdef HAVE_NETWORKGAMEPAD
for (i = 0; i < MAX_USERS; i++)
{

View File

@ -955,7 +955,7 @@ static bool video_driver_init_internal(bool *video_is_threaded)
video_driver_set_aspect_ratio_value(
aspectratio_lut[settings->uints.video_aspect_ratio_idx].value);
if (settings->bools.video_fullscreen)
if (settings->bools.video_fullscreen|| retroarch_is_forced_fullscreen())
{
width = settings->uints.video_fullscreen_x;
height = settings->uints.video_fullscreen_y;
@ -999,7 +999,7 @@ static bool video_driver_init_internal(bool *video_is_threaded)
video.width = width;
video.height = height;
video.fullscreen = settings->bools.video_fullscreen;
video.fullscreen = settings->bools.video_fullscreen || retroarch_is_forced_fullscreen();
video.vsync = settings->bools.video_vsync && !rarch_ctl(RARCH_CTL_IS_NONBLOCK_FORCED, NULL);
video.force_aspect = settings->bools.video_force_aspect;
video.font_enable = settings->bools.video_font_enable;
@ -2515,7 +2515,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->post_filter_record = settings->bools.video_post_filter_record;
video_info->max_swapchain_images = settings->uints.video_max_swapchain_images;
video_info->windowed_fullscreen = settings->bools.video_windowed_fullscreen;
video_info->fullscreen = settings->bools.video_fullscreen;
video_info->fullscreen = settings->bools.video_fullscreen || retroarch_is_forced_fullscreen();
video_info->monitor_index = settings->uints.video_monitor_index;
video_info->shared_context = settings->bools.video_shared_context;

View File

@ -1670,7 +1670,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FORCE_SRGB_DISABLE,
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FRAME_DELAY,
"Frame Delay")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_FULLSCREEN,
"Use Fullscreen Mode")
"Start in Fullscreen Mode")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GAMMA,
"Video Gamma")
MSG_HASH(MENU_ENUM_LABEL_VALUE_VIDEO_GPU_RECORD,
@ -2618,7 +2618,7 @@ MSG_HASH(
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_FULLSCREEN,
"Start in fullscreen. Can be changed at runtime."
"Start in fullscreen. Can be changed at runtime. Can be overriden by a command line switch"
)
MSG_HASH(
MENU_ENUM_SUBLABEL_VIDEO_WINDOWED_FULLSCREEN,

View File

@ -3354,7 +3354,7 @@ static bool setting_append_list(
general_write_handler,
general_read_handler,
SD_FLAG_CMD_APPLY_AUTO);
menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT);
menu_settings_list_current_add_cmd(list, list_info, CMD_EVENT_REINIT_FROM_TOGGLE);
settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED);
}
if (video_driver_has_windowed())

View File

@ -1106,8 +1106,6 @@ static bool retroarch_init_state(void)
video_driver_set_active();
audio_driver_set_active();
rarch_force_fullscreen = false;
return true;
}
@ -1447,7 +1445,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
rarch_is_inited = false;
rarch_error_on_init = false;
rarch_block_config_read = false;
rarch_force_fullscreen = false;
retroarch_msg_queue_deinit();
driver_uninit(DRIVERS_CMD_ALL);
@ -1926,6 +1923,11 @@ bool retroarch_is_forced_fullscreen(void)
return rarch_force_fullscreen;
}
void retroarch_unset_forced_fullscreen(void)
{
rarch_force_fullscreen = false;
}
bool retroarch_override_setting_is_set(enum rarch_override_setting enum_idx, void *data)
{
switch (enum_idx)

View File

@ -289,6 +289,8 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir);
bool retroarch_is_forced_fullscreen(void);
void retroarch_unset_forced_fullscreen(void);
void retroarch_set_current_core_type(enum rarch_core_type type, bool explicitly_set);
/**