Module: wine Branch: master Commit: 8cedea0d60f567b68531be06efc4f0a21ad8b516 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8cedea0d60f567b68531be06ef...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Fri Apr 13 22:45:22 2012 +0900
comctl32: Truncate the info tip text when using ANSI version messages.
---
dlls/comctl32/tests/tooltips.c | 6 +++--- dlls/comctl32/tooltips.c | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index cf571de..c92ed62 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -668,7 +668,7 @@ static void test_longtextA(void) toolinfoA.lpszText = bufA; SendMessageA(hwnd, TTM_ENUMTOOLSA, 0, (LPARAM)&toolinfoA); textlen = lstrlenA(toolinfoA.lpszText); - todo_wine ok(textlen == 80, "lpszText has %d chars\n", textlen); + ok(textlen == 80, "lpszText has %d chars\n", textlen); ok(toolinfoA.uId == 0x1234ABCD, "uId should be retrieved, got %p\n", (void*)toolinfoA.uId);
@@ -678,7 +678,7 @@ static void test_longtextA(void) toolinfoA.lpszText = bufA; SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA); textlen = lstrlenA(toolinfoA.lpszText); - todo_wine ok(textlen == 80, "lpszText has %d chars\n", textlen); + ok(textlen == 80, "lpszText has %d chars\n", textlen);
memset(bufA, 0, sizeof(bufA)); toolinfoA.hwnd = NULL; @@ -686,7 +686,7 @@ static void test_longtextA(void) toolinfoA.lpszText = bufA; SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); textlen = lstrlenA(toolinfoA.lpszText); - todo_wine ok(textlen == 80, "lpszText has %d chars\n", textlen); + ok(textlen == 80, "lpszText has %d chars\n", textlen); }
DestroyWindow(hwnd); diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index 1d758b4..d1e57a3 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -171,6 +171,8 @@ typedef struct #define ICON_HEIGHT 16 #define ICON_WIDTH 16
+#define MAX_TEXT_SIZE_A 80 /* maximum retriving text size by ANSI message */ + static LRESULT CALLBACK TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef);
@@ -954,8 +956,9 @@ TOOLTIPS_CopyInfoT (const TTTOOL_INFO *toolPtr, TTTOOLINFOW *ti, BOOL isW) else if (isW) strcpyW (ti->lpszText, toolPtr->lpszText); else + /* ANSI version, the buffer is maximum 80 bytes without null. */ WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1, - (LPSTR)ti->lpszText, INFOTIPSIZE, NULL, NULL); + (LPSTR)ti->lpszText, MAX_TEXT_SIZE_A, NULL, NULL); } }
@@ -1341,12 +1344,13 @@ TOOLTIPS_GetTextT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
/* NB this API is broken, there is no way for the app to determine what size buffer it requires nor a way to specify how long the - one it supplies is. We'll assume it's up to INFOTIPSIZE */ + one it supplies is. According to the test result, it's up to + 80 bytes by the ANSI version. */
buffer[0] = '\0'; TOOLTIPS_GetTipText(infoPtr, nTool, buffer); WideCharToMultiByte(CP_ACP, 0, buffer, -1, (LPSTR)ti->lpszText, - INFOTIPSIZE, NULL, NULL); + MAX_TEXT_SIZE_A, NULL, NULL); }
return 0;