comctl32/trackbar: Do not consider window size when initializing fixed length thumb.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47143
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-06-03 13:10:04 +03:00 committed by Alexandre Julliard
parent e1844f5b53
commit d5f8eb333c
2 changed files with 28 additions and 9 deletions

View File

@ -931,7 +931,7 @@ static void test_selection(void)
static void test_thumb_length(void)
{
HWND hWndTrackbar;
int r;
int r, r2;
hWndTrackbar = create_trackbar(defaultstyle, hWndParent);
ok(hWndTrackbar != NULL, "Expected non NULL value\n");
@ -963,6 +963,22 @@ static void test_thumb_length(void)
ok_sequence(sequences, PARENT_SEQ_INDEX, parent_thumb_length_test_seq, "parent thumb length test sequence", TRUE);
DestroyWindow(hWndTrackbar);
/* Fixed thumb length does not depend on window size. */
hWndTrackbar = CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", WS_VISIBLE | TBS_ENABLESELRANGE
| TBS_FIXEDLENGTH, 0, 0, 0, 0, hWndParent, NULL, GetModuleHandleA(NULL), NULL);
r = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0, 0);
DestroyWindow(hWndTrackbar);
hWndTrackbar = CreateWindowA(TRACKBAR_CLASSA, "Trackbar Control", WS_VISIBLE | TBS_ENABLESELRANGE
| TBS_FIXEDLENGTH, 0, 0, 200, 200, hWndParent, NULL, GetModuleHandleA(NULL), NULL);
r2 = SendMessageA(hWndTrackbar, TBM_GETTHUMBLENGTH, 0, 0);
ok(r2 == r, "Unexpected thumb length %d.\n", r);
DestroyWindow(hWndTrackbar);
}
static void test_tic_settings(void)

View File

@ -1481,15 +1481,18 @@ TRACKBAR_InitializeThumb (TRACKBAR_INFO *infoPtr)
infoPtr->uThumbLen = get_scaled_metric(infoPtr, infoPtr->dwStyle & TBS_ENABLESELRANGE ? 23 : 21);
GetClientRect(infoPtr->hwndSelf,&rect);
if (infoPtr->dwStyle & TBS_VERT)
client_size = rect.right - rect.left;
else
client_size = rect.bottom - rect.top;
if (!(infoPtr->dwStyle & TBS_FIXEDLENGTH))
{
GetClientRect(infoPtr->hwndSelf, &rect);
if (infoPtr->dwStyle & TBS_VERT)
client_size = rect.right - rect.left;
else
client_size = rect.bottom - rect.top;
if (client_size < infoPtr->uThumbLen)
infoPtr->uThumbLen = client_size > get_scaled_metric(infoPtr, 9) ?
client_size - get_scaled_metric(infoPtr, 5) : get_scaled_metric(infoPtr, 4);
if (client_size < infoPtr->uThumbLen)
infoPtr->uThumbLen = client_size > get_scaled_metric(infoPtr, 9) ?
client_size - get_scaled_metric(infoPtr, 5) : get_scaled_metric(infoPtr, 4);
}
TRACKBAR_CalcChannel (infoPtr);
TRACKBAR_UpdateThumb (infoPtr);