Module: wine Branch: stable Commit: fc9e0a26bab8f0fc07b5e4074682a6f9b4b533cc URL: http://source.winehq.org/git/wine.git/?a=commit;h=fc9e0a26bab8f0fc07b5e40746...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Mar 21 17:36:13 2016 +0300
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 (cherry picked from commit 9d91fce444fab9dc408f1e3834b2b0738843ec41) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/user32/scroll.c | 2 +- dlls/user32/tests/scroll.c | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index be205ef..e844122 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -2040,7 +2040,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH EnableScrollBar( HWND hwnd, UINT nBar, UINT flags nBar = SB_HORZ; } else - bFineWithMe = TRUE; + bFineWithMe = nBar != SB_CTL;
if (!(infoPtr = SCROLL_GetInternalInfo( hwnd, nBar, TRUE ))) return FALSE; if (bFineWithMe && infoPtr->flags == flags) return FALSE; diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c index 691855b..1c454fb 100644 --- a/dlls/user32/tests/scroll.c +++ b/dlls/user32/tests/scroll.c @@ -114,6 +114,15 @@ static void test_EnableScrollBar(void) ok( ret, "The scrollbar 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(mainwnd); } @@ -539,7 +548,7 @@ static void test_SetScrollInfo(void) EnableScrollBar(hScroll, SB_CTL, ESB_DISABLE_BOTH);
ret = IsWindowEnabled(hScroll); - ok(!ret, "scroll bar disabled\n"); + ok(!ret, "scroll bar enabled\n");
memset(&si, 0, sizeof(si)); si.cbSize = sizeof(si); @@ -551,9 +560,10 @@ static void test_SetScrollInfo(void) memset(&si, 0, sizeof(si)); si.cbSize = sizeof(si); 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.nMax = 100; + si.nMin = 10; si.nPos = 0; si.nPage = 100; SetScrollInfo(hScroll, SB_CTL, &si, TRUE); @@ -564,6 +574,18 @@ static void test_SetScrollInfo(void) ret = GetScrollInfo(hScroll, SB_CTL, &si); 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(mainwnd); }