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) void DebuggerWindow::closeEvent(QCloseEvent* event)
{ {
g_emu_thread->disconnect(this); g_emu_thread->disconnect(this);
g_emu_thread->setSystemPaused(true, true);
Host::RunOnCPUThread(&CPU::ClearBreakpoints); Host::RunOnCPUThread(&CPU::ClearBreakpoints);
g_emu_thread->setSystemPaused(false);
QMainWindow::closeEvent(event); QMainWindow::closeEvent(event);
emit closed(); emit closed();
} }

View File

@ -39,6 +39,7 @@
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QFileInfo> #include <QtCore/QFileInfo>
#include <QtCore/QMimeData> #include <QtCore/QMimeData>
#include <QtCore/QOperatingSystemVersion>
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QtGui/QActionGroup> #include <QtGui/QActionGroup>
#include <QtGui/QCursor> #include <QtGui/QCursor>
@ -53,6 +54,7 @@
#ifdef _WIN32 #ifdef _WIN32
#include "common/windows_headers.h" #include "common/windows_headers.h"
#include <Dbt.h> #include <Dbt.h>
#include <VersionHelpers.h>
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
@ -718,6 +720,9 @@ void MainWindow::quit()
void MainWindow::recreate() 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; const bool was_display_created = m_display_created;
if (was_display_created) if (was_display_created)
{ {
@ -2199,9 +2204,22 @@ void MainWindow::connectSignals()
void MainWindow::setTheme(const QString& theme) 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::SetBaseStringSettingValue("UI", "Theme", theme.toUtf8().constData());
Host::CommitBaseSettingChanges(); Host::CommitBaseSettingChanges();
updateTheme(); 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() void MainWindow::updateTheme()