Qt: Fix a few places per-game settings were not checked

This commit is contained in:
Stenzek 2024-07-15 16:31:40 +10:00
parent 5381ad9cd1
commit 00cc3b65fc
No known key found for this signature in database
4 changed files with 13 additions and 15 deletions

View file

@ -138,21 +138,21 @@ void DisplayWidget::updateCursor(bool hidden)
void DisplayWidget::handleCloseEvent(QCloseEvent* event) void DisplayWidget::handleCloseEvent(QCloseEvent* event)
{ {
event->ignore();
// Closing the separate widget will either cancel the close, or trigger shutdown. // Closing the separate widget will either cancel the close, or trigger shutdown.
// In the latter case, it's going to destroy us, so don't let Qt do it first. // In the latter case, it's going to destroy us, so don't let Qt do it first.
// Treat a close event while fullscreen as an exit, that way ALT+F4 closes DuckStation, // Treat a close event while fullscreen as an exit, that way ALT+F4 closes DuckStation,
// rather than just the game. // rather than just the game.
if (QtHost::IsSystemValid() && !isActuallyFullscreen()) if (QtHost::IsSystemValid() && !isActuallyFullscreen())
{ {
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Q_ARG(bool, true), Q_ARG(bool, true), QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, true),
Q_ARG(bool, false)); Q_ARG(bool, true), Q_ARG(bool, false));
} }
else else
{ {
QMetaObject::invokeMethod(g_main_window, "requestExit"); QMetaObject::invokeMethod(g_main_window, "requestExit", Qt::QueuedConnection);
} }
event->ignore();
} }
void DisplayWidget::destroy() void DisplayWidget::destroy()

View file

@ -31,8 +31,8 @@ LogWindow::~LogWindow() = default;
void LogWindow::updateSettings() void LogWindow::updateSettings()
{ {
const bool new_enabled = Host::GetBaseBoolSettingValue("Logging", "LogToWindow", false); const bool new_enabled = Host::GetBoolSettingValue("Logging", "LogToWindow", false);
const bool attach_to_main = Host::GetBaseBoolSettingValue("Logging", "AttachLogWindowToMainWindow", true); const bool attach_to_main = Host::GetBoolSettingValue("Logging", "AttachLogWindowToMainWindow", true);
const bool curr_enabled = (g_log_window != nullptr); const bool curr_enabled = (g_log_window != nullptr);
if (new_enabled == curr_enabled) if (new_enabled == curr_enabled)
{ {

View file

@ -1980,7 +1980,7 @@ bool MainWindow::shouldHideMouseCursor() const
bool MainWindow::shouldHideMainWindow() const bool MainWindow::shouldHideMainWindow() const
{ {
return Host::GetBaseBoolSettingValue("Main", "HideMainWindowWhenRunning", false) || return Host::GetBoolSettingValue("Main", "HideMainWindowWhenRunning", false) ||
(g_emu_thread->shouldRenderToMain() && !isRenderingToMain()) || QtHost::InNoGUIMode(); (g_emu_thread->shouldRenderToMain() && !isRenderingToMain()) || QtHost::InNoGUIMode();
} }
@ -2872,7 +2872,7 @@ bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_sav
save_state &= allow_save_to_state; save_state &= allow_save_to_state;
// Only confirm on UI thread because we need to display a msgbox. // Only confirm on UI thread because we need to display a msgbox.
if (!m_is_closing && allow_confirm && Host::GetBaseBoolSettingValue("Main", "ConfirmPowerOff", true)) if (!m_is_closing && allow_confirm && Host::GetBoolSettingValue("Main", "ConfirmPowerOff", true))
{ {
SystemLock lock(pauseAndLockSystem()); SystemLock lock(pauseAndLockSystem());

View file

@ -632,14 +632,12 @@ void EmuThread::checkForSettingsChanges(const Settings& old_settings)
updatePerformanceCounters(); updatePerformanceCounters();
} }
if (g_gpu_device) const bool render_to_main = shouldRenderToMain();
if (m_is_rendering_to_main != render_to_main)
{ {
const bool render_to_main = shouldRenderToMain(); m_is_rendering_to_main = render_to_main;
if (m_is_rendering_to_main != render_to_main) if (g_gpu_device)
{
m_is_rendering_to_main = render_to_main;
g_gpu_device->UpdateWindow(); g_gpu_device->UpdateWindow();
}
} }
} }