[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#51404: Support system dark mode on Windows 10
From: |
Vince Salvino |
Subject: |
bug#51404: Support system dark mode on Windows 10 |
Date: |
Fri, 14 Jan 2022 06:00:07 +0000 |
So, playing around with the idea of dynamically toggling dark/light modes
on-the-fly, rather than only at program initialization as this patch currently
does. I got a proof of concept working, however there is one ugly caveat. In
order to change the theme, we must keep track of every window handle in
existence (frame, scroll bar, other UI element) in a global.
The code for this is relatively simple, we can watch for WM_SETTINGCHANGE (in
w32_wnd_proc) and then call w32_applytheme (which also needs a few
modifications) to all of the HWND objects. But it seems like it would get quite
messy and bloated to be storing references to all of these in globals. We would
probably need some kind of array of references, and then loop through them upon
receiving the signal.
The pseudo-code is something like:
// Add every hwnd in existence to this array.
global_hwnds = []
w32_wnd_proc() {
...
case WM_SETTINGCHANGE:
for each hwnd in global_hwnds {
w32_applytheme(hwnd);
}
...
}
Thoughts? Is it worth it?
Vince Salvino
- bug#51404: Support system dark mode on Windows 10,
Vince Salvino <=