From 9feeb324eddd9ed73ae667e10275f663d70f7544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sun, 19 Mar 2023 06:40:53 +0100 Subject: win32: follow Windows settings and update dark mode state Microsoft documented how to enable dark mode for title bar: https://learn.microsoft.com/windows/apps/desktop/modernize/apply-windows-themes https://learn.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute Documentation says to set the DWMWA_USE_IMMERSIVE_DARK_MODE attribute to TRUE to honor dark mode for the window, FALSE to always use light mode. While in fact setting it to TRUE causes dark mode to be always enabled, regardless of the settings. Since it is quite unlikely that it will be fixed, just use UxTheme API to check if dark mode should be applied and while at it enable it fully. Ideally this function should only call the DwmSetWindowAttribute(), but it just doesn't work as documented. Fixes: #6901 --- wscript | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'wscript') diff --git a/wscript b/wscript index d660404594..2f97bb660a 100644 --- a/wscript +++ b/wscript @@ -201,7 +201,14 @@ main_dependencies = [ 'name': 'win32-desktop', 'desc': 'win32 desktop APIs', 'deps': '(os-win32 || os-cygwin) && !uwp', - 'func': check_cc(lib=['winmm', 'gdi32', 'ole32', 'uuid', 'avrt', 'dwmapi', 'version']), + 'func': check_cc(lib=['avrt', + 'dwmapi', + 'gdi32', + 'ole32', + 'uuid', + 'uxtheme', + 'version', + 'winmm']), }, { 'name': '--win32-internal-pthreads', 'desc': 'internal pthread wrapper for win32 (Vista+)', -- cgit v1.2.3