user32: For EnableScrollBar() always go through EnableWindow() in SB_CTL case.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-03-21 17:36:13 +03:00 committed by Alexandre Julliard
parent 4dcbf2b4b2
commit 9d91fce444
2 changed files with 25 additions and 3 deletions

View File

@ -2039,7 +2039,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnableScrollBar( HWND hwnd, UINT nBar, UINT flags
nBar = SB_HORZ; nBar = SB_HORZ;
} }
else else
bFineWithMe = TRUE; bFineWithMe = nBar != SB_CTL;
if (!(infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, TRUE ))) return FALSE; if (!(infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, TRUE ))) return FALSE;
if (bFineWithMe && infoPtr->flags == flags) return FALSE; if (bFineWithMe && infoPtr->flags == flags) return FALSE;

View File

@ -114,6 +114,15 @@ static void test_EnableScrollBar(void)
ok( ret, "The scrollbar should be enabled.\n" ); ok( ret, "The scrollbar should be enabled.\n" );
ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" ); ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
/* disable window, try to reenable */
ret = EnableWindow( hScroll, FALSE );
ok( !ret, "got %d\n", ret );
ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
ok( ret, "got %d\n", ret );
ok( IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
DestroyWindow(hScroll); DestroyWindow(hScroll);
DestroyWindow(mainwnd); DestroyWindow(mainwnd);
} }
@ -539,7 +548,7 @@ static void test_SetScrollInfo(void)
EnableScrollBar(hScroll, SB_CTL, ESB_DISABLE_BOTH); EnableScrollBar(hScroll, SB_CTL, ESB_DISABLE_BOTH);
ret = IsWindowEnabled(hScroll); ret = IsWindowEnabled(hScroll);
ok(!ret, "scroll bar disabled\n"); ok(!ret, "scroll bar enabled\n");
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
@ -551,9 +560,10 @@ static void test_SetScrollInfo(void)
memset(&si, 0, sizeof(si)); memset(&si, 0, sizeof(si));
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
ret = IsWindowEnabled(hScroll); ret = IsWindowEnabled(hScroll);
ok(!ret, "scroll bar disabled\n"); ok(!ret, "scroll bar enabled\n");
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL; si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
si.nMax = 100; si.nMax = 100;
si.nMin = 10;
si.nPos = 0; si.nPos = 0;
si.nPage = 100; si.nPage = 100;
SetScrollInfo(hScroll, SB_CTL, &si, TRUE); SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
@ -564,6 +574,18 @@ static void test_SetScrollInfo(void)
ret = GetScrollInfo(hScroll, SB_CTL, &si); ret = GetScrollInfo(hScroll, SB_CTL, &si);
ok(ret, "got %d\n", ret); ok(ret, "got %d\n", ret);
EnableScrollBar(hScroll, SB_CTL, ESB_ENABLE_BOTH);
ok(IsWindowEnabled(hScroll), "expected enabled scrollbar\n");
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
si.nMax = 10;
si.nMin = 100;
si.nPos = 0;
si.nPage = 100;
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
ret = IsWindowEnabled(hScroll);
ok(ret, "scroll bar disabled\n");
DestroyWindow(hScroll); DestroyWindow(hScroll);
DestroyWindow(mainwnd); DestroyWindow(mainwnd);
} }