fix fullscreen=>windowed when remember window positions is on

This commit is contained in:
radius 2018-12-11 19:34:12 -05:00
parent c7b3b0f784
commit a7e4d8359b
4 changed files with 29 additions and 5 deletions

View File

@ -2745,9 +2745,12 @@ TODO: Add a setting for these tweaks */
settings_t *settings = config_get_ptr();
bool new_fullscreen_state = !settings->bools.video_fullscreen
&& !retroarch_is_forced_fullscreen();
if (!video_driver_has_windowed())
return false;
retroarch_set_switching_display_mode();
/* we toggled manually, write the new value to settings */
configuration_set_bool(settings, settings->bools.video_fullscreen,
new_fullscreen_state);
@ -2763,6 +2766,8 @@ TODO: Add a setting for these tweaks */
video_driver_hide_mouse();
else
video_driver_show_mouse();
retroarch_unset_switching_display_mode();
}
break;
case CMD_EVENT_COMMAND_DEINIT:

View File

@ -657,7 +657,7 @@ static void win32_save_position(void)
}
if (settings && settings->bools.video_window_save_positions)
{
if (!settings->bools.video_fullscreen && !retroarch_is_forced_fullscreen())
if (!settings->bools.video_fullscreen && !retroarch_is_forced_fullscreen() && !retroarch_is_switching_display_mode())
{
settings->uints.window_position_x = g_win32_pos_x;
settings->uints.window_position_y = g_win32_pos_y;
@ -684,7 +684,6 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
*quit = true;
break;
}
win32_save_position();
break;
case WM_DROPFILES:
{
@ -724,10 +723,9 @@ static LRESULT CALLBACK WndProcCommon(bool *quit, HWND hwnd, UINT message,
g_win32_resized = true;
}
}
win32_save_position();
*quit = true;
break;
case WM_COMMAND:
case WM_COMMAND:
{
settings_t *settings = config_get_ptr();
if (settings && settings->bools.ui_menubar_enable)
@ -970,7 +968,6 @@ bool win32_window_create(void *data, unsigned style,
#ifndef _XBOX
unsigned user_width = width;
unsigned user_height = height;
win32_set_position_from_config();
if (settings->bools.video_window_save_positions
&& !fullscreen)

View File

@ -210,6 +210,7 @@ static bool rarch_is_inited = false;
static bool rarch_error_on_init = false;
static bool rarch_block_config_read = false;
static bool rarch_force_fullscreen = false;
static bool rarch_is_switching_display_mode = false;
static bool has_set_verbosity = false;
static bool has_set_libretro = false;
static bool has_set_libretro_directory = false;
@ -2025,6 +2026,21 @@ void retroarch_unset_forced_fullscreen(void)
rarch_force_fullscreen = false;
}
bool retroarch_is_switching_display_mode(void)
{
return rarch_is_switching_display_mode;
}
void retroarch_set_switching_display_mode(void)
{
rarch_is_switching_display_mode = true;
}
void retroarch_unset_switching_display_mode(void)
{
rarch_is_switching_display_mode = false;
}
/* set a runtime shader preset without overwriting the settings value */
void retroarch_set_shader_preset(const char* preset)
{

View File

@ -330,6 +330,12 @@ void retroarch_unset_shader_preset(void);
char* retroarch_get_shader_preset(void);
bool retroarch_is_switching_display_mode(void);
void retroarch_set_switching_display_mode(void);
void retroarch_unset_switching_display_mode(void);
/**
* retroarch_fail:
* @error_code : Error code.