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