Qt: Simplify Fullscreen UI state tracking

Fixes application closing if the system was shut down while fullscreen.
This commit is contained in:
Stenzek 2025-01-04 16:09:31 +10:00
parent 78ccbc710c
commit 920f25427e
No known key found for this signature in database
5 changed files with 6 additions and 27 deletions

View File

@ -602,8 +602,6 @@ bool FullscreenUI::Initialize()
s_state.initialized = true;
s_state.hotkey_list_cache = InputManager::GetHotkeyList();
Host::RunOnCPUThread([]() { Host::OnFullscreenUIStartedOrStopped(true); });
if (s_state.current_main_window == MainWindowType::None && !GPUThread::HasGPUBackend() &&
!GPUThread::IsGPUBackendRequested())
{
@ -830,8 +828,6 @@ void FullscreenUI::Shutdown(bool clear_state)
DestroyResources();
ImGuiFullscreen::Shutdown(clear_state);
if (s_state.initialized)
Host::RunOnCPUThread([]() { Host::OnFullscreenUIStartedOrStopped(false); });
s_state.initialized = false;
s_state.tried_to_initialize = false;

View File

@ -82,9 +82,6 @@ namespace Host {
#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,
/// if the user cancels the shutdown confirmation.
void RequestExitApplication(bool allow_confirm);

View File

@ -743,6 +743,9 @@ void EmuThread::startFullscreenUI()
Host::ReportErrorAsync("Error", error.GetDescription());
return;
}
m_is_fullscreen_ui_started = true;
emit fullscreenUIStartedOrStopped(true);
}
void EmuThread::stopFullscreenUI()
@ -758,7 +761,10 @@ void EmuThread::stopFullscreenUI()
}
if (m_is_fullscreen_ui_started)
{
GPUThread::StopFullscreenUI();
emit fullscreenUIStartedOrStopped(false);
}
}
void EmuThread::bootSystem(std::shared_ptr<SystemBootParameters> params)
@ -1023,11 +1029,6 @@ void Host::OnSystemDestroyed()
emit g_emu_thread->systemDestroyed();
}
void Host::OnFullscreenUIStartedOrStopped(bool started)
{
g_emu_thread->setFullscreenUIStarted(started);
}
void Host::OnGPUThreadRunIdleChanged(bool is_active)
{
g_emu_thread->setGPUThreadRunIdle(is_active);
@ -1823,15 +1824,6 @@ void EmuThread::setGPUThreadRunIdle(bool active)
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()
{
AssertMsg(!g_emu_thread, "Emu thread does not exist");

View File

@ -103,7 +103,6 @@ public:
void startBackgroundControllerPollTimer();
void stopBackgroundControllerPollTimer();
void setFullscreenUIStarted(bool started);
void wakeThread();
bool shouldRenderToMain() const;

View File

@ -296,11 +296,6 @@ void Host::OnGPUThreadRunIdleChanged(bool is_active)
//
}
void Host::OnFullscreenUIStartedOrStopped(bool started)
{
//
}
void Host::OnPerformanceCountersUpdated(const GPUBackend* gpu_backend)
{
//