mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Hack to force redraw on some versions of Windows.
This commit is contained in:
parent
c0a2c437a7
commit
be927af222
@ -293,9 +293,19 @@ namespace cursespp {
|
||||
if (dwmSetWindowAttribute) {
|
||||
const auto settings = UISettings();
|
||||
const auto foreground = settings.GetColorValue(UIColorType::Foreground);
|
||||
BOOL isDarkMode = (((5 * foreground.G) + (2 * foreground.R) + foreground.B) > (8 * 128));
|
||||
const BOOL isDarkMode = (((5 * foreground.G) + (2 * foreground.R) + foreground.B) > (8 * 128));
|
||||
HWND mainHwnd = GetMainWindow();
|
||||
dwmSetWindowAttribute(mainHwnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &isDarkMode, sizeof(isDarkMode));
|
||||
/* on some versions of Windows this doesn't redraw immediately; this hack very slightly resizes
|
||||
the window to force a repaint... no amount of UpdateWindow/RedrawWindow/etc would do the trick */
|
||||
RECT rect = { 0 };
|
||||
GetWindowRect(mainWindow, &rect);
|
||||
SetWindowPos(
|
||||
mainWindow,
|
||||
0,
|
||||
rect.left, rect.top,
|
||||
rect.right - rect.left, rect.bottom - rect.top + 1,
|
||||
SWP_DRAWFRAME | SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
FreeLibrary(dwmapiDll);
|
||||
|
Loading…
Reference in New Issue
Block a user