Module: wine Branch: master Commit: b48f394e4f3ee73eb2f974d19770d411d13f3e62 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b48f394e4f3ee73eb2f974d197...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Thu Apr 12 00:42:55 2012 +0900
comctl32: Add support for retrieving lpszText in TOOLINFO structure.
---
dlls/comctl32/tests/tooltips.c | 16 ++++++++++++++++ dlls/comctl32/tooltips.c | 27 +++++++++++++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index 596598f..31504d1 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -322,6 +322,11 @@ static void test_gettext(void) toolinfoA.lpszText = bufA; SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n"); + + toolinfoA.lpszText = bufA; + SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); + ok(toolinfoA.lpszText == NULL, + "expected NULL, got %p", toolinfoA.lpszText); } else { @@ -355,6 +360,12 @@ static void test_gettext(void) SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); ok(strcmp(toolinfoA.lpszText, testtipA) == 0, "lpszText should be an empty string\n");
+ memset(bufA, 0x1f, sizeof(bufA)); + toolinfoA.lpszText = bufA; + SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); + ok(strcmp(toolinfoA.lpszText, testtipA) == 0, + "expected %s, got %p\n", testtipA, toolinfoA.lpszText); + length = SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0); ok(length == 0, "Expected 0, got %d\n", length); } @@ -378,6 +389,11 @@ static void test_gettext(void) SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); ok(strcmp(toolinfoA.lpszText, testcallbackA) == 0, "lpszText should be an (%s) string\n", testcallbackA); + + toolinfoA.lpszText = bufA; + SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); + ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA, + "expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText); }
DestroyWindow(hwnd); diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 162867d..1d758b4 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -943,6 +943,21 @@ TOOLTIPS_GetToolFromPoint (const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT return -1; }
+static inline void +TOOLTIPS_CopyInfoT (const TTTOOL_INFO *toolPtr, TTTOOLINFOW *ti, BOOL isW) +{ + if (ti->lpszText) { + if (toolPtr->lpszText == NULL || + IS_INTRESOURCE(toolPtr->lpszText) || + toolPtr->lpszText == LPSTR_TEXTCALLBACKW) + ti->lpszText = toolPtr->lpszText; + else if (isW) + strcpyW (ti->lpszText, toolPtr->lpszText); + else + WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1, + (LPSTR)ti->lpszText, INFOTIPSIZE, NULL, NULL); + } +}
static BOOL TOOLTIPS_IsWindowActive (HWND hwnd) @@ -1199,8 +1214,7 @@ TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti, ti->uId = toolPtr->uId; ti->rect = toolPtr->rect; ti->hinst = toolPtr->hinst; -/* ti->lpszText = toolPtr->lpszText; */ - ti->lpszText = NULL; /* FIXME */ + TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
if (ti->cbSize >= TTTOOLINFOA_V2_SIZE) ti->lParam = toolPtr->lParam; @@ -1246,8 +1260,7 @@ TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL is ti->uFlags = toolPtr->uFlags; ti->rect = toolPtr->rect; ti->hinst = toolPtr->hinst; -/* ti->lpszText = toolPtr->lpszText; */ - ti->lpszText = NULL; /* FIXME */ + TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE) ti->lParam = toolPtr->lParam; @@ -1385,8 +1398,7 @@ TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW) ti->uFlags = toolPtr->uFlags; ti->rect = toolPtr->rect; ti->hinst = toolPtr->hinst; -/* lpToolInfo->lpszText = toolPtr->lpszText; */ - ti->lpszText = NULL; /* FIXME */ + TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE) ti->lParam = toolPtr->lParam; @@ -1420,8 +1432,7 @@ TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit, lptthit->ti.uId = toolPtr->uId; lptthit->ti.rect = toolPtr->rect; lptthit->ti.hinst = toolPtr->hinst; -/* lptthit->ti.lpszText = toolPtr->lpszText; */ - lptthit->ti.lpszText = NULL; /* FIXME */ + TOOLTIPS_CopyInfoT (toolPtr, &lptthit->ti, isW); if (lptthit->ti.cbSize >= TTTOOLINFOW_V2_SIZE) lptthit->ti.lParam = toolPtr->lParam; }