Skip to content

Commit

Permalink
Qt: Fix a few places per-game settings were not checked
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Jul 15, 2024
1 parent 5381ad9 commit 00cc3b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/duckstation-qt/displaywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,21 @@ void DisplayWidget::updateCursor(bool hidden)

void DisplayWidget::handleCloseEvent(QCloseEvent* event)
{
event->ignore();

// 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.
// Treat a close event while fullscreen as an exit, that way ALT+F4 closes DuckStation,
// rather than just the game.
if (QtHost::IsSystemValid() && !isActuallyFullscreen())
{
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Q_ARG(bool, true), Q_ARG(bool, true),
Q_ARG(bool, false));
QMetaObject::invokeMethod(g_main_window, "requestShutdown", Qt::QueuedConnection, Q_ARG(bool, true),
Q_ARG(bool, true), Q_ARG(bool, false));
}
else
{
QMetaObject::invokeMethod(g_main_window, "requestExit");
QMetaObject::invokeMethod(g_main_window, "requestExit", Qt::QueuedConnection);
}

event->ignore();
}

void DisplayWidget::destroy()
Expand Down
4 changes: 2 additions & 2 deletions src/duckstation-qt/logwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ LogWindow::~LogWindow() = default;

void LogWindow::updateSettings()
{
const bool new_enabled = Host::GetBaseBoolSettingValue("Logging", "LogToWindow", false);
const bool attach_to_main = Host::GetBaseBoolSettingValue("Logging", "AttachLogWindowToMainWindow", true);
const bool new_enabled = Host::GetBoolSettingValue("Logging", "LogToWindow", false);
const bool attach_to_main = Host::GetBoolSettingValue("Logging", "AttachLogWindowToMainWindow", true);
const bool curr_enabled = (g_log_window != nullptr);
if (new_enabled == curr_enabled)
{
Expand Down
4 changes: 2 additions & 2 deletions src/duckstation-qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,7 @@ bool MainWindow::shouldHideMouseCursor() const

bool MainWindow::shouldHideMainWindow() const
{
return Host::GetBaseBoolSettingValue("Main", "HideMainWindowWhenRunning", false) ||
return Host::GetBoolSettingValue("Main", "HideMainWindowWhenRunning", false) ||
(g_emu_thread->shouldRenderToMain() && !isRenderingToMain()) || QtHost::InNoGUIMode();
}

Expand Down Expand Up @@ -2872,7 +2872,7 @@ bool MainWindow::requestShutdown(bool allow_confirm /* = true */, bool allow_sav
save_state &= allow_save_to_state;

// 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());

Expand Down
10 changes: 4 additions & 6 deletions src/duckstation-qt/qthost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,12 @@ void EmuThread::checkForSettingsChanges(const Settings& old_settings)
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();
if (m_is_rendering_to_main != render_to_main)
{
m_is_rendering_to_main = render_to_main;
m_is_rendering_to_main = render_to_main;
if (g_gpu_device)
g_gpu_device->UpdateWindow();
}
}
}

Expand Down

0 comments on commit 00cc3b6

Please sign in to comment.