From b2652ad64348f1d416a9d243ac77f40cee7bc303 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 5 Feb 2023 18:44:00 -0800 Subject: [PATCH] Disable theme awareness if we detect Wine. --- src/musikcube/cursespp/Win32Util.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/musikcube/cursespp/Win32Util.cpp b/src/musikcube/cursespp/Win32Util.cpp index 3da29a837..897179a35 100644 --- a/src/musikcube/cursespp/Win32Util.cpp +++ b/src/musikcube/cursespp/Win32Util.cpp @@ -264,6 +264,13 @@ namespace cursespp { } } + static bool IsWine() { + HMODULE ntdll = LoadLibrary(L"ntdll.dll"); + bool result = ntdll != nullptr && GetProcAddress(ntdll, "wine_get_version") != nullptr; + FreeLibrary(ntdll); + return result; + } + void ConfigureDpiAwareness() { typedef HRESULT(__stdcall *SetProcessDpiAwarenessProc)(int); static const int ADJUST_DPI_PER_MONITOR = 2; @@ -282,6 +289,10 @@ namespace cursespp { } void ConfigureThemeAwareness() { + if (IsWine()) { + return; + } + typedef HRESULT(__stdcall* DwmSetWindowAttributeProc)(HWND, DWORD, LPCVOID, DWORD); static const DWORD DWMWA_USE_IMMERSIVE_DARK_MODE = 20;