Merge pull request #1119 from Soreepeong/dark-mode-title-bar

Enable dark mode window title bar if applicable
This commit is contained in:
goat 2023-02-16 14:05:27 +01:00 committed by GitHub
commit 17da5a5a90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -16,6 +16,7 @@
// Windows Header Files (2)
#include <Dbt.h>
#include <dwmapi.h>
#include <PathCch.h>
#include <Psapi.h>
#include <ShlObj.h>

View file

@ -204,6 +204,17 @@ void xivfixes::prevent_devicechange_crashes(bool bApply) {
)
return ShowWindow(hWnd, SW_MAXIMIZE);
if (uMsg == WM_CREATE) {
// While at it, also apply dark mode title bar to the game.
if (const auto dwmapi = LoadLibraryW(L"dwmapi.dll")) {
if (const auto fn = reinterpret_cast<decltype(&DwmSetWindowAttribute)>(GetProcAddress(dwmapi, "DwmSetWindowAttribute"))) {
const BOOL trueValue = TRUE;
fn(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &trueValue, sizeof trueValue);
}
FreeLibrary(dwmapi);
}
}
return s_pfnGameWndProc(hWnd, uMsg, wParam, lParam);
});