[PATCH v4 0/3] MR9795: comctl32: Set default acceleration values for up-down controls.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57516 -- v4: comctl32: Fix the UDM_GETACCEL return value. https://gitlab.winehq.org/wine/wine/-/merge_requests/9795
From: Sven Baars <sbaars@codeweavers.com> --- dlls/comctl32/tests/updown.c | 37 +++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c index d863e2692e0..543da04dfeb 100644 --- a/dlls/comctl32/tests/updown.c +++ b/dlls/comctl32/tests/updown.c @@ -48,6 +48,7 @@ #include <stdio.h> #include "wine/test.h" +#include "v6util.h" #include "msg.h" #define expect(expected,got) expect_(__LINE__, expected, got) @@ -603,7 +604,7 @@ static void test_updown_pos32(void) DestroyWindow(updown); } -static void test_updown_buddy(void) +static void test_updown_buddy(BOOL is_v6) { HWND updown, buddyReturn, buddy; RECT rect, rect2; @@ -646,7 +647,7 @@ static void test_updown_buddy(void) updown= create_updown_control(UDS_ALIGNRIGHT | UDS_ARROWKEYS, buddy); ok(proc != (WNDPROC)GetWindowLongPtrA(buddy, GWLP_WNDPROC), "Subclassing expected\n"); - if (pSetWindowSubclass) + if (pSetWindowSubclass && ! is_v6) { /* updown uses subclass helpers for buddy on >5.8x systems */ ok(GetPropA(buddy, "CC32SubclassInfo") != NULL, "Expected CC32SubclassInfo property\n"); @@ -1078,6 +1079,9 @@ static void init_functions(void) START_TEST(updown) { + ULONG_PTR ctx_cookie; + HANDLE hCtx; + init_functions(); init_msg_sequences(sequences, NUM_MSG_SEQUENCES); @@ -1092,7 +1096,32 @@ START_TEST(updown) test_updown_create(); test_updown_pos(); test_updown_pos32(); - test_updown_buddy(); + test_updown_buddy(FALSE); + test_updown_base(); + test_updown_unicode(); + test_UDS_SETBUDDY(); + test_UDS_SETBUDDYINT(); + test_CreateUpDownControl(); + test_updown_pos_notifications(); + + DestroyWindow(g_edit); + + if (!load_v6_module(&ctx_cookie, &hCtx)) + { + DestroyWindow(parent_wnd); + return; + } + + init_functions(); + + g_edit = create_edit_control(); + ok(g_edit != NULL, "Failed to create edit control\n"); + + /* comctl32 version 6 tests start here */ + test_updown_create(); + test_updown_pos(); + test_updown_pos32(); + test_updown_buddy(TRUE); test_updown_base(); test_updown_unicode(); test_UDS_SETBUDDY(); @@ -1102,6 +1131,8 @@ START_TEST(updown) uninit_winevent_hook(); + unload_v6_module(ctx_cookie, hCtx); + DestroyWindow(g_edit); DestroyWindow(parent_wnd); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9795
From: Sven Baars <sbaars@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57516 --- dlls/comctl32/tests/updown.c | 34 ++++++++++++++++++++++++++++++++++ dlls/comctl32/updown.c | 14 +++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c index 543da04dfeb..750813eccd9 100644 --- a/dlls/comctl32/tests/updown.c +++ b/dlls/comctl32/tests/updown.c @@ -1065,6 +1065,38 @@ static void test_UDS_SETBUDDY(void) DestroyWindow(updown); } +static void test_accel(void) +{ + UDACCEL accel[4]; + HWND updown; + int r; + + updown = create_updown_control(UDS_ALIGNRIGHT, g_edit); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + r = SendMessageA(updown, UDM_GETACCEL, 4, (LPARAM)accel); + expect(3, r); + expect(0, accel[0].nSec); + expect(1, accel[0].nInc); + expect(2, accel[1].nSec); + expect(5, accel[1].nInc); + expect(5, accel[2].nSec); + expect(20, accel[2].nInc); + + accel[0].nSec = 0; + accel[0].nInc = 5; + r = SendMessageA(updown, UDM_SETACCEL, 1, (LPARAM)accel); + expect(TRUE, r); + + r = SendMessageA(updown, UDM_GETACCEL, 3, (LPARAM)accel); + expect(1, r); + expect(0, accel[0].nSec); + expect(5, accel[0].nInc); + + DestroyWindow(updown); +} + static void init_functions(void) { HMODULE hComCtl32 = LoadLibraryA("comctl32.dll"); @@ -1103,6 +1135,7 @@ START_TEST(updown) test_UDS_SETBUDDYINT(); test_CreateUpDownControl(); test_updown_pos_notifications(); + test_accel(); DestroyWindow(g_edit); @@ -1128,6 +1161,7 @@ START_TEST(updown) test_UDS_SETBUDDYINT(); test_CreateUpDownControl(); test_updown_pos_notifications(); + test_accel(); uninit_winevent_hook(); diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index afa96c87ec4..b136db153a0 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -999,9 +999,6 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L infoPtr->Self = hwnd; infoPtr->Notify = pcs->hwndParent; infoPtr->dwStyle = pcs->style; - infoPtr->AccelCount = 0; - infoPtr->AccelVect = 0; - infoPtr->AccelIndex = -1; infoPtr->CurVal = 0; infoPtr->MinVal = 100; infoPtr->MaxVal = 0; @@ -1009,6 +1006,17 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L infoPtr->Buddy = 0; /* No buddy window yet */ infoPtr->Flags = (infoPtr->dwStyle & UDS_SETBUDDYINT) ? FLAG_BUDDYINT : 0; + infoPtr->AccelCount = 3; + infoPtr->AccelIndex = -1; + infoPtr->AccelVect = Alloc(infoPtr->AccelCount * sizeof(UDACCEL)); + + infoPtr->AccelVect[0].nSec = 0; + infoPtr->AccelVect[0].nInc = 1; + infoPtr->AccelVect[1].nSec = 2; + infoPtr->AccelVect[1].nInc = 5; + infoPtr->AccelVect[2].nSec = 5; + infoPtr->AccelVect[2].nInc = 20; + SetWindowLongW (hwnd, GWL_STYLE, infoPtr->dwStyle & ~WS_BORDER); if (!(infoPtr->dwStyle & UDS_HORZ)) SetWindowPos (hwnd, NULL, 0, 0, DEFAULT_WIDTH, pcs->cy, -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9795
From: Sven Baars <sbaars@codeweavers.com> --- dlls/comctl32/tests/updown.c | 8 ++++++++ dlls/comctl32/updown.c | 14 ++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c index 750813eccd9..f86597dc7d8 100644 --- a/dlls/comctl32/tests/updown.c +++ b/dlls/comctl32/tests/updown.c @@ -1075,6 +1075,14 @@ static void test_accel(void) flush_sequences(sequences, NUM_MSG_SEQUENCES); + r = SendMessageA(updown, UDM_GETACCEL, 0, (LPARAM)accel); + expect(3, r); + + r = SendMessageA(updown, UDM_GETACCEL, 1, (LPARAM)accel); + expect(3, r); + expect(0, accel[0].nSec); + expect(1, accel[0].nInc); + r = SendMessageA(updown, UDM_GETACCEL, 4, (LPARAM)accel); expect(3, r); expect(0, accel[0].nSec); diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index b136db153a0..ba7c89a822c 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -1145,14 +1145,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L case WM_PAINT: return UPDOWN_Paint (infoPtr, (HDC)wParam); - case UDM_GETACCEL: - if (wParam==0 && lParam==0) return infoPtr->AccelCount; - if (wParam && lParam) { - int temp = min(infoPtr->AccelCount, wParam); - memcpy((void *)lParam, infoPtr->AccelVect, temp*sizeof(UDACCEL)); - return temp; - } - return 0; + case UDM_GETACCEL: + if (wParam && lParam) { + int temp = min(infoPtr->AccelCount, wParam); + memcpy((void *)lParam, infoPtr->AccelVect, temp * sizeof(UDACCEL)); + } + return infoPtr->AccelCount; case UDM_SETACCEL: { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9795
This merge request was approved by Nikolay Sivov. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9795
participants (3)
-
Nikolay Sivov (@nsivov) -
Sven Baars -
Sven Baars (@sbaars)