Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
-- v2: comctl32/listview: Handle WM_VSCROLL(SB_TOP). comctl32/listview: Invert origin coordinate for LVM_GETORIGIN. comctl32/tests: Add a test for LVM_GETORIGIN returned coordinate. comctl32/tests: Run LVM_GETORIGIN tests on v6.
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/tests/listview.c | 77 ++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 26 deletions(-)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 1a9831bbaec..3629f82904f 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2403,51 +2403,75 @@ static void test_item_position(void) DestroyWindow(hwnd); }
-static void test_getorigin(void) +static void test_LVM_GETORIGIN(BOOL is_v6) { - /* LVM_GETORIGIN */ - + POINT position; HWND hwnd; DWORD r; - POINT position; - - position.x = position.y = 0;
hwnd = create_listview_control(LVS_ICON); ok(hwnd != NULL, "failed to create a listview window\n"); - flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ position.x = position.y = 123; r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(TRUE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + ok(r == 1, "Unexpected return value %lu.\n", r); + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); DestroyWindow(hwnd);
hwnd = create_listview_control(LVS_SMALLICON); ok(hwnd != NULL, "failed to create a listview window\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES);
+ position.x = position.y = 123; r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(TRUE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + ok(r == 1, "Unexpected return value %lu.\n", r); + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); DestroyWindow(hwnd);
- hwnd = create_listview_control(LVS_LIST); - ok(hwnd != NULL, "failed to create a listview window\n"); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + if (is_v6) + { + hwnd = create_listview_control(LVS_LIST); + ok(hwnd != NULL, "failed to create a listview window\n");
- r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(FALSE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); - DestroyWindow(hwnd); + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + todo_wine + ok(r, "Unexpected return value %lu.\n", r); + todo_wine + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd);
- hwnd = create_listview_control(LVS_REPORT); - ok(hwnd != NULL, "failed to create a listview window\n"); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + hwnd = create_listview_control(LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n");
- r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); - expect(FALSE, r); - flush_sequences(sequences, NUM_MSG_SEQUENCES); - DestroyWindow(hwnd); + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + todo_wine + ok(r, "Unexpected return value %lu.\n", r); + todo_wine + ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd); + } + else + { + hwnd = create_listview_control(LVS_LIST); + ok(hwnd != NULL, "failed to create a listview window\n"); + + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + ok(!r, "Unexpected return value %lu.\n", r); + ok(position.x == 123 && position.y == 123, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd); + + hwnd = create_listview_control(LVS_REPORT); + ok(hwnd != NULL, "failed to create a listview window\n"); + + position.x = position.y = 123; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + ok(!r, "Unexpected return value %lu.\n", r); + ok(position.x == 123 && position.y == 123, "Unexpected position %ld,%ld.\n", position.x, position.y); + DestroyWindow(hwnd); + } }
static void test_multiselect(void) @@ -7293,7 +7317,7 @@ START_TEST(listview) test_item_count(); test_item_position(); test_columns(); - test_getorigin(); + test_LVM_GETORIGIN(FALSE); test_multiselect(); test_getitemrect(); test_subitem_rect(); @@ -7387,6 +7411,7 @@ START_TEST(listview) test_LVM_GETNEXTITEM(); test_LVM_SETBKIMAGE(TRUE); test_LVM_GETHOTCURSOR(); + test_LVM_GETORIGIN(TRUE);
unload_v6_module(ctx_cookie, hCtx);
From: Nikolay Sivov nsivov@codeweavers.com
--- dlls/comctl32/tests/listview.c | 45 ++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index 3629f82904f..b9320475099 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -561,6 +561,21 @@ static void release_key(int vk) ok(res, "SetKeyboardState failed.\n"); }
+static void flush_events(void) +{ + MSG msg; + int diff = 200; + int min_timeout = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break; + while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + diff = time - GetTickCount(); + } +} + static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; @@ -2408,6 +2423,7 @@ static void test_LVM_GETORIGIN(BOOL is_v6) POINT position; HWND hwnd; DWORD r; + int i;
hwnd = create_listview_control(LVS_ICON); ok(hwnd != NULL, "failed to create a listview window\n"); @@ -2416,6 +2432,20 @@ static void test_LVM_GETORIGIN(BOOL is_v6) r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); ok(r == 1, "Unexpected return value %lu.\n", r); ok(!position.x && !position.y, "Unexpected position %ld,%ld.\n", position.x, position.y); + + for (i = 0; i < 10; i++) + insert_item(hwnd, i); + flush_events(); + + r = SendMessageA(hwnd, LVM_SCROLL, 0, 50); + ok(r, "Unexpected return value %lu.\n", r); + + position.x = position.y = 0; + r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); + ok(r == 1, "Unexpected return value %lu.\n", r); + todo_wine + ok(position.y == 50, "Unexpected position %ld.\n", position.y); + DestroyWindow(hwnd);
hwnd = create_listview_control(LVS_SMALLICON); @@ -6514,21 +6544,6 @@ static void test_header_proc(void) DestroyWindow(hwnd); }
-static void flush_events(void) -{ - MSG msg; - int diff = 200; - int min_timeout = 100; - DWORD time = GetTickCount() + diff; - - while (diff > 0) - { - if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break; - while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); - diff = time - GetTickCount(); - } -} - static void test_oneclickactivate(void) { TRACKMOUSEEVENT track;
From: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57948 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 10 ++++++++-- dlls/comctl32/tests/listview.c | 1 - 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 9191aef1c3f..14786ec2b7a 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -11552,11 +11552,17 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 1;
case LVM_GETORIGIN: - if (!lParam) return FALSE; + { + POINT *point = (POINT *)lParam; + + if (!point) return FALSE; if (infoPtr->uView == LV_VIEW_DETAILS || infoPtr->uView == LV_VIEW_LIST) return FALSE; - LISTVIEW_GetOrigin(infoPtr, (LPPOINT)lParam); + LISTVIEW_GetOrigin(infoPtr, point); + point->x = -point->x; + point->y = -point->y; return TRUE; + }
/* case LVM_GETOUTLINECOLOR: */
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c index b9320475099..1a212e5d0ad 100644 --- a/dlls/comctl32/tests/listview.c +++ b/dlls/comctl32/tests/listview.c @@ -2443,7 +2443,6 @@ static void test_LVM_GETORIGIN(BOOL is_v6) position.x = position.y = 0; r = SendMessageA(hwnd, LVM_GETORIGIN, 0, (LPARAM)&position); ok(r == 1, "Unexpected return value %lu.\n", r); - todo_wine ok(position.y == 50, "Unexpected position %ld.\n", position.y);
DestroyWindow(hwnd);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/comctl32/listview.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 14786ec2b7a..1a0c919e962 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -9842,6 +9842,10 @@ static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *infoPtr, INT nScrollCode, nScrollDiff = scrollInfo.nPage; break;
+ case SB_TOP: + nScrollDiff = -nOldScrollPos; + break; + case SB_THUMBPOSITION: case SB_THUMBTRACK: nScrollDiff = scrollInfo.nTrackPos - scrollInfo.nPos;
On Wed Mar 12 07:51:30 2025 +0000, Zhiyi Zhang wrote:
What about something like this?[mr7541-listview.txt](/uploads/15b45969883a8ddba0fd933b5b89cef3/mr7541-listview.txt)
Yes, thank you. Pushed with flush_events() change, that good gives results, at least locally.
This merge request was approved by Zhiyi Zhang.