From: Larry Starr <Larry_A_Starr@yahoo.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58236 Signed-off-by: Larry Starr <Larry_A_Starr@yahoo.com> --- dlls/comctl32/tests/tooltips.c | 8 ++++---- dlls/comctl32/tooltips.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index 30d3a6d89da..36904aac3ad 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -1230,20 +1230,20 @@ static void test_TTM_SETTITLE(void) /* Icon requested with NULL title — must be suppressed */ SendMessageW(tt, TTM_SETTITLEW, TTI_WARNING, (LPARAM)NULL); get_tracked_size(tt, &info, &sz_null_icon); - todo_wine ok(sz_null_icon.cy == sz_no_title.cy, + ok(sz_null_icon.cy == sz_no_title.cy, "NULL title + icon: height %ld, expected %ld (same as no-title)\n", sz_null_icon.cy, sz_no_title.cy); - todo_wine ok(sz_null_icon.cx == sz_no_title.cx, + ok(sz_null_icon.cx == sz_no_title.cx, "NULL title + icon: width %ld, expected %ld (same as no-title)\n", sz_null_icon.cx, sz_no_title.cx); /* Icon requested with empty string title — must also be suppressed */ SendMessageW(tt, TTM_SETTITLEW, TTI_WARNING, (LPARAM)L""); get_tracked_size(tt, &info, &sz_empty_icon); - todo_wine ok(sz_empty_icon.cy == sz_no_title.cy, + ok(sz_empty_icon.cy == sz_no_title.cy, "empty title + icon: height %ld, expected %ld (same as no-title)\n", sz_empty_icon.cy, sz_no_title.cy); - todo_wine ok(sz_empty_icon.cx == sz_no_title.cx, + ok(sz_empty_icon.cx == sz_no_title.cx, "empty title + icon: width %ld, expected %ld (same as no-title)\n", sz_empty_icon.cx, sz_no_title.cx); diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 876736b11e4..f150efeabc1 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -1638,7 +1638,8 @@ TOOLTIPS_SetTitleT (TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitl Free(infoPtr->pszTitle); - if (pszTitle) + /* Suppress title and icon if title is NULL or empty (MSDN, bug 58236). */ + if (pszTitle && (isW ? ((LPCWSTR)pszTitle)[0] : ((LPCSTR)pszTitle)[0])) { if (isW) { @@ -1671,10 +1672,15 @@ TOOLTIPS_SetTitleT (TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitl infoPtr->iconHeight = GetSystemMetrics(SM_CYSMICON); } - if (uTitleIcon <= TTI_ERROR_LARGE) - infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; + if (infoPtr->pszTitle) + { + if (uTitleIcon <= TTI_ERROR_LARGE) + infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon]; + else + infoPtr->hTitleIcon = CopyIcon((HICON)uTitleIcon); + } else - infoPtr->hTitleIcon = CopyIcon((HICON)uTitleIcon); + infoPtr->hTitleIcon = NULL; TRACE("icon = %p\n", infoPtr->hTitleIcon); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10340