1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-01 07:14:31 +00:00

comctl32/tooltips: Don't duplicate font when handling WM_SETFONT.

This reverts 06effbf0.
This commit is contained in:
Zhiyi Zhang 2024-05-14 12:24:31 +08:00 committed by Alexandre Julliard
parent 480598680c
commit c9452db769
2 changed files with 7 additions and 6 deletions

View File

@ -1231,7 +1231,6 @@ static void test_WM_SETFONT(void)
if (tests[i].use_system_font)
ok(hfont2 == NULL, "Got unexpected font %p.\n", hfont2);
else
todo_wine_if(!lstrcmpA(tests[i].class_name, TOOLTIPS_CLASSA))
ok(hfont2 == hfont, "Got unexpected font %p.\n", hfont2);
ret = GetObjectA(hfont, sizeof(lf), &lf);
ok(ret == sizeof(lf), "GetObjectA failed, error %lu.\n", GetLastError());

View File

@ -131,6 +131,7 @@ typedef struct
COLORREF clrBk;
COLORREF clrText;
HFONT hFont;
HFONT hStatusFont;
HFONT hTitleFont;
INT xTrackPos;
INT yTrackPos;
@ -194,14 +195,16 @@ TOOLTIPS_InitSystemSettings (TOOLTIPS_INFO *infoPtr)
infoPtr->clrBk = comctl32_color.clrInfoBk;
infoPtr->clrText = comctl32_color.clrInfoText;
DeleteObject (infoPtr->hFont);
DeleteObject (infoPtr->hStatusFont);
nclm.cbSize = sizeof(nclm);
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(nclm), &nclm, 0);
infoPtr->hFont = CreateFontIndirectW (&nclm.lfStatusFont);
infoPtr->hStatusFont = CreateFontIndirectW (&nclm.lfStatusFont);
DeleteObject (infoPtr->hTitleFont);
nclm.lfStatusFont.lfWeight = FW_BOLD;
infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont);
infoPtr->hFont = infoPtr->hStatusFont;
}
/* Custom draw routines */
@ -1854,7 +1857,7 @@ TOOLTIPS_Destroy (TOOLTIPS_INFO *infoPtr)
DeleteObject(infoPtr->hTitleIcon);
/* delete fonts */
DeleteObject (infoPtr->hFont);
DeleteObject (infoPtr->hStatusFont);
DeleteObject (infoPtr->hTitleFont);
/* free tool tips info data */
@ -1952,8 +1955,7 @@ TOOLTIPS_SetFont (TOOLTIPS_INFO *infoPtr, HFONT hFont, BOOL redraw)
if(!GetObjectW(hFont, sizeof(lf), &lf))
return 0;
DeleteObject (infoPtr->hFont);
infoPtr->hFont = CreateFontIndirectW(&lf);
infoPtr->hFont = hFont;
DeleteObject (infoPtr->hTitleFont);
lf.lfWeight = FW_BOLD;