Qt: Work around theme swap bug with Classic Windows

This commit is contained in:
Stenzek 2024-06-23 13:34:39 +10:00
parent e8541648ce
commit 6892c3d095
No known key found for this signature in database
2 changed files with 18 additions and 2 deletions

View File

@ -411,9 +411,7 @@ void DebuggerWindow::onMemorySearchStringChanged(const QString&)
void DebuggerWindow::closeEvent(QCloseEvent* event)
{
g_emu_thread->disconnect(this);
g_emu_thread->setSystemPaused(true, true);
Host::RunOnCPUThread(&CPU::ClearBreakpoints);
g_emu_thread->setSystemPaused(false);
QMainWindow::closeEvent(event);
emit closed();
}

View File

@ -39,6 +39,7 @@
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QMimeData>
#include <QtCore/QOperatingSystemVersion>
#include <QtCore/QUrl>
#include <QtGui/QActionGroup>
#include <QtGui/QCursor>
@ -53,6 +54,7 @@
#ifdef _WIN32
#include "common/windows_headers.h"
#include <Dbt.h>
#include <VersionHelpers.h>
#endif
#ifdef __APPLE__
@ -718,6 +720,9 @@ void MainWindow::quit()
void MainWindow::recreate()
{
// Remove subwindows before switching to surfaceless, because otherwise e.g. the debugger can cause funkyness.
destroySubWindows();
const bool was_display_created = m_display_created;
if (was_display_created)
{
@ -2199,9 +2204,22 @@ void MainWindow::connectSignals()
void MainWindow::setTheme(const QString& theme)
{
[[maybe_unused]] const QString old_theme =
QString::fromStdString(Host::GetStringSettingValue("UI", "Theme", InterfaceSettingsWidget::DEFAULT_THEME_NAME));
Host::SetBaseStringSettingValue("UI", "Theme", theme.toUtf8().constData());
Host::CommitBaseSettingChanges();
updateTheme();
#ifdef _WIN32
if (((old_theme.isEmpty() && QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows11) ||
old_theme == QStringLiteral("windowsvista")) !=
((old_theme.isEmpty() && QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows11) ||
theme == QStringLiteral("windowsvista")))
{
recreate();
}
#endif
}
void MainWindow::updateTheme()