vcl/win/window/salframe.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit def4e048769aece7f7d17f723786b8e0db2f8ee5 Author: Hossein <[email protected]> AuthorDate: Fri Dec 19 13:29:10 2025 +0000 Commit: Hossein <[email protected]> CommitDate: Mon Dec 22 15:24:17 2025 +0100 tdf#145759 Use DWMWA_USE_IMMERSIVE_DARK_MODE Previously, magic number 20 was used for switching to dark mode on Windows. On the other hand, DWMWA_USE_IMMERSIVE_DARK_MODE is defined for that purpose since Windows 11 22000. Prior to that, it was an undocumented constant: DWMWINDOWATTRIBUTE enumeration (dwmapi.h) https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute WinForms Dark title bar on Windows 10 https://stackoverflow.com/a/62811758 More informationa bout dark mode for win32 applications can be found in: Support Dark and Light themes in Win32 apps https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/ui/apply-windows-themes Change-Id: I96169ae87f4f42d6b0092128c527ba0e72f7529e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195910 Tested-by: Jenkins Reviewed-by: Hossein <[email protected]> diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index f43fd00dc4a3..85937d6f30fa 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -254,6 +254,10 @@ enum PreferredAppMode } +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + static void UpdateDarkMode(HWND hWnd) { static bool bOSSupportsDarkMode = OSSupportsDarkMode(); @@ -294,7 +298,7 @@ static void UpdateDarkMode(HWND hWnd) if (!AllowDarkModeForWindow) return; - DwmSetWindowAttribute(hWnd, 20, &bDarkMode, sizeof(bDarkMode)); + DwmSetWindowAttribute(hWnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &bDarkMode, sizeof(bDarkMode)); } static void UpdateAutoAccel()
