[COMCTL32] ListView must update header font if it deletes the old font (#8287)

A bug fix for PR #7783
This commit is contained in:
Whindmar Saksit
2025-08-03 23:33:00 +02:00
committed by GitHub
parent 94a6102cd2
commit 58276e81ee
+6
View File
@@ -12013,6 +12013,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
wParam == SPI_SETNONCLIENTMETRICS ||
(!wParam && !lParam))
{
HFONT hOldDefaultFont = infoPtr->hDefaultFont;
BOOL bDefaultOrNullFont = (infoPtr->hDefaultFont == infoPtr->hFont || !infoPtr->hFont);
LOGFONTW logFont;
SystemParametersInfoW(SPI_GETICONTITLELOGFONT, 0, &logFont, 0);
@@ -12025,7 +12026,12 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
infoPtr->hDefaultFont = CreateFontIndirectW(&logFont);
if (bDefaultOrNullFont)
{
infoPtr->hFont = infoPtr->hDefaultFont;
// Check if we just deleted the font the header is using
if (infoPtr->hwndHeader && hOldDefaultFont == GetWindowFont(infoPtr->hwndHeader))
SendMessageW(infoPtr->hwndHeader, WM_SETFONT, (WPARAM)infoPtr->hFont, TRUE);
}
LISTVIEW_SaveTextMetrics(infoPtr);
LISTVIEW_UpdateItemSize(infoPtr);