fix: initial dark mode title bar on Windows 10 (#39287)

This commit is contained in:
David Sanders 2023-07-31 22:02:23 -07:00 committed by GitHub
parent cfc0826b65
commit b2c62d6ad1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 11 deletions

View file

@ -25,16 +25,6 @@ HRESULT TrySetWindowTheme(HWND hWnd, bool dark) {
if (FAILED(result))
return result;
auto* os_info = base::win::OSInfo::GetInstance();
auto const version = os_info->version();
// Toggle the nonclient area active state to force a redraw (Win10 workaround)
if (version < base::win::Version::WIN11) {
HWND activeWindow = GetActiveWindow();
SendMessage(hWnd, WM_NCACTIVATE, hWnd != activeWindow, 0);
SendMessage(hWnd, WM_NCACTIVATE, hWnd == activeWindow, 0);
}
return S_OK;
}