aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/WinDarkmode.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-01-10 08:48:17 +0100
committerGitHub <noreply@github.com>2023-01-10 08:48:17 +0100
commit61144f7a219995fa29531683ed36e8e4002848b5 (patch)
tree0b56a4949c9fb64d38b805afac59a5bfecab2c2b /launcher/ui/WinDarkmode.cpp
parentca9b2525c8e45c6dfe2911e895dcb25e0c9e5933 (diff)
parent78bbcac0eaf1bb9df1ac87dafffbef659116fd80 (diff)
downloadPrismLauncher-61144f7a219995fa29531683ed36e8e4002848b5.tar.gz
PrismLauncher-61144f7a219995fa29531683ed36e8e4002848b5.tar.bz2
PrismLauncher-61144f7a219995fa29531683ed36e8e4002848b5.zip
Merge pull request #726 from TheLastRar/qt6-win-darkmode
Closes https://github.com/PrismLauncher/PrismLauncher/issues/158
Diffstat (limited to 'launcher/ui/WinDarkmode.cpp')
-rw-r--r--launcher/ui/WinDarkmode.cpp32
1 files changed, 0 insertions, 32 deletions
diff --git a/launcher/ui/WinDarkmode.cpp b/launcher/ui/WinDarkmode.cpp
deleted file mode 100644
index eac68e4f..00000000
--- a/launcher/ui/WinDarkmode.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <QWidget>
-
-#include "WinDarkmode.h"
-
-namespace WinDarkmode {
-
-/* See https://github.com/statiolake/neovim-qt/commit/da8eaba7f0e38b6b51f3bacd02a8cc2d1f7a34d8 */
-void setDarkWinTitlebar(WId winid, bool darkmode)
-{
- HWND hwnd = reinterpret_cast<HWND>(winid);
- BOOL dark = (BOOL) darkmode;
-
- HMODULE hUxtheme = LoadLibraryExW(L"uxtheme.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
- HMODULE hUser32 = GetModuleHandleW(L"user32.dll");
- fnAllowDarkModeForWindow AllowDarkModeForWindow
- = reinterpret_cast<fnAllowDarkModeForWindow>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(133)));
- fnSetPreferredAppMode SetPreferredAppMode
- = reinterpret_cast<fnSetPreferredAppMode>(GetProcAddress(hUxtheme, MAKEINTRESOURCEA(135)));
- fnSetWindowCompositionAttribute SetWindowCompositionAttribute
- = reinterpret_cast<fnSetWindowCompositionAttribute>(GetProcAddress(hUser32, "SetWindowCompositionAttribute"));
-
- SetPreferredAppMode(AllowDark);
- AllowDarkModeForWindow(hwnd, dark);
- WINDOWCOMPOSITIONATTRIBDATA data = {
- WCA_USEDARKMODECOLORS,
- &dark,
- sizeof(dark)
- };
- SetWindowCompositionAttribute(hwnd, &data);
-}
-
-}