[1/2] user32: Disable scroll bar control window when both buttons disabled

Nikolay Sivov bunglehead at gmail.com
Wed Mar 4 17:24:59 CST 2009


Changelog:
    - Disable scroll bar control window when both buttons disabled
    - Some tests added for SB_CTL and buttons disabling

>From 2d012f35ec64d8d8c0b5bc745215ebdd95a9a61c Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 4 Mar 2009 17:38:41 -0500
Subject: Disable scroll bar control window when both buttons disabled

---
 dlls/user32/scroll.c       |    3 +++
 dlls/user32/tests/scroll.c |   19 +++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c
index b243e27..93f85f2 100644
--- a/dlls/user32/scroll.c
+++ b/dlls/user32/scroll.c
@@ -2069,6 +2069,9 @@ BOOL WINAPI EnableScrollBar( HWND hwnd, UINT nBar, UINT flags )
     if (bFineWithMe && infoPtr->flags == flags) return FALSE;
     infoPtr->flags = flags;
 
+    if (nBar == SB_CTL && (flags == ESB_DISABLE_BOTH || flags == ESB_ENABLE_BOTH))
+        EnableWindow(hwnd, flags == ESB_ENABLE_BOTH);
+
     SCROLL_RefreshScrollBar( hwnd, nBar, TRUE, TRUE );
     return TRUE;
 }
diff --git a/dlls/user32/tests/scroll.c b/dlls/user32/tests/scroll.c
index 9547d54..46080ca 100644
--- a/dlls/user32/tests/scroll.c
+++ b/dlls/user32/tests/scroll.c
@@ -54,15 +54,26 @@ static void scrollbar_test1(void)
 
     ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_BOTH );
     ok( ret, "The scrollbar should be disabled.\n" );
-    todo_wine
-    {
-        ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
-    }
+    ok( !IsWindowEnabled( hScroll ), "The scrollbar window should be disabled.\n" );
 
     ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
     ok( ret, "The scrollbar should be enabled.\n" );
     ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
 
+    /* test buttons separately */
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_LTUP );
+    ok( ret, "The scrollbar LTUP button should be disabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
+    ok( ret, "The scrollbar should be enabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
+
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_DISABLE_RTDN );
+    ok( ret, "The scrollbar RTDN button should be disabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
+    ret = EnableScrollBar( hScroll, SB_CTL, ESB_ENABLE_BOTH );
+    ok( ret, "The scrollbar should be enabled.\n" );
+    ok( IsWindowEnabled( hScroll ), "The scrollbar window should be enabled.\n" );
 }
 
 static void scrollbar_test2(void)
-- 
1.5.6.5





More information about the wine-patches mailing list