[PATCH v7 0/2] MR3114: comctl32: Make the correct linkid from fun SYSLINK_LinkAtPt.
Add a check condition for whether the type is slLink. Signed-off-by: Zhaoyi <zhaoyi(a)uniontech.com> -- v7: comctl32: Make the correct linkid from fun SYSLINK_LinkAtPt. https://gitlab.winehq.org/wine/wine/-/merge_requests/3114
From: Zhaoyi <zhaoyi(a)uniontech.com> Signed-off-by: Zhaoyi <zhaoyi(a)uniontech.com> --- dlls/comctl32/tests/syslink.c | 43 +++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index d5192c26b5c..5acae2aee91 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -30,6 +30,7 @@ #define SYSLINK_SEQ_INDEX 1 static HWND hWndParent; +static int g_linkid; static struct msg_sequence *sequences[NUM_MSG_SEQUENCE]; @@ -100,7 +101,24 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP } defwndproc_counter++; - ret = DefWindowProcW(hwnd, message, wParam, lParam); + switch(message) + { + case WM_NOTIFY: + { + NMLINK *nml = ((NMLINK*)lParam); + if (nml && NM_CLICK == nml->hdr.code) + { + g_linkid = nml->item.iLink ; + } + + /* Return zero to indicate default processing */ + ret = 0; + break; + } + + default: + ret = DefWindowProcW(hwnd, message, wParam, lParam); + } defwndproc_counter--; return ret; @@ -162,7 +180,7 @@ static HWND create_syslink(DWORD style, HWND parent) HWND hWndSysLink; /* Only Unicode will do here */ - hWndSysLink = CreateWindowExW(0, WC_LINK, L"Head <a href=\"link1\">Name1</a> Middle <a href=\"link2\">Name2</a> Tail", + hWndSysLink = CreateWindowExW(0, WC_LINK, L"Head <a href=\"link1\">Name1</a> Middle <a href=\"link2\">Name2</a> Middle <a href=\"link3\">Name3</a> Tail", style, 0, 0, 150, 50, parent, NULL, GetModuleHandleW(NULL), NULL); if (!hWndSysLink) return NULL; @@ -238,6 +256,26 @@ static void test_LM_GETIDEALSIZE(void) DestroyWindow(hwnd); } +static void test_GETSYSLINKID(void) +{ + HWND hwnd; + int point; + + hwnd = create_syslink(WS_CHILD | WS_TABSTOP | WS_VISIBLE, hWndParent); + ok(hwnd != NULL, "Failed to create SysLink window.\n"); + + /*the test point of link3(x=120 y=20).*/ + point = ((20 << 16) | 120); + + SendMessageA(hwnd, WM_LBUTTONDOWN, 1, (LPARAM)point); + + g_linkid = 0; + SendMessageA(hwnd, WM_LBUTTONUP, 0, (LPARAM)point); + todo_wine ok(g_linkid == 2, "GETSYSLINKID was not processed correctly!\n"); + + DestroyWindow(hwnd); +} + START_TEST(syslink) { ULONG_PTR ctx_cookie; @@ -266,6 +304,7 @@ START_TEST(syslink) test_create_syslink(); test_LM_GETIDEALHEIGHT(); test_LM_GETIDEALSIZE(); + test_GETSYSLINKID(); DestroyWindow(hWndParent); unload_v6_module(ctx_cookie, hCtx); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3114
From: Zhaoyi <zhaoyi(a)uniontech.com> Add a check condition for whether the type is slLink. Signed-off-by: Zhaoyi <zhaoyi(a)uniontech.com> --- dlls/comctl32/syslink.c | 14 ++++++++------ dlls/comctl32/tests/syslink.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index 8130bf19641..6af516ea1e6 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -1320,16 +1320,18 @@ static PDOC_ITEM SYSLINK_LinkAtPt (const SYSLINK_INFO *infoPtr, const POINT *pt, LIST_FOR_EACH_ENTRY(Current, &infoPtr->Items, DOC_ITEM, entry) { - if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) && - (!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED))) + if(Current->Type == slLink) { - if(LinkId != NULL) + if(SYSLINK_PtInDocItem(Current, *pt) && (!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED))) { - *LinkId = id; + if(LinkId != NULL) + { + *LinkId = id; + } + return Current; } - return Current; + id++; } - id++; } return NULL; diff --git a/dlls/comctl32/tests/syslink.c b/dlls/comctl32/tests/syslink.c index 5acae2aee91..2c770143cee 100644 --- a/dlls/comctl32/tests/syslink.c +++ b/dlls/comctl32/tests/syslink.c @@ -271,7 +271,7 @@ static void test_GETSYSLINKID(void) g_linkid = 0; SendMessageA(hwnd, WM_LBUTTONUP, 0, (LPARAM)point); - todo_wine ok(g_linkid == 2, "GETSYSLINKID was not processed correctly!\n"); + ok(g_linkid == 2, "GETSYSLINKID was not processed correctly!\n"); DestroyWindow(hwnd); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3114
participants (2)
-
Zhao Yi (@Zhaoyi) -
Zhaoyi