From cd8eff929d75ac46de8a80321d0bec799ae9eaae 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: [PATCH] win32: allow window frame to be drawn in dark mode colors based on system setting This is now documented way to allow dark mode window frame appearance: https://learn.microsoft.com/windows/apps/desktop/modernize/apply-windows-themes https://learn.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute I'm not interested in various undocumented APIs to make context menu dark and so on. Documentation says this DWM attribute is supported starting with Windows 11 Build 22000. It seems to work well on Windows 10... while in fact doesn't work on Windows 11, at least on my system. Feel free to report it to Microsoft and ping me when they release proper API for that. Until then this small improvement is a step in the right direction. Fixes: #6901 --- video/out/w32_common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 76564cc267ccb..a2a908bdc14ff 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -1545,6 +1545,9 @@ static void *gui_thread(void *ptr) goto done; } + DwmSetWindowAttribute(w32->window, 20 /* DWMWA_USE_IMMERSIVE_DARK_MODE */, + &(BOOL){TRUE}, sizeof(BOOL)); + if (SUCCEEDED(OleInitialize(NULL))) { ole_ok = true;