mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-29 14:50:20 +00:00
FullscreenUI: Keep a one-deep previous window stack
Fixes settings close returning to wrong window if opened from game list.
This commit is contained in:
parent
1a39dece6a
commit
ba6309c458
@ -540,6 +540,7 @@ struct ALIGN_TO_CACHE_LINE UIState
|
|||||||
TransitionState transition_state = TransitionState::Inactive;
|
TransitionState transition_state = TransitionState::Inactive;
|
||||||
MainWindowType current_main_window = MainWindowType::None;
|
MainWindowType current_main_window = MainWindowType::None;
|
||||||
PauseSubMenu current_pause_submenu = PauseSubMenu::None;
|
PauseSubMenu current_pause_submenu = PauseSubMenu::None;
|
||||||
|
MainWindowType previous_main_window = MainWindowType::None;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
bool tried_to_initialize = false;
|
bool tried_to_initialize = false;
|
||||||
bool pause_menu_was_open = false;
|
bool pause_menu_was_open = false;
|
||||||
@ -1169,6 +1170,7 @@ void FullscreenUI::SwitchToMainWindow(MainWindowType type)
|
|||||||
if (s_state.current_main_window == type)
|
if (s_state.current_main_window == type)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
s_state.previous_main_window = s_state.current_main_window;
|
||||||
s_state.current_main_window = type;
|
s_state.current_main_window = type;
|
||||||
if (!AreAnyDialogsOpen())
|
if (!AreAnyDialogsOpen())
|
||||||
{
|
{
|
||||||
@ -1182,14 +1184,10 @@ void FullscreenUI::SwitchToMainWindow(MainWindowType type)
|
|||||||
|
|
||||||
void FullscreenUI::ReturnToPreviousWindow()
|
void FullscreenUI::ReturnToPreviousWindow()
|
||||||
{
|
{
|
||||||
if (GPUThread::HasGPUBackend() && s_state.pause_menu_was_open)
|
if (s_state.previous_main_window == MainWindowType::None)
|
||||||
{
|
|
||||||
BeginTransition([]() { SwitchToMainWindow(MainWindowType::PauseMenu); });
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ReturnToMainWindow();
|
ReturnToMainWindow();
|
||||||
}
|
else
|
||||||
|
BeginTransition([window = s_state.previous_main_window]() { SwitchToMainWindow(window); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void FullscreenUI::ReturnToMainWindow()
|
void FullscreenUI::ReturnToMainWindow()
|
||||||
@ -1199,6 +1197,7 @@ void FullscreenUI::ReturnToMainWindow()
|
|||||||
|
|
||||||
const float transition_time = GPUThread::HasGPUBackend() ? SHORT_TRANSITION_TIME : DEFAULT_TRANSITION_TIME;
|
const float transition_time = GPUThread::HasGPUBackend() ? SHORT_TRANSITION_TIME : DEFAULT_TRANSITION_TIME;
|
||||||
BeginTransition(transition_time, []() {
|
BeginTransition(transition_time, []() {
|
||||||
|
s_state.previous_main_window = MainWindowType::None;
|
||||||
s_state.current_pause_submenu = PauseSubMenu::None;
|
s_state.current_pause_submenu = PauseSubMenu::None;
|
||||||
s_state.pause_menu_was_open = false;
|
s_state.pause_menu_was_open = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user