From b30f1abe25cc4e0b8f40d420a3f71dbfcb68d967 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Tue, 26 Dec 2023 05:00:39 +0100 Subject: [PATCH] Theme the caption bar when playing windowed mode --- src/common/platform/win32/i_mainwindow.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/platform/win32/i_mainwindow.cpp b/src/common/platform/win32/i_mainwindow.cpp index d043417c0..c97f4e88c 100644 --- a/src/common/platform/win32/i_mainwindow.cpp +++ b/src/common/platform/win32/i_mainwindow.cpp @@ -14,6 +14,9 @@ #include #include #include +#include + +#pragma comment(lib, "dwmapi.lib") #ifdef _M_X64 #define X64 " 64-bit" @@ -67,6 +70,15 @@ void MainWindow::Create(const FString& caption, int x, int y, int width, int hei MessageBoxA(nullptr, "Unable to create main window", "Fatal", MB_ICONEXCLAMATION | MB_OK); exit(-1); } + + uint32_t bordercolor = RGB(51, 51, 51); + uint32_t captioncolor = RGB(33, 33, 33); + uint32_t textcolor = RGB(226, 223, 219); + + // Don't error check these as they only exist on Windows 11, and if they fail then that is OK. + DwmSetWindowAttribute(Window, 34/*DWMWA_BORDER_COLOR*/, &bordercolor, sizeof(uint32_t)); + DwmSetWindowAttribute(Window, 35/*DWMWA_CAPTION_COLOR*/, &captioncolor, sizeof(uint32_t)); + DwmSetWindowAttribute(Window, 36/*DWMWA_TEXT_COLOR*/, &textcolor, sizeof(uint32_t)); } void MainWindow::HideGameTitleWindow()