Module: wine Branch: master Commit: 9618aae324032337098b259ddba939490c9de25f URL: http://source.winehq.org/git/wine.git/?a=commit;h=9618aae324032337098b259ddb...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Jul 22 12:51:12 2016 +0300
comctl32/tooltips: Fix TTM_GETMARGIN/TTM_SETMARGIN handling.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 422dd43..feb74ad 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 eed113e..4944e3b 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; }