revert to windowsvista and use dwmapi for dark mode
All checks were successful
eden-license / license-header (pull_request) Successful in 15s
All checks were successful
eden-license / license-header (pull_request) Successful in 15s
This commit is contained in:
parent
7002fe8295
commit
527205ee79
1 changed files with 24 additions and 1 deletions
|
@ -173,6 +173,24 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
|
|||
#include "yuzu/util/clickable_label.h"
|
||||
#include "yuzu/vk_device_info.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <dwmapi.h>
|
||||
#include <windows.h>
|
||||
#pragma comment(lib, "Dwmapi.lib")
|
||||
|
||||
static void ApplyWindowsTitleBarDarkMode(HWND hwnd, bool enabled) {
|
||||
if (!hwnd)
|
||||
return;
|
||||
BOOL val = enabled ? TRUE : FALSE;
|
||||
// 20 = Win11/21H2+
|
||||
if (SUCCEEDED(DwmSetWindowAttribute(hwnd, 20, &val, sizeof(val))))
|
||||
return;
|
||||
// 19 = pre-21H2
|
||||
DwmSetWindowAttribute(hwnd, 19, &val, sizeof(val));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef YUZU_CRASH_DUMPS
|
||||
#include "yuzu/breakpad.h"
|
||||
#endif
|
||||
|
@ -5418,6 +5436,11 @@ void GMainWindow::UpdateUITheme() {
|
|||
qApp->setStyleSheet({});
|
||||
setStyleSheet({});
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
const bool want_dark_titlebar = UISettings::IsDarkTheme();
|
||||
ApplyWindowsTitleBarDarkMode(reinterpret_cast<HWND>(winId()), want_dark_titlebar);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GMainWindow::LoadTranslation() {
|
||||
|
@ -5657,7 +5680,7 @@ int main(int argc, char* argv[]) {
|
|||
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
|
||||
|
||||
#ifdef _WIN32
|
||||
QApplication::setStyle(QStringLiteral("fusion"));
|
||||
QApplication::setStyle(QStringLiteral("windowsvista"));
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue