diff src/sys/win32/dark_theme.cc @ 379:5eaafed6c10b default tip

*: clang-format
author Paper <paper@tflc.us>
date Wed, 05 Nov 2025 12:59:46 -0500
parents 862d0d8619f6
children
line wrap: on
line diff
--- a/src/sys/win32/dark_theme.cc	Wed Nov 05 12:50:35 2025 -0500
+++ b/src/sys/win32/dark_theme.cc	Wed Nov 05 12:59:46 2025 -0500
@@ -19,14 +19,16 @@
 
 class Dwmapi {
 public:
-	Dwmapi() {
+	Dwmapi()
+	{
 		/* load functions */
 		library.reset(::LoadLibraryW(L"dwmapi.dll"));
-		set_wind_attrib = reinterpret_cast<decltype(::DwmSetWindowAttribute)*>(
+		set_wind_attrib = reinterpret_cast<decltype(::DwmSetWindowAttribute) *>(
 		    GetProcAddress(library.get(), "DwmSetWindowAttribute"));
 	}
 
-	HRESULT SetWindowAttribute(HWND hWnd, DWORD key, LPCVOID data, DWORD sz_data) {
+	HRESULT SetWindowAttribute(HWND hWnd, DWORD key, LPCVOID data, DWORD sz_data)
+	{
 		if (!library.get())
 			return E_POINTER;
 
@@ -40,14 +42,15 @@
 
 protected:
 	Library library = nullptr;
-	decltype(::DwmSetWindowAttribute)* set_wind_attrib;
+	decltype(::DwmSetWindowAttribute) *set_wind_attrib;
 };
 
 Dwmapi dwmapi;
 
 namespace win32 {
 
-bool SetTitleBarToBlack(QWidget* win, bool enabled) {
+bool SetTitleBarToBlack(QWidget *win, bool enabled)
+{
 	/* 19 and 20 are *both* DWMWA_USE_IMMERSIVE_DARK_MODE.
 	 *
 	 * It's 20 on newer versions of windows (i.e. win11 and late win10),
@@ -75,18 +78,21 @@
 	return b;
 }
 
-void SetTitleBarsToBlack(bool enabled) {
-	for (QWidget* widget : qApp->topLevelWidgets()) {
+void SetTitleBarsToBlack(bool enabled)
+{
+	for (QWidget *widget : qApp->topLevelWidgets()) {
 		SetTitleBarToBlack(widget, enabled);
 	}
 }
 
-bool DarkThemeAvailable() {
-	const auto& ver = QOperatingSystemVersion::current();
+bool DarkThemeAvailable()
+{
+	const auto &ver = QOperatingSystemVersion::current();
 	return (ver.majorVersion() > 10) ? true : (ver.majorVersion() == 10 && ver.microVersion() >= 17763);
 }
 
-bool IsInDarkTheme() {
+bool IsInDarkTheme()
+{
 	QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
 	                   QSettings::NativeFormat);
 	return settings.value("AppsUseLightTheme", 1).toInt() == 0;