[PATCH] user32: For EnableScrollBar() always go through EnableWindow() in SB_CTL case

Nikolay Sivov nsivov at codeweavers.com
Mon Mar 21 09:36:13 CDT 2016


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---

For https://bugs.winehq.org/show_bug.cgi?id=20695

 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 b28ee44..a210962 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -2039,7 +2039,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);
 }
-- 
2.7.0




More information about the wine-patches mailing list