Qt: Simplify Fullscreen UI state tracking
Fixes application closing if the system was shut down while fullscreen.
This commit is contained in:
parent
78ccbc710c
commit
920f25427e
|
@ -602,8 +602,6 @@ bool FullscreenUI::Initialize()
|
||||||
s_state.initialized = true;
|
s_state.initialized = true;
|
||||||
s_state.hotkey_list_cache = InputManager::GetHotkeyList();
|
s_state.hotkey_list_cache = InputManager::GetHotkeyList();
|
||||||
|
|
||||||
Host::RunOnCPUThread([]() { Host::OnFullscreenUIStartedOrStopped(true); });
|
|
||||||
|
|
||||||
if (s_state.current_main_window == MainWindowType::None && !GPUThread::HasGPUBackend() &&
|
if (s_state.current_main_window == MainWindowType::None && !GPUThread::HasGPUBackend() &&
|
||||||
!GPUThread::IsGPUBackendRequested())
|
!GPUThread::IsGPUBackendRequested())
|
||||||
{
|
{
|
||||||
|
@ -830,8 +828,6 @@ void FullscreenUI::Shutdown(bool clear_state)
|
||||||
|
|
||||||
DestroyResources();
|
DestroyResources();
|
||||||
ImGuiFullscreen::Shutdown(clear_state);
|
ImGuiFullscreen::Shutdown(clear_state);
|
||||||
if (s_state.initialized)
|
|
||||||
Host::RunOnCPUThread([]() { Host::OnFullscreenUIStartedOrStopped(false); });
|
|
||||||
|
|
||||||
s_state.initialized = false;
|
s_state.initialized = false;
|
||||||
s_state.tried_to_initialize = false;
|
s_state.tried_to_initialize = false;
|
||||||
|
|
|
@ -82,9 +82,6 @@ namespace Host {
|
||||||
|
|
||||||
#ifndef __ANDROID__
|
#ifndef __ANDROID__
|
||||||
|
|
||||||
/// Called whenever fullscreen UI starts/stops.
|
|
||||||
void OnFullscreenUIStartedOrStopped(bool started);
|
|
||||||
|
|
||||||
/// Requests shut down and exit of the hosting application. This may not actually exit,
|
/// Requests shut down and exit of the hosting application. This may not actually exit,
|
||||||
/// if the user cancels the shutdown confirmation.
|
/// if the user cancels the shutdown confirmation.
|
||||||
void RequestExitApplication(bool allow_confirm);
|
void RequestExitApplication(bool allow_confirm);
|
||||||
|
|
|
@ -743,6 +743,9 @@ void EmuThread::startFullscreenUI()
|
||||||
Host::ReportErrorAsync("Error", error.GetDescription());
|
Host::ReportErrorAsync("Error", error.GetDescription());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_is_fullscreen_ui_started = true;
|
||||||
|
emit fullscreenUIStartedOrStopped(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::stopFullscreenUI()
|
void EmuThread::stopFullscreenUI()
|
||||||
|
@ -758,7 +761,10 @@ void EmuThread::stopFullscreenUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_is_fullscreen_ui_started)
|
if (m_is_fullscreen_ui_started)
|
||||||
|
{
|
||||||
GPUThread::StopFullscreenUI();
|
GPUThread::StopFullscreenUI();
|
||||||
|
emit fullscreenUIStartedOrStopped(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::bootSystem(std::shared_ptr<SystemBootParameters> params)
|
void EmuThread::bootSystem(std::shared_ptr<SystemBootParameters> params)
|
||||||
|
@ -1023,11 +1029,6 @@ void Host::OnSystemDestroyed()
|
||||||
emit g_emu_thread->systemDestroyed();
|
emit g_emu_thread->systemDestroyed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::OnFullscreenUIStartedOrStopped(bool started)
|
|
||||||
{
|
|
||||||
g_emu_thread->setFullscreenUIStarted(started);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Host::OnGPUThreadRunIdleChanged(bool is_active)
|
void Host::OnGPUThreadRunIdleChanged(bool is_active)
|
||||||
{
|
{
|
||||||
g_emu_thread->setGPUThreadRunIdle(is_active);
|
g_emu_thread->setGPUThreadRunIdle(is_active);
|
||||||
|
@ -1823,15 +1824,6 @@ void EmuThread::setGPUThreadRunIdle(bool active)
|
||||||
g_emu_thread->startBackgroundControllerPollTimer();
|
g_emu_thread->startBackgroundControllerPollTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuThread::setFullscreenUIStarted(bool started)
|
|
||||||
{
|
|
||||||
if (m_is_fullscreen_ui_started == started)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_is_fullscreen_ui_started = started;
|
|
||||||
emit fullscreenUIStartedOrStopped(started);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmuThread::start()
|
void EmuThread::start()
|
||||||
{
|
{
|
||||||
AssertMsg(!g_emu_thread, "Emu thread does not exist");
|
AssertMsg(!g_emu_thread, "Emu thread does not exist");
|
||||||
|
|
|
@ -103,7 +103,6 @@ public:
|
||||||
|
|
||||||
void startBackgroundControllerPollTimer();
|
void startBackgroundControllerPollTimer();
|
||||||
void stopBackgroundControllerPollTimer();
|
void stopBackgroundControllerPollTimer();
|
||||||
void setFullscreenUIStarted(bool started);
|
|
||||||
void wakeThread();
|
void wakeThread();
|
||||||
|
|
||||||
bool shouldRenderToMain() const;
|
bool shouldRenderToMain() const;
|
||||||
|
|
|
@ -296,11 +296,6 @@ void Host::OnGPUThreadRunIdleChanged(bool is_active)
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host::OnFullscreenUIStartedOrStopped(bool started)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
void Host::OnPerformanceCountersUpdated(const GPUBackend* gpu_backend)
|
void Host::OnPerformanceCountersUpdated(const GPUBackend* gpu_backend)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue