Module: wine Branch: master Commit: c9452db7693970eb182f841f5bcb43cd4e03501a URL: https://gitlab.winehq.org/wine/wine/-/commit/c9452db7693970eb182f841f5bcb43c...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Tue May 14 12:24:31 2024 +0800
comctl32/tooltips: Don't duplicate font when handling WM_SETFONT.
This reverts 06effbf0.
---
dlls/comctl32/tests/misc.c | 1 - dlls/comctl32/tooltips.c | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tests/misc.c b/dlls/comctl32/tests/misc.c index c57f4581a4b..0ecf240ae4d 100644 --- a/dlls/comctl32/tests/misc.c +++ b/dlls/comctl32/tests/misc.c @@ -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()); diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 95ef8da6794..2353d4018ac 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -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;