Skip to content

Commit

Permalink
win32: allow window frame to be drawn in dark mode colors based on sy…
Browse files Browse the repository at this point in the history
…stem 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 lest on my system. Feel free to report it
to Microsoft and ping me when they release proper API for that. Until
then this small improvment is a step the right direction.

Fixes: mpv-player#6901
  • Loading branch information
kasper93 committed Mar 19, 2023
1 parent 7846832 commit 88b47c1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions video/out/w32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 88b47c1

Please sign in to comment.