From 9618aae324032337098b259ddba939490c9de25f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 22 Jul 2016 12:51:12 +0300 Subject: [PATCH] comctl32/tooltips: Fix TTM_GETMARGIN/TTM_SETMARGIN handling. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/tests/tooltips.c | 38 ++++++++++++++++++++++++++++++++++++++ dlls/comctl32/tooltips.c | 16 ++++++---------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/dlls/comctl32/tests/tooltips.c b/dlls/comctl32/tests/tooltips.c index 422dd43feb0..feb74ad304f 100644 --- a/dlls/comctl32/tests/tooltips.c +++ b/dlls/comctl32/tests/tooltips.c @@ -1010,6 +1010,43 @@ static void test_setinfo(void) DestroyWindow(parent2); } +static void test_margin(void) +{ + RECT r, r1; + HWND hwnd; + DWORD ret; + + hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0, + 10, 10, 300, 100, + NULL, NULL, NULL, 0); + ok(hwnd != NULL, "failed to create tooltip wnd\n"); + + ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0); + ok(!ret, "got %d\n", ret); + + SetRect(&r, -1, -1, 1, 1); + ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, (LPARAM)&r); + ok(!ret, "got %d\n", ret); + + SetRect(&r1, 0, 0, 0, 0); + ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1); + ok(!ret, "got %d\n", ret); + ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r)); + + ret = SendMessageA(hwnd, TTM_SETMARGIN, 0, 0); + ok(!ret, "got %d\n", ret); + + SetRect(&r1, 0, 0, 0, 0); + ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, (LPARAM)&r1); + ok(!ret, "got %d\n", ret); + ok(EqualRect(&r, &r1), "got %s, was %s\n", wine_dbgstr_rect(&r1), wine_dbgstr_rect(&r)); + + ret = SendMessageA(hwnd, TTM_GETMARGIN, 0, 0); + ok(!ret, "got %d\n", ret); + + DestroyWindow(hwnd); +} + START_TEST(tooltips) { InitCommonControls(); @@ -1022,4 +1059,5 @@ START_TEST(tooltips) test_longtextW(); test_track(); test_setinfo(); + test_margin(); } diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index eed113ea3ae..4944e3bc4eb 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -1323,12 +1323,10 @@ TOOLTIPS_GetDelayTime (const TOOLTIPS_INFO *infoPtr, DWORD duration) static LRESULT -TOOLTIPS_GetMargin (const TOOLTIPS_INFO *infoPtr, LPRECT lpRect) +TOOLTIPS_GetMargin (const TOOLTIPS_INFO *infoPtr, RECT *rect) { - lpRect->left = infoPtr->rcMargin.left; - lpRect->right = infoPtr->rcMargin.right; - lpRect->bottom = infoPtr->rcMargin.bottom; - lpRect->top = infoPtr->rcMargin.top; + if (rect) + *rect = infoPtr->rcMargin; return 0; } @@ -1600,12 +1598,10 @@ TOOLTIPS_SetDelayTime (TOOLTIPS_INFO *infoPtr, DWORD duration, INT nTime) static LRESULT -TOOLTIPS_SetMargin (TOOLTIPS_INFO *infoPtr, const RECT *lpRect) +TOOLTIPS_SetMargin (TOOLTIPS_INFO *infoPtr, const RECT *rect) { - infoPtr->rcMargin.left = lpRect->left; - infoPtr->rcMargin.right = lpRect->right; - infoPtr->rcMargin.bottom = lpRect->bottom; - infoPtr->rcMargin.top = lpRect->top; + if (rect) + infoPtr->rcMargin = *rect; return 0; } -- 2.11.4.GIT